!= -1) {
char *problem;
const char *name;
- bool missing = false;
/* optopt is 0 if it's an unknown long option, *or* if
* -? is a valid short option. */
break;
}
} else if (ret == ':') {
- missing = true;
- ret = optopt;
+ /* Missing argument: longidx not updated :( */
+ parse_fail(errlog, optopt, argv[optind-1]+2,
+ "option requires an argument");
+ break;
}
if (ret != 0)
else
e = find_long(longidx, &name);
- /* Missing argument */
- if (missing) {
- parse_fail(errlog, ret, name,
- "option requires an argument");
- break;
- }
-
if (e->flags == OPT_HASARG)
problem = e->cb_arg(optarg, e->arg);
else