| 381 | } |
| 382 | |
| 383 | void parse_options(void *optctx, int argc, char **argv, const OptionDef *options, |
| 384 | void (*parse_arg_function)(void *, const char*)) |
| 385 | { |
| 386 | const char *opt; |
| 387 | int optindex, handleoptions = 1, ret; |
| 388 | |
| 389 | /* perform system-dependent conversions for arguments list */ |
| 390 | prepare_app_arguments(&argc, &argv); |
| 391 | |
| 392 | /* parse options */ |
| 393 | optindex = 1; |
| 394 | while (optindex < argc) { |
| 395 | opt = argv[optindex++]; |
| 396 | |
| 397 | if (handleoptions && opt[0] == '-' && opt[1] != '\0') { |
| 398 | if (opt[1] == '-' && opt[2] == '\0') { |
| 399 | handleoptions = 0; |
| 400 | continue; |
| 401 | } |
| 402 | opt++; |
| 403 | |
| 404 | if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0) |
| 405 | exit_program(1); |
| 406 | optindex += ret; |
| 407 | } else { |
| 408 | if (parse_arg_function) |
| 409 | parse_arg_function(optctx, opt); |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | int parse_optgroup(void *optctx, OptionGroup *g) |
| 415 | { |
nothing calls this directly
no test coverage detected