| 391 | } |
| 392 | |
| 393 | int main(int argc, char *argv[]) |
| 394 | { |
| 395 | FILE *input; |
| 396 | |
| 397 | // Init the array of paths that |
| 398 | // the shell with look for executables in |
| 399 | init_paths(); |
| 400 | |
| 401 | if (argc > 1) // If arg is supplied use batch mode |
| 402 | { |
| 403 | input = fopen(argv[1], "r"); |
| 404 | if (input == NULL || argc > 2) // If the input file doesn't exist or multiple input file arguments were given |
| 405 | { |
| 406 | print_err(); |
| 407 | exit(1); |
| 408 | } |
| 409 | |
| 410 | batch_mode(input); |
| 411 | } |
| 412 | else // else use interactive mode |
| 413 | { |
| 414 | interactive_mode(); |
| 415 | } |
| 416 | |
| 417 | free_paths(); |
| 418 | exit(0); |
| 419 | } |
nothing calls this directly
no test coverage detected