| 108 | } |
| 109 | |
| 110 | int |
| 111 | main(int argc, char **argv) |
| 112 | { |
| 113 | char buf[2048], *s, *string[2], *end[2]; |
| 114 | const char *arg; |
| 115 | FILE *fp; |
| 116 | int opt, line, i, flag[2]; |
| 117 | poptContext pc = poptGetContext("wildtest", argc, (const char**)argv, |
| 118 | long_options, 0); |
| 119 | |
| 120 | while ((opt = poptGetNextOpt(pc)) != -1) { |
| 121 | switch (opt) { |
| 122 | case 'e': |
| 123 | arg = poptGetOptArg(pc); |
| 124 | empties_mod = atoi(arg); |
| 125 | if (strchr(arg, 's')) |
| 126 | empty_at_start = 1; |
| 127 | if (strchr(arg, 'e')) |
| 128 | empty_at_end = 1; |
| 129 | if (!explode_mod) |
| 130 | explode_mod = 1024; |
| 131 | break; |
| 132 | default: |
| 133 | fprintf(stderr, "%s: %s\n", |
| 134 | poptBadOption(pc, POPT_BADOPTION_NOALIAS), |
| 135 | poptStrerror(opt)); |
| 136 | exit(1); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | if (explode_mod && !empties_mod) |
| 141 | empties_mod = 1024; |
| 142 | |
| 143 | argv = (char**)poptGetArgs(pc); |
| 144 | if (!argv || argv[1]) { |
| 145 | fprintf(stderr, "Usage: wildtest [OPTIONS] TESTFILE\n"); |
| 146 | exit(1); |
| 147 | } |
| 148 | |
| 149 | if ((fp = fopen(*argv, "r")) == NULL) { |
| 150 | fprintf(stderr, "Unable to open %s\n", *argv); |
| 151 | exit(1); |
| 152 | } |
| 153 | |
| 154 | line = 0; |
| 155 | while (fgets(buf, sizeof buf, fp)) { |
| 156 | line++; |
| 157 | if (*buf == '#' || *buf == '\n') |
| 158 | continue; |
| 159 | for (s = buf, i = 0; i <= 1; i++) { |
| 160 | if (*s == '1') |
| 161 | flag[i] = 1; |
| 162 | else if (*s == '0') |
| 163 | flag[i] = 0; |
| 164 | else |
| 165 | flag[i] = -1; |
| 166 | if (*++s != ' ' && *s != '\t') |
| 167 | flag[i] = -1; |
nothing calls this directly
no test coverage detected