diff options
author | Werner Koch <[email protected]> | 2013-04-18 12:40:43 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-03-07 07:51:47 +0000 |
commit | 8fc9de8d6bf663f7c8419b42dab01f590a694d59 (patch) | |
tree | cc57ebe3e108d33f9ddeca97a4b4043e309d8346 /common/argparse.h | |
parent | common: Fix recent commit 55656208. (diff) | |
download | gnupg-8fc9de8d6bf663f7c8419b42dab01f590a694d59.tar.gz gnupg-8fc9de8d6bf663f7c8419b42dab01f590a694d59.zip |
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 (commit 41d56433) 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 <[email protected]>
(cherry picked from commit 54c54e2824aab5716a187bbbf6dff8860d6a6056)
Resolved conflicts:
common/argparse.c: Fixed.
Diffstat (limited to '')
-rw-r--r-- | common/argparse.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/argparse.h b/common/argparse.h index a36218fc8..29c7b6252 100644 --- a/common/argparse.h +++ b/common/argparse.h @@ -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) } |