- /* Reset in case we're called more than once. */
- optopt = 0;
- optind = 0;
- while ((ret = getopt_long(*argc, argv, optstring, options, &longidx))
- != -1) {
- char *problem;
- const char *name;
-
- /* optopt is 0 if it's an unknown long option, *or* if
- * -? is a valid short option. */
- if (ret == '?') {
- if (optopt || strncmp(argv[optind-1], "--", 2) == 0) {
- parse_fail(errlog, optopt, argv[optind-1]+2,
- "unrecognized option");
- break;
- }
- } else if (ret == ':') {
- /* Missing argument: longidx not updated :( */
- parse_fail(errlog, optopt, argv[optind-1]+2,
- "option requires an argument");
- break;
- }
+ while ((ret = parse_one(&argc, tmpargv, OPT_EARLY, &off, errlog)) == 1);