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

Function http_appendf

src/ui/http_server.c:454–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452static void http_appendf(char *buf, size_t bufsz, int *pos, const char *fmt, ...)
453 __attribute__((format(printf, 4, 5)));
454static void http_appendf(char *buf, size_t bufsz, int *pos, const char *fmt, ...) {
455 if (*pos < 0) {
456 return;
457 }
458 if ((size_t)*pos >= bufsz) {
459 *pos = (int)bufsz;
460 return;
461 }
462 va_list ap;
463 va_start(ap, fmt);
464 int n = vsnprintf(buf + *pos, bufsz - (size_t)*pos, fmt, ap);
465 va_end(ap);
466 if (n < 0) {
467 return;
468 }
469 if ((size_t)n >= bufsz - (size_t)*pos) {
470 *pos = (int)bufsz;
471 } else {
472 *pos += n;
473 }
474}
475
476/* GET /api/logs?lines=N — returns last N log lines */
477static void handle_logs(cbm_http_conn_t *c, const cbm_http_req_t *req) {

Callers 6

handle_logsFunction · 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