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

Function cbm_split_command

src/pipeline/pass_compile_commands.c:30–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30int cbm_split_command(const char *cmd, char **out, int max_out) {
31 if (!cmd || !out || max_out <= 0) {
32 return 0;
33 }
34
35 int count = 0;
36 char current[CBM_SZ_4K];
37 int clen = 0;
38 char in_quote = 0;
39
40 for (int i = 0; cmd[i]; i++) {
41 char c = cmd[i];
42 if (in_quote) {
43 if (c == in_quote) {
44 in_quote = 0;
45 } else if (clen < (int)sizeof(current) - SKIP_ONE) {
46 current[clen++] = c;
47 }
48 } else if (c == '"' || c == '\'') {
49 in_quote = c;
50 } else if (c == ' ' || c == '\t') {
51 count = emit_token(current, &clen, out, count, max_out);
52 } else if (clen < (int)sizeof(current) - SKIP_ONE) {
53 current[clen++] = c;
54 }
55 }
56 return emit_token(current, &clen, out, count, max_out);
57}
58
59/* Resolve a path: if relative, join with directory. */
60static char *resolve_path(const char *path, const char *directory) {

Callers 2

extract_flag_argsFunction · 0.85
test_pipeline.cFile · 0.85

Calls 1

emit_tokenFunction · 0.85

Tested by

no test coverage detected