The index of the program argv runs, past wrappers (time, sudo, retry N, * timeout D, env A=B, ...); -1 when argv has none. Its value may be unknown * (NULL). */
| 1378 | * timeout D, env A=B, ...); -1 when argv has none. Its value may be unknown |
| 1379 | * (NULL). */ |
| 1380 | static int sh_program(const sh_t *s, const sh_argv_t *a) { |
| 1381 | static const char *const wrappers[] = {"time", "sudo", "exec", "nice", "nohup", |
| 1382 | "command", "env", "timeout", "retry", NULL}; |
| 1383 | int i = 0; |
| 1384 | while (i < a->n) { |
| 1385 | if (!a->v[i] || !sh_in(sh_basename(a->v[i]), wrappers)) { |
| 1386 | return i; |
| 1387 | } |
| 1388 | if (strcmp(a->v[i], "command") == 0 && i + SKIP_ONE < a->n && |
| 1389 | (sh_eq(a->v[i + SKIP_ONE], "-v") || sh_eq(a->v[i + SKIP_ONE], "-V"))) { |
| 1390 | return -1; /* command -v X: is there an X, not a run of it */ |
| 1391 | } |
| 1392 | i++; |
| 1393 | while (i < a->n && sh_wrapper_arg(s, a, i)) { |
| 1394 | i++; |
| 1395 | } |
| 1396 | } |
| 1397 | return -1; |
| 1398 | } |
| 1399 | |
| 1400 | /* kubectl's options that take a separate value (before the verb). */ |
| 1401 | static const char *const SH_KUBECTL_VALUED[] = {"-n", |
no test coverage detected