mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Allow marking options as ignored.
* jnlib/argparse.h (ARGPARSE_OPT_IGNORE): New. (ARGPARSE_TYPE_MASK): New, for internal use. (ARGPARSE_ignore): New. * jnlib/argparse.c (optfile_parse, arg_parse): Replace remaining constants by macros. (optfile_parse): Implement ARGPARSE_OPT_IGNORE. (arg_parse): Exclide ignore options from --dump-options. -- In addition to the ignore-invalid-option (commit41d56433
) it is often useful to mark options in a configuration which as NOP. For example options which have no more function at all but can be expected to be found in existing conf files. Such an option (or command) may now be given as ARGPARSE_ignore (300, "obsolete-option") The 300 is merely used as a non-valid single option name much like group names or the 500+n values used for long options. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit54c54e2824
) Resolved conflicts: common/argparse.c: Fixed.
This commit is contained in:
parent
191e32026f
commit
8fc9de8d6b
2 changed files with 31 additions and 14 deletions
|
@ -94,7 +94,10 @@ typedef struct
|
|||
#define ARGPARSE_TYPE_ULONG 4 /* Takes an unsigned long argument. */
|
||||
#define ARGPARSE_OPT_OPTIONAL (1<<3) /* Argument is optional. */
|
||||
#define ARGPARSE_OPT_PREFIX (1<<4) /* Allow 0x etc. prefixed values. */
|
||||
#define ARGPARSE_OPT_COMMAND (1<<8) /* The argument is a command. */
|
||||
#define ARGPARSE_OPT_IGNORE (1<<6) /* Ignore command or option. */
|
||||
#define ARGPARSE_OPT_COMMAND (1<<7) /* The argument is a command. */
|
||||
|
||||
#define ARGPARSE_TYPE_MASK 7 /* Mask for the type values (internal). */
|
||||
|
||||
/* A set of macros to make option definitions easier to read. */
|
||||
#define ARGPARSE_x(s,l,t,f,d) \
|
||||
|
@ -161,6 +164,8 @@ typedef struct
|
|||
#define ARGPARSE_c(s,l,d) \
|
||||
{ (s), (l), (ARGPARSE_TYPE_NONE | ARGPARSE_OPT_COMMAND), (d) }
|
||||
|
||||
#define ARGPARSE_ignore(s,l) \
|
||||
{ (s), (l), (ARGPARSE_OPT_IGNORE), "@" }
|
||||
|
||||
#define ARGPARSE_group(s,d) \
|
||||
{ (s), NULL, 0, (d) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue