Home GnuPG

core: Finalize the API for argparse.

Description

core: Finalize the API for argparse.

* src/gpg-error.h.in (ARGPARSE_end): Simplify.
* src/argparse.c (_gpgrt_argparse_internal_s): Add field opts.
(deinitialize): Release new field.
(initialize): Add arg opts and create a copy of the option list.  Add
the internal options.
(_gpgrt_argparse): Rename arg opts to opts_orig and set new local var
opts.  Adjust all references to opts.
(find_long_option): Adjust for chnaged type of OPTS.  Re-indent.
(arg_parse): Remove internal option assignment.  Rename arg opts to
opts_orig and set new local var opts.  Adjust all references to opts.
(show_help): Adjust all references to opts.

The old ARGPARSE_end maro was a bit cumbersome and does not allow to
chnage the number of internal options. Thus this somewhat larger
chnage to keep the internal options out of the API.

Note that with this change the internal options now also work in a
option file and not just on the command line; that does not make much
sense but is probably less surprising.

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Apr 11 2018, 9:10 AM
Parents
rE99e976be723e: doc: Fix previous commit.
Branches
Unknown
Tags
Unknown