MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / http_appendf

Function http_appendf

src/ui/http_server.c:522–542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520static void http_appendf(char *buf, size_t bufsz, int *pos, const char *fmt, ...)
521 __attribute__((format(printf, 4, 5)));
522static void http_appendf(char *buf, size_t bufsz, int *pos, const char *fmt, ...) {
523 if (*pos < 0) {
524 return;
525 }
526 if ((size_t)*pos >= bufsz) {
527 *pos = (int)bufsz;
528 return;
529 }
530 va_list ap;
531 va_start(ap, fmt);
532 int n = vsnprintf(buf + *pos, bufsz - (size_t)*pos, fmt, ap);
533 va_end(ap);
534 if (n < 0) {
535 return;
536 }
537 if ((size_t)n >= bufsz - (size_t)*pos) {
538 *pos = (int)bufsz;
539 } else {
540 *pos += n;
541 }
542}
543
544/* GET /api/logs?lines=N — returns last N log lines */
545static bool log_query_has_key(const char *query, const char *key) {

Callers 9

handle_logsFunction · 0.85
ui_log_add_strFunction · 0.85
ui_log_add_intFunction · 0.85
handle_ui_log_postFunction · 0.85
handle_processesFunction · 0.85
append_roots_jsonFunction · 0.85
handle_browseFunction · 0.85
handle_adr_getFunction · 0.85
handle_index_statusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected