| 348 | } |
| 349 | |
| 350 | void parse_args(int argc, char* argv[]) { |
| 351 | struct option long_opts[] |
| 352 | = {{"help", false, nullptr, 'h'}, {"tmp-dir", true, nullptr, 't'}, {nullptr, 0, nullptr, 0}}; |
| 353 | |
| 354 | while (true) { |
| 355 | optopt = 1; |
| 356 | int optchar = getopt_long(argc, argv, "ht:", long_opts, nullptr); |
| 357 | if (optchar == -1) { |
| 358 | break; |
| 359 | } |
| 360 | |
| 361 | switch (optchar) { |
| 362 | case 't': |
| 363 | tmp_dir = optarg; |
| 364 | break; |
| 365 | case 'h': |
| 366 | print_usage(stdout, argv[0]); |
| 367 | exit(0); |
| 368 | case '?': |
| 369 | exit(1); |
| 370 | default: |
| 371 | // Only happens if someone adds another option to the optarg string, |
| 372 | // but doesn't update the switch statement to handle it. |
| 373 | fprintf(stderr, "unknown option \"-%c\"\n", optchar); |
| 374 | exit(1); |
| 375 | } |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | #ifdef BOOST_TEST_DYN_LINK |
| 380 | static int myArgc = 0; |
no test coverage detected