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

Function http_appendf

src/ui/http_server.c:413–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411static void http_appendf(char *buf, size_t bufsz, int *pos, const char *fmt, ...)
412 __attribute__((format(printf, 4, 5)));
413static void http_appendf(char *buf, size_t bufsz, int *pos, const char *fmt, ...) {
414 if (*pos < 0) {
415 return;
416 }
417 if ((size_t)*pos >= bufsz) {
418 *pos = (int)bufsz;
419 return;
420 }
421 va_list ap;
422 va_start(ap, fmt);
423 int n = vsnprintf(buf + *pos, bufsz - (size_t)*pos, fmt, ap);
424 va_end(ap);
425 if (n < 0) {
426 return;
427 }
428 if ((size_t)n >= bufsz - (size_t)*pos) {
429 *pos = (int)bufsz;
430 } else {
431 *pos += n;
432 }
433}
434
435/* GET /api/logs?lines=N — returns last N log lines */
436static 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