|
@@ -314,12 +314,19 @@ static int get_value(struct parse_opt_ctx_t *p,
|
|
|
|
|
|
static int parse_short_opt(struct parse_opt_ctx_t *p, const struct option *options)
|
|
|
{
|
|
|
+retry:
|
|
|
for (; options->type != OPTION_END; options++) {
|
|
|
if (options->short_name == *p->opt) {
|
|
|
p->opt = p->opt[1] ? p->opt + 1 : NULL;
|
|
|
return get_value(p, options, OPT_SHORT);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (options->parent) {
|
|
|
+ options = options->parent;
|
|
|
+ goto retry;
|
|
|
+ }
|
|
|
+
|
|
|
return -2;
|
|
|
}
|
|
|
|
|
@@ -333,6 +340,7 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
|
|
|
if (!arg_end)
|
|
|
arg_end = arg + strlen(arg);
|
|
|
|
|
|
+retry:
|
|
|
for (; options->type != OPTION_END; options++) {
|
|
|
const char *rest;
|
|
|
int flags = 0;
|
|
@@ -426,6 +434,12 @@ match:
|
|
|
}
|
|
|
if (abbrev_option)
|
|
|
return get_value(p, abbrev_option, abbrev_flags);
|
|
|
+
|
|
|
+ if (options->parent) {
|
|
|
+ options = options->parent;
|
|
|
+ goto retry;
|
|
|
+ }
|
|
|
+
|
|
|
return -2;
|
|
|
}
|
|
|
|