diff options
author | Werner Koch <[email protected]> | 2015-06-23 07:12:44 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-06-23 07:13:45 +0000 |
commit | 54a0ed3d9b10a3c6dfb3d6a4d20b693a3183f8f6 (patch) | |
tree | 1ef4ed41f92876b09273a74031ef2173aaea7d95 /g13/g13.c | |
parent | common: Improve fucntion parse_debug_flag. (diff) | |
download | gnupg-54a0ed3d9b10a3c6dfb3d6a4d20b693a3183f8f6.tar.gz gnupg-54a0ed3d9b10a3c6dfb3d6a4d20b693a3183f8f6.zip |
Allow use of debug flag names for all tools.
* g13/g13.c: Make use of debug_parse_flag.
* scd/scdaemon.c: Ditto.
* sm/gpgsm.c: Ditto
* agent/gpg-agent.c: Ditto. But do not terminate on "help"
* dirmngr/dirmngr.c: Ditto.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g13/g13.c')
-rw-r--r-- | g13/g13.c | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -128,7 +128,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_s (oOptions, "options", N_("|FILE|read options from FILE")), - ARGPARSE_p_u (oDebug, "debug", "@"), + ARGPARSE_s_s (oDebug, "debug", "@"), ARGPARSE_s_s (oDebugLevel, "debug-level", N_("|LEVEL|set the debugging level to LEVEL")), ARGPARSE_s_n (oDebugAll, "debug-all", "@"), @@ -171,6 +171,18 @@ static ARGPARSE_OPTS opts[] = { }; +/* The list of supported debug flags. */ +static struct debug_flags_s debug_flags [] = + { + { DBG_MOUNT_VALUE , "mount" }, + { DBG_CRYPTO_VALUE , "crypto" }, + { DBG_MEMORY_VALUE , "memory" }, + { DBG_MEMSTAT_VALUE, "memstat" }, + { DBG_IPC_VALUE , "ipc" }, + { 0, NULL } + }; + + /* The timer tick interval used by the idle task. */ #define TIMERTICK_INTERVAL_SEC (1) @@ -289,12 +301,7 @@ set_debug (void) gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose); if (opt.debug) - log_info ("enabled debug flags:%s%s%s%s%s\n", - (opt.debug & DBG_MOUNT_VALUE )? " mount":"", - (opt.debug & DBG_CRYPTO_VALUE )? " crypto":"", - (opt.debug & DBG_MEMORY_VALUE )? " memory":"", - (opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"", - (opt.debug & DBG_IPC_VALUE )? " ipc":""); + parse_debug_flag (NULL, &opt.debug, debug_flags); } @@ -507,7 +514,13 @@ main ( int argc, char **argv) case oNoDetach: /*nodetach = 1; */break; - case oDebug: debug_value |= pargs.r.ret_ulong; break; + case oDebug: + if (parse_debug_flag (pargs.r.ret_str, &opt.debug, debug_flags)) + { + pargs.r_opt = ARGPARSE_INVALID_ARG; + pargs.err = ARGPARSE_PRINT_ERROR; + } + break; case oDebugAll: debug_value = ~0; break; case oDebugNone: debug_value = 0; break; case oDebugLevel: debug_level = pargs.r.ret_str; break; |