summaryrefslogtreecommitdiffstats
path: root/common/miscellaneous.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-06-23 09:10:56 +0200
committerWerner Koch <wk@gnupg.org>2015-06-23 09:13:45 +0200
commit8195e55d0c134a45f7c9bd95c8b5741781841c18 (patch)
tree875b3165da94d25bf281c221ee36b6d7e6701e63 /common/miscellaneous.c
parentscd: pinpad workaround for PC/SC implementations. (diff)
downloadgnupg2-8195e55d0c134a45f7c9bd95c8b5741781841c18.tar.xz
gnupg2-8195e55d0c134a45f7c9bd95c8b5741781841c18.zip
common: Improve fucntion parse_debug_flag.
* common/miscellaneous.c (parse_debug_flag): Add hack not to call exit. Add "none" and "all" flags. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'common/miscellaneous.c')
-rw-r--r--common/miscellaneous.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/common/miscellaneous.c b/common/miscellaneous.c
index e84089594..ec36f08ea 100644
--- a/common/miscellaneous.c
+++ b/common/miscellaneous.c
@@ -440,7 +440,8 @@ parse_debug_flag (const char *string, unsigned int *debugvar,
log_info ("available debug flags:\n");
for (i=0; flags[i].name; i++)
log_info (" %5u %s\n", flags[i].flag, flags[i].name);
- exit (0);
+ if (flags[i].flag != 77)
+ exit (0);
}
else if (digitp (string))
{
@@ -466,7 +467,17 @@ parse_debug_flag (const char *string, unsigned int *debugvar,
break;
}
if (!flags[j].name)
- log_info (_("unknown debug flag '%s' ignored\n"), words[i]);
+ {
+ if (!strcmp (words[i], "none"))
+ {
+ *debugvar = 0;
+ result = 0;
+ }
+ else if (!strcmp (words[i], "all"))
+ result = ~0;
+ else
+ log_info (_("unknown debug flag '%s' ignored\n"), words[i]);
+ }
}
}
xfree (words);