| 28 | } tic_option_t; |
| 29 | |
| 30 | static bool tic_parse(int argc, char **argv, const tic_option_t *options, size_t count) { |
| 31 | for (int i = 0; i < argc; i++) { |
| 32 | const tic_option_t *match = NULL; |
| 33 | for (size_t o = 0; o < count; o++) { |
| 34 | if (strcmp(argv[i], options[o].name) == 0) { |
| 35 | match = &options[o]; |
| 36 | } |
| 37 | } |
| 38 | if (!match) { |
| 39 | (void)fprintf(stderr, "test-impact: unknown argument %s\n", argv[i]); |
| 40 | return false; |
| 41 | } |
| 42 | if (match->flag) { |
| 43 | *match->flag = true; |
| 44 | continue; |
| 45 | } |
| 46 | if (i + 1 >= argc) { |
| 47 | (void)fprintf(stderr, "test-impact: %s needs a value\n", argv[i]); |
| 48 | return false; |
| 49 | } |
| 50 | *match->value = argv[++i]; |
| 51 | } |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | static int64_t tic_number(const char *text, int64_t fallback) { |
| 56 | if (!text || !*text) { |
no outgoing calls
no test coverage detected