mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
common: Allow abbreviations of standard options.
* argparse.h (ARGPARSE_SHORTOPT_HELP, ARGPARSE_SHORTOPT_VERSION, ARGPARSE_SHORTOPT_WARRANTY, ARGPARSE_SHORTOPT_DUMP_OPTIONS): New macros. (ARGPARSE_end): Add some placeholders for standard options. * argparse.c (arg_parse): Fill in missing standard options so default machinery works. Check for standard options in new way. Do not write out standard options for --dump-options. Signed-off-by: Marcus Brinkmann <mb@g10code.com> GnuPG-bug-id: 1747
This commit is contained in:
parent
2e1342b78b
commit
f17862d47d
2 changed files with 52 additions and 7 deletions
|
@ -71,6 +71,12 @@ typedef struct
|
|||
const char *description; /* Optional option description. */
|
||||
} ARGPARSE_OPTS;
|
||||
|
||||
/* Short options. */
|
||||
#define ARGPARSE_SHORTOPT_HELP 32768
|
||||
#define ARGPARSE_SHORTOPT_VERSION 32769
|
||||
#define ARGPARSE_SHORTOPT_WARRANTY 32770
|
||||
#define ARGPARSE_SHORTOPT_DUMP_OPTIONS 32771
|
||||
|
||||
|
||||
/* Global flags (ARGPARSE_ARGS). */
|
||||
#define ARGPARSE_FLAG_KEEP 1 /* Do not remove options form argv. */
|
||||
|
@ -169,7 +175,13 @@ typedef struct
|
|||
#define ARGPARSE_group(s,d) \
|
||||
{ (s), NULL, 0, (d) }
|
||||
|
||||
#define ARGPARSE_end() { 0, NULL, 0, NULL }
|
||||
/* Placeholder options for help, version, warranty and dump-options. See arg_parse(). */
|
||||
#define ARGPARSE_end() \
|
||||
{ 0, NULL, 0, NULL }, \
|
||||
{ 0, NULL, 0, NULL }, \
|
||||
{ 0, NULL, 0, NULL }, \
|
||||
{ 0, NULL, 0, NULL }, \
|
||||
{ 0, NULL, 0, NULL }
|
||||
|
||||
|
||||
/* Other constants. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue