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

Function parse_ui_flags

src/main.c:1328–1352  ·  view source on GitHub ↗

Parse --ui= and --port= into a per-field daemon mutation. */

Source from the content-addressed store, hash-verified

1326
1327/* Parse --ui= and --port= into a per-field daemon mutation. */
1328static uint8_t parse_ui_flags(int argc, char **argv, bool *ui_enabled, int *ui_port,
1329 bool *explicit_enable) {
1330 uint8_t update_mask = 0;
1331 for (int i = SKIP_ONE; i < argc; i++) {
1332 if (strncmp(argv[i], "--ui=", SLEN("--ui=")) == 0) {
1333 *ui_enabled = strcmp(argv[i] + MAIN_FLAG_OFF, "true") == 0;
1334 if (explicit_enable && *ui_enabled) {
1335 *explicit_enable = true;
1336 }
1337 update_mask |= CBM_DAEMON_APPLICATION_UI_CONFIG_ENABLED;
1338 }
1339 if (strncmp(argv[i], "--port=", SLEN("--port=")) == 0) {
1340 const char *value = argv[i] + MAIN_PORT_OFF;
1341 char *end = NULL;
1342 errno = 0;
1343 long port = strtol(value, &end, CBM_DECIMAL_BASE);
1344 if (errno == 0 && end != value && end && *end == '\0' && port > 0 &&
1345 port < MAIN_MAX_PORT) {
1346 *ui_port = (int)port;
1347 update_mask |= CBM_DAEMON_APPLICATION_UI_CONFIG_PORT;
1348 }
1349 }
1350 }
1351 return update_mask;
1352}
1353
1354/* Install platform-specific signal handlers. */
1355static void setup_signal_handlers(void) {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected