| 168 | ****************************************************************************/ |
| 169 | |
| 170 | int main(int argc, char **argv, char **envp) |
| 171 | { |
| 172 | char *path; |
| 173 | char *next; |
| 174 | FILE *stream; |
| 175 | bool begin; |
| 176 | bool quoted; |
| 177 | bool scouring; |
| 178 | |
| 179 | if (argc != 2) |
| 180 | { |
| 181 | fprintf(stderr, "Unexpected number of arguments\n"); |
| 182 | show_usage(argv[0]); |
| 183 | } |
| 184 | |
| 185 | stream = fopen(argv[1], "r"); |
| 186 | if (!stream) |
| 187 | { |
| 188 | fprintf(stderr, "open %s failed: %s\n", argv[1], strerror(errno)); |
| 189 | exit(EXIT_FAILURE); |
| 190 | } |
| 191 | |
| 192 | begin = true; |
| 193 | scouring = false; |
| 194 | g_lineno = 0; |
| 195 | |
| 196 | while (fgets(g_line, MAX_LINE, stream) != NULL) |
| 197 | { |
| 198 | g_lineno++; |
| 199 | next = g_line; |
| 200 | |
| 201 | for (; ; ) |
| 202 | { |
| 203 | if (begin) |
| 204 | { |
| 205 | path = skip_spaces(next); |
| 206 | if (*path == '#') |
| 207 | { |
| 208 | /* The reset of the line is comment */ |
| 209 | |
| 210 | puts(path); |
| 211 | break; |
| 212 | } |
| 213 | |
| 214 | next = strchr(path, ':'); |
| 215 | if (!next) |
| 216 | { |
| 217 | fprintf(stderr, "%lu: Expected colon\n", g_lineno); |
| 218 | exit(EXIT_FAILURE); |
| 219 | } |
| 220 | |
| 221 | if (*next != '\0') |
| 222 | { |
| 223 | *next++ = '\0'; |
| 224 | } |
| 225 | |
| 226 | scouring = scour_path(path); |
| 227 | if (!scouring) |
nothing calls this directly
no test coverage detected