summaryrefslogtreecommitdiff
path: root/argp/argp-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'argp/argp-parse.c')
-rw-r--r--argp/argp-parse.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 47a16fac4f..edc5516851 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -526,7 +526,7 @@ parser_init (struct parser *parser, const struct argp *argp,
parser_convert (parser, argp, flags);
memset (&parser->state, 0, sizeof (struct argp_state));
- parser->state.argp = parser->argp;
+ parser->state.root_argp = parser->argp;
parser->state.argc = argc;
parser->state.argv = argv;
parser->state.flags = flags;
@@ -548,6 +548,14 @@ parser_init (struct parser *parser, const struct argp *argp,
if (group->parent)
/* If a child parser, get the initial input value from the parent. */
group->input = group->parent->child_inputs[group->parent_index];
+
+ if (!group->parser
+ && group->argp->children && group->argp->children->argp)
+ /* For the special case where no parsing function is supplied for an
+ argp, propagate its input to its first child, if any (this just
+ makes very simple wrapper argps more convenient). */
+ group->child_inputs[0] = group->input;
+
err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0);
}
if (err == EBADKEY)