1 /* Hierarchial argument parsing, layered over getopt
2 Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Written by Miles Bader <miles@gnu.ai.mit.edu>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
32 /* This is for other GNU distributions with internationalized messages.
33 When compiling libc, the _ macro is predefined. */
36 # define _(msgid) gettext (msgid)
38 # define _(msgid) (msgid)
39 # define gettext(msgid) (msgid)
44 #include <libc-lock.h>
46 #ifdef HAVE_CTHREADS_H
52 #include "argp-namefrob.h"
54 /* Getopt return values. */
55 #define KEY_END (-1) /* The end of the options. */
56 #define KEY_ARG 1 /* A non-option argument. */
57 #define KEY_ERR '?' /* An error parsing the options. */
59 /* The meta-argument used to prevent any further arguments being interpreted
63 /* The number of bits we steal in a long-option value for our own use. */
64 #define GROUP_BITS CHAR_BIT
66 /* The number of bits available for the user value. */
67 #define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS)
68 #define USER_MASK ((1 << USER_BITS) - 1)
70 /* EZ alias for ARGP_ERR_UNKNOWN. */
71 #define EBADKEY ARGP_ERR_UNKNOWN
73 /* Default options. */
75 /* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep
76 for one second intervals, decrementing _ARGP_HANG until it's zero. Thus
77 you can force the program to continue by attaching a debugger and setting
79 volatile int _argp_hang
= 0;
81 #define OPT_PROGNAME -2
85 static const struct argp_option argp_default_options
[] =
87 {"help", '?', 0, 0, "Give this help list", -1},
88 {"usage", OPT_USAGE
, 0, 0, "Give a short usage message"},
89 {"program-name",OPT_PROGNAME
,"NAME", OPTION_HIDDEN
, "Set the program name"},
90 {"HANG", OPT_HANG
, "SECS", OPTION_ARG_OPTIONAL
| OPTION_HIDDEN
,
91 "Hang for SECS seconds (default 3600)"},
96 argp_default_parser (int key
, char *arg
, struct argp_state
*state
)
101 __argp_state_help (state
, state
->out_stream
, ARGP_HELP_STD_HELP
);
104 __argp_state_help (state
, state
->out_stream
,
105 ARGP_HELP_USAGE
| ARGP_HELP_EXIT_OK
);
108 case OPT_PROGNAME
: /* Set the program name. */
109 program_invocation_name
= arg
;
111 /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka
112 __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined
113 to be that, so we have to be a bit careful here.] */
114 arg
= strrchr (arg
, '/');
116 program_invocation_short_name
= arg
+ 1;
118 program_invocation_short_name
= program_invocation_name
;
120 if ((state
->flags
& (ARGP_PARSE_ARGV0
| ARGP_NO_ERRS
))
122 state
->argv
[0] = program_invocation_name
; /* Update what getopt uses too. */
127 _argp_hang
= atoi (arg
? arg
: "3600");
128 while (_argp_hang
-- > 0)
138 static const struct argp argp_default_argp
=
139 {argp_default_options
, &argp_default_parser
};
142 static const struct argp_option argp_version_options
[] =
144 {"version", 'V', 0, 0, "Print program version", -1},
149 argp_version_parser (int key
, char *arg
, struct argp_state
*state
)
154 if (argp_program_version_hook
)
155 (*argp_program_version_hook
) (state
->out_stream
, state
);
156 else if (argp_program_version
)
157 fprintf (state
->out_stream
, "%s\n", argp_program_version
);
159 __argp_error (state
, _("No version known!?"));
160 if (! (state
->flags
& ARGP_NO_EXIT
))
169 static const struct argp argp_version_argp
=
170 {argp_version_options
, &argp_version_parser
};
172 /* Returns the offset into the getopt long options array LONG_OPTIONS of a
173 long option with called NAME, or -1 if none is found. Passing NULL as
174 NAME will return the number of options. */
176 find_long_option (struct option
*long_options
, const char *name
)
178 struct option
*l
= long_options
;
179 while (l
->name
!= NULL
)
180 if (name
!= NULL
&& strcmp (l
->name
, name
) == 0)
181 return l
- long_options
;
185 return l
- long_options
;
190 /* If we can, we regulate access to getopt, which is non-reentrant, with a
191 mutex. Since the case we're trying to guard against is two different
192 threads interfering, and it's possible that someone might want to call
193 argp_parse recursively (they're careful), we use a recursive lock if
198 __libc_lock_define_initialized_recursive (static, getopt_lock
)
199 #define LOCK_GETOPT __libc_lock_lock_recursive (getopt_lock)
200 #define UNLOCK_GETOPT __libc_lock_unlock_recursive (getopt_lock)
203 #ifdef HAVE_CTHREADS_H
205 static struct mutex getopt_lock
= MUTEX_INITIALIZER
;
206 #define LOCK_GETOPT mutex_lock (&getopt_lock)
207 #define UNLOCK_GETOPT mutex_unlock (&getopt_lock)
209 #else /* !HAVE_CTHREADS_H */
211 #define LOCK_GETOPT (void)0
212 #define UNLOCK_GETOPT (void)0
214 #endif /* HAVE_CTHREADS_H */
217 /* This hack to allow programs that know what's going on to call argp
218 recursively. If someday argp is changed not to use the non-reentrant
219 getopt interface, we can get rid of this shit. XXX */
221 _argp_unlock_xxx (void)
226 /* The state of a `group' during parsing. Each group corresponds to a
227 particular argp structure from the tree of such descending from the top
228 level argp passed to argp_parse. */
231 /* This group's parsing function. */
232 argp_parser_t parser
;
234 /* Points to the point in SHORT_OPTS corresponding to the end of the short
235 options for this group. We use it to determine from which group a
236 particular short options is from. */
239 /* The number of non-option args sucessfully handled by this parser. */
240 unsigned args_processed
;
242 /* This group's parser's parent's group. */
243 struct group
*parent
;
244 unsigned parent_index
; /* And the our position in the parent. */
246 /* These fields are swapped into and out of the state structure when
247 calling this group's parser. */
248 void *input
, **child_inputs
;
252 /* Call GROUP's parser with KEY and ARG, swapping any group-specific info
253 from STATE before calling, and back into state afterwards. If GROUP has
254 no parser, EBADKEY is returned. */
256 group_parse (struct group
*group
, struct argp_state
*state
, int key
, char *arg
)
261 state
->hook
= group
->hook
;
262 state
->input
= group
->input
;
263 state
->child_inputs
= group
->child_inputs
;
264 state
->arg_num
= group
->args_processed
;
265 err
= (*group
->parser
)(key
, arg
, state
);
266 group
->hook
= state
->hook
;
275 const struct argp
*argp
;
277 /* SHORT_OPTS is the getopt short options string for the union of all the
278 groups of options. */
280 /* LONG_OPTS is the array of getop long option structures for the union of
281 all the groups of options. */
282 struct option
*long_opts
;
284 /* States of the various parsing groups. */
285 struct group
*groups
;
286 /* The end of the GROUPS array. */
287 struct group
*egroup
;
288 /* An vector containing storage for the CHILD_INPUTS field in all groups. */
291 /* True if we think using getopt is still useful; if false, then
292 remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is
293 cleared whenever getopt returns KEY_END, but may be set again if the user
294 moves the next argument pointer backwards. */
297 /* State block supplied to parsing routines. */
298 struct argp_state state
;
300 /* Memory used by this parser. */
304 /* The next usable entries in the various parser tables being filled in by
306 struct parser_convert_state
308 struct parser
*parser
;
310 struct option
*long_end
;
311 void **child_inputs_end
;
314 /* Converts all options in ARGP (which is put in GROUP) and ancestors
315 into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and
316 CVT->LONG_END are the points at which new options are added. Returns the
317 next unused group entry. CVT holds state used during the conversion. */
318 static struct group
*
319 convert_options (const struct argp
*argp
,
320 struct group
*parent
, unsigned parent_index
,
321 struct group
*group
, struct parser_convert_state
*cvt
)
323 /* REAL is the most recent non-alias value of OPT. */
324 const struct argp_option
*real
= argp
->options
;
325 const struct argp_child
*children
= argp
->children
;
327 if (real
|| argp
->parser
)
329 const struct argp_option
*opt
;
332 for (opt
= real
; !__option_is_end (opt
); opt
++)
334 if (! (opt
->flags
& OPTION_ALIAS
))
335 /* OPT isn't an alias, so we can use values from it. */
338 if (! (real
->flags
& OPTION_DOC
))
339 /* A real option (not just documentation). */
341 if (__option_is_short (opt
))
342 /* OPT can be used as a short option. */
344 *cvt
->short_end
++ = opt
->key
;
347 *cvt
->short_end
++ = ':';
348 if (real
->flags
& OPTION_ARG_OPTIONAL
)
349 *cvt
->short_end
++ = ':';
351 *cvt
->short_end
= '\0'; /* keep 0 terminated */
355 && find_long_option (cvt
->parser
->long_opts
, opt
->name
) < 0)
356 /* OPT can be used as a long option. */
358 cvt
->long_end
->name
= opt
->name
;
359 cvt
->long_end
->has_arg
=
361 ? (real
->flags
& OPTION_ARG_OPTIONAL
365 cvt
->long_end
->flag
= 0;
366 /* we add a disambiguating code to all the user's
367 values (which is removed before we actually call
368 the function to parse the value); this means that
369 the user loses use of the high 8 bits in all his
370 values (the sign of the lower bits is preserved
373 ((opt
->key
| real
->key
) & USER_MASK
)
374 + (((group
- cvt
->parser
->groups
) + 1) << USER_BITS
);
376 /* Keep the LONG_OPTS list terminated. */
377 (++cvt
->long_end
)->name
= NULL
;
382 group
->parser
= argp
->parser
;
383 group
->short_end
= cvt
->short_end
;
384 group
->args_processed
= 0;
385 group
->parent
= parent
;
386 group
->parent_index
= parent_index
;
389 group
->child_inputs
= 0;
392 /* Assign GROUP's CHILD_INPUTS field some space from
393 CVT->child_inputs_end.*/
395 unsigned num_children
= 0;
396 while (children
[num_children
].argp
)
398 group
->child_inputs
= cvt
->child_inputs_end
;
399 cvt
->child_inputs_end
+= num_children
;
410 while (children
->argp
)
412 convert_options (children
++->argp
, parent
, index
++, group
, cvt
);
418 /* Find the merged set of getopt options, with keys appropiately prefixed. */
420 parser_convert (struct parser
*parser
, const struct argp
*argp
, int flags
)
422 struct parser_convert_state cvt
;
425 cvt
.short_end
= parser
->short_opts
;
426 cvt
.long_end
= parser
->long_opts
;
427 cvt
.child_inputs_end
= parser
->child_inputs
;
429 if (flags
& ARGP_IN_ORDER
)
430 *cvt
.short_end
++ = '-';
431 else if (flags
& ARGP_NO_ARGS
)
432 *cvt
.short_end
++ = '+';
433 *cvt
.short_end
= '\0';
435 cvt
.long_end
->name
= NULL
;
440 parser
->egroup
= convert_options (argp
, 0, 0, parser
->groups
, &cvt
);
442 parser
->egroup
= parser
->groups
; /* No parsers at all! */
445 /* Lengths of various parser fields which we will allocated. */
448 size_t short_len
; /* Getopt short options string. */
449 size_t long_len
; /* Getopt long options vector. */
450 size_t num_groups
; /* Group structures we allocate. */
451 size_t num_child_inputs
; /* Child input slots. */
454 /* For ARGP, increments the NUM_GROUPS field in SZS by the total number of
455 argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by
456 the maximum lengths of the resulting merged getopt short options string and
457 long-options array, respectively. */
459 calc_sizes (const struct argp
*argp
, struct parser_sizes
*szs
)
461 const struct argp_child
*child
= argp
->children
;
462 const struct argp_option
*opt
= argp
->options
;
464 if (opt
|| argp
->parser
)
470 while (!__option_is_end (opt
++))
472 szs
->short_len
+= num_opts
* 3; /* opt + up to 2 `:'s */
473 szs
->long_len
+= num_opts
;
480 calc_sizes ((child
++)->argp
, szs
);
481 szs
->num_child_inputs
++;
485 /* Initializes PARSER to parse ARGP in a manner described by FLAGS. */
487 parser_init (struct parser
*parser
, const struct argp
*argp
,
488 int argc
, char **argv
, int flags
, void *input
)
492 struct parser_sizes szs
;
494 szs
.short_len
= (flags
& ARGP_NO_ARGS
) ? 0 : 1;
497 szs
.num_child_inputs
= 0;
500 calc_sizes (argp
, &szs
);
502 /* Lengths of the various bits of storage used by PARSER. */
503 #define GLEN (szs.num_groups + 1) * sizeof (struct group)
504 #define CLEN (szs.num_child_inputs * sizeof (void *))
505 #define LLEN ((szs.long_len + 1) * sizeof (struct option))
506 #define SLEN (szs.short_len + 1)
508 parser
->storage
= malloc (GLEN
+ CLEN
+ LLEN
+ SLEN
);
509 if (! parser
->storage
)
512 parser
->groups
= parser
->storage
;
513 parser
->child_inputs
= parser
->storage
+ GLEN
;
514 parser
->long_opts
= parser
->storage
+ GLEN
+ CLEN
;
515 parser
->short_opts
= parser
->storage
+ GLEN
+ CLEN
+ LLEN
;
517 memset (parser
->child_inputs
, 0, szs
.num_child_inputs
* sizeof (void *));
518 parser_convert (parser
, argp
, flags
);
520 parser
->try_getopt
= 1;
522 memset (&parser
->state
, 0, sizeof (struct argp_state
));
523 parser
->state
.argp
= parser
->argp
;
524 parser
->state
.argc
= argc
;
525 parser
->state
.argv
= argv
;
526 parser
->state
.err_stream
= stderr
;
527 parser
->state
.out_stream
= stdout
;
528 parser
->state
.next
= 0; /* Tell getopt to initialize. */
530 /* Call each parser for the first time, giving it a chance to propagate
531 values to child parsers. */
532 if (parser
->groups
< parser
->egroup
)
533 parser
->groups
->input
= input
;
534 for (group
= parser
->groups
;
535 group
< parser
->egroup
&& (!err
|| err
== EBADKEY
);
539 /* If a child parser, get the initial input value from the parent. */
540 group
->input
= group
->parent
->child_inputs
[group
->parent_index
];
541 err
= group_parse (group
, &parser
->state
, ARGP_KEY_INIT
, 0);
544 err
= 0; /* Some parser didn't understand. */
549 if (parser
->state
.argv
== argv
&& argv
[0])
550 /* There's an argv[0]; use it for messages. */
551 parser
->state
.name
= argv
[0];
553 parser
->state
.name
= program_invocation_name
;
555 /* Getopt is (currently) non-reentrant. */
558 if (parser
->state
.flags
& ARGP_NO_ERRS
)
561 if (parser
->state
.flags
& ARGP_PARSE_ARGV0
)
562 /* getopt always skips ARGV[0], so we have to fake it out. As long
563 as OPTERR is 0, then it shouldn't actually try to access it. */
564 parser
->state
.argv
--, parser
->state
.argc
++;
567 opterr
= 1; /* Print error messages. */
572 /* Free any storage consumed by PARSER (but not PARSER itself). */
574 parser_finalize (struct parser
*parser
,
575 error_t err
, int arg_ebadkey
, int *end_index
)
581 if (err
== EBADKEY
&& arg_ebadkey
)
582 /* Suppress errors generated by unparsed arguments. */
586 if (parser
->state
.next
== parser
->state
.argc
)
587 /* We successfully parsed all arguments! Call all the parsers again,
588 just a few more times... */
590 for (group
= parser
->groups
;
591 group
< parser
->egroup
&& (!err
|| err
==EBADKEY
);
593 if (group
->args_processed
== 0)
594 err
= group_parse (group
, &parser
->state
, ARGP_KEY_NO_ARGS
, 0);
595 for (group
= parser
->groups
;
596 group
< parser
->egroup
&& (!err
|| err
==EBADKEY
);
598 err
= group_parse (group
, &parser
->state
, ARGP_KEY_END
, 0);
601 err
= 0; /* Some parser didn't understand. */
604 /* Return any remaining arguments to the user. */
605 *end_index
= parser
->state
.next
;
607 /* No way to return the remaining arguments, they must be bogus. */
609 if (!(parser
->state
.flags
& ARGP_NO_ERRS
) && parser
->state
.err_stream
)
610 fprintf (parser
->state
.err_stream
,
611 _("%s: Too many arguments\n"), parser
->state
.name
);
615 /* Okay, we're all done, with either an error or success. We only call the
616 parsers once more, to indicate which one. */
620 /* Maybe print an error message. */
622 /* An appropriate message describing what the error was should have
623 been printed earlier. */
624 __argp_state_help (&parser
->state
, parser
->state
.err_stream
,
627 /* Since we didn't exit, give each parser an error indication. */
628 for (group
= parser
->groups
; group
< parser
->egroup
; group
++)
629 group_parse (group
, &parser
->state
, ARGP_KEY_ERROR
, 0);
632 /* Do final cleanup, including propagating back values from parsers. */
634 /* We pass over the groups in reverse order so that child groups are
635 given a chance to do there processing before passing back a value to
637 for (group
= parser
->egroup
- 1
638 ; group
>= parser
->groups
&& (!err
|| err
== EBADKEY
)
640 err
= group_parse (group
, &parser
->state
, ARGP_KEY_SUCCESS
, 0);
642 err
= 0; /* Some parser didn't understand. */
648 free (parser
->storage
);
653 /* Call the user parsers to parse the non-option argument VAL, at the current
654 position, returning any error. */
656 parser_parse_arg (struct parser
*parser
, char *val
)
658 int index
= parser
->state
.next
;
659 error_t err
= EBADKEY
;
662 for (group
= parser
->groups
663 ; group
< parser
->egroup
&& err
== EBADKEY
665 err
= group_parse (group
, &parser
->state
, ARGP_KEY_ARG
, val
);
668 if (parser
->state
.next
>= index
)
669 /* Remember that we successfully processed a non-option
670 argument -- but only if the user hasn't gotten tricky and set
672 (--group
)->args_processed
++;
674 /* The user wants to reparse some args, give getopt another try. */
675 parser
->try_getopt
= 1;
680 /* Call the user parsers to parse the option OPT, with argument VAL, at the
681 current position, returning any error. */
683 parser_parse_opt (struct parser
*parser
, int opt
, char *val
)
685 /* The group key encoded in the high bits; 0 for short opts or
686 group_number + 1 for long opts. */
687 int group_key
= opt
>> USER_BITS
;
690 /* A short option. By comparing OPT's position in SHORT_OPTS to the
691 various starting positions in each group's SHORT_END field, we can
692 determine which group OPT came from. */
695 char *short_index
= strchr (parser
->short_opts
, opt
);
698 for (group
= parser
->groups
; group
< parser
->egroup
; group
++)
699 if (group
->short_end
> short_index
)
700 return group_parse (group
, &parser
->state
, opt
, optarg
);
702 return EBADKEY
; /* until otherwise asserted */
705 /* A long option. We use shifts instead of masking for extracting
706 the user value in order to preserve the sign. */
708 group_parse (&parser
->groups
[group_key
- 1], &parser
->state
,
709 (opt
<< GROUP_BITS
) >> GROUP_BITS
, optarg
);
712 /* Parse the next argument in PARSER (as indicated by PARSER->state.next).
713 Any error from the parsers is returned, and *ARGP_EBADKEY indicates
714 whether a value of EBADKEY is due to an unrecognized argument (which is
715 generally not fatal). */
717 parser_parse_next (struct parser
*parser
, int *arg_ebadkey
)
722 if (parser
->state
.quoted
&& parser
->state
.next
< parser
->state
.quoted
)
723 /* The next argument pointer has been moved to before the quoted
724 region, so pretend we never saw the quoting `--', and give getopt
725 another chance. If the user hasn't removed it, getopt will just
727 parser
->state
.quoted
= 0;
729 if (parser
->try_getopt
&& !parser
->state
.quoted
)
730 /* Give getopt a chance to parse this. */
732 optind
= parser
->state
.next
; /* Put it back in OPTIND for getopt. */
733 optopt
= KEY_END
; /* Distinguish KEY_ERR from a real option. */
734 if (parser
->state
.flags
& ARGP_LONG_ONLY
)
735 opt
= getopt_long_only (parser
->state
.argc
, parser
->state
.argv
,
736 parser
->short_opts
, parser
->long_opts
, 0);
738 opt
= getopt_long (parser
->state
.argc
, parser
->state
.argv
,
739 parser
->short_opts
, parser
->long_opts
, 0);
740 parser
->state
.next
= optind
; /* And see what getopt did. */
743 /* Getopt says there are no more options, so stop using
744 getopt; we'll continue if necessary on our own. */
746 parser
->try_getopt
= 0;
747 if (parser
->state
.next
> 1
748 && strcmp (parser
->state
.argv
[parser
->state
.next
- 1], QUOTE
)
750 /* Not only is this the end of the options, but it's a
751 `quoted' region, which may have args that *look* like
752 options, so we definitely shouldn't try to use getopt past
753 here, whatever happens. */
754 parser
->state
.quoted
= parser
->state
.next
;
756 else if (opt
== KEY_ERR
&& optopt
!= KEY_END
)
757 /* KEY_ERR can have the same value as a valid user short
758 option, but in the case of a real error, getopt sets OPTOPT
759 to the offending character, which can never be KEY_END. */
769 /* We're past what getopt considers the options. */
770 if (parser
->state
.next
>= parser
->state
.argc
771 || (parser
->state
.flags
& ARGP_NO_ARGS
))
772 /* Indicate that we're done. */
778 /* A non-option arg. */
780 parser_parse_arg (parser
, parser
->state
.argv
[parser
->state
.next
++]);
781 else if (opt
== KEY_ARG
)
782 /* A non-option argument; try each parser in turn. */
783 err
= parser_parse_arg (parser
, optarg
);
785 err
= parser_parse_opt (parser
, opt
, optarg
);
789 *arg_ebadkey
= (opt
== KEY_END
|| opt
== KEY_ARG
);
790 parser
->state
.next
--; /* Put back the unused argument. */
796 /* Parse the options strings in ARGC & ARGV according to the argp in ARGP.
797 FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the
798 index in ARGV of the first unparsed option is returned in it. If an
799 unknown option is present, EINVAL is returned; if some parser routine
800 returned a non-zero value, it is returned; otherwise 0 is returned. */
802 __argp_parse (const struct argp
*argp
, int argc
, char **argv
, unsigned flags
,
803 int *end_index
, void *input
)
806 struct parser parser
;
808 /* If true, then err == EBADKEY is a result of a non-option argument failing
809 to be parsed (which in some cases isn't actually an error). */
812 if (! (flags
& ARGP_NO_HELP
))
813 /* Add our own options. */
815 struct argp_child
*child
= alloca (4 * sizeof (struct argp_child
));
816 struct argp
*top_argp
= alloca (sizeof (struct argp
));
818 /* TOP_ARGP has no options, it just serves to group the user & default
820 memset (top_argp
, 0, sizeof (*top_argp
));
821 top_argp
->children
= child
;
823 memset (child
, 0, 4 * sizeof (struct argp_child
));
826 (child
++)->argp
= argp
;
827 (child
++)->argp
= &argp_default_argp
;
828 if (argp_program_version
|| argp_program_version_hook
)
829 (child
++)->argp
= &argp_version_argp
;
835 /* Construct a parser for these arguments. */
836 err
= parser_init (&parser
, argp
, argc
, argv
, flags
, input
);
842 err
= parser_parse_next (&parser
, &arg_ebadkey
);
843 err
= parser_finalize (&parser
, err
, arg_ebadkey
, end_index
);
849 weak_alias (__argp_parse
, argp_parse
)