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

Function sh_wrapper_arg

src/pipeline/pass_shell.c:1367–1375  ·  view source on GitHub ↗

Word i of argv is an option, assignment or count a wrapper takes before * the program: by its value, or -- the value unknown -- by its text * (env OUT="$TMP/x" prog: the assignment is no program). */

Source from the content-addressed store, hash-verified

1365 * the program: by its value, or -- the value unknown -- by its text
1366 * (env OUT="$TMP/x" prog: the assignment is no program). */
1367static bool sh_wrapper_arg(const sh_t *s, const sh_argv_t *a, int i) {
1368 const char *v = a->v[i];
1369 if (v) {
1370 return v[0] == '-' || strchr(v, '=') || sh_numberish(v);
1371 }
1372 uint32_t b = a->span[PAIR_LEN * i];
1373 uint32_t e = a->span[PAIR_LEN * i + SKIP_ONE];
1374 return e > b && (s->src[b] == '-' || memchr(s->src + b, '=', e - b));
1375}
1376
1377/* The index of the program argv runs, past wrappers (time, sudo, retry N,
1378 * timeout D, env A=B, ...); -1 when argv has none. Its value may be unknown

Callers 1

sh_programFunction · 0.85

Calls 1

sh_numberishFunction · 0.85

Tested by

no test coverage detected