diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -93,6 +93,9 @@ const struct { .name = "malloc", .val = DBG_MALLOC },{ + .name = "announce", + .val = DBG_ANN + },{ .name = NULL, .val = 0 } @@ -118,10 +121,11 @@ cfg_init(int argc, char **argv) static struct option long_options[] = { { "homedir", required_argument, 0, 'h' }, { "debug", required_argument, 0, 'd' }, + { "verbose", no_argument, 0, 'v' }, { 0, 0, 0, 0 } }; - c = getopt_long(argc, argv, ":h:d:", + c = getopt_long(argc, argv, ":h:d:v", long_options, &option_index); if (c == -1) break; @@ -130,7 +134,21 @@ cfg_init(int argc, char **argv) case 'h': cfg->homedir = optarg; break; + case 'v': + debug_mask |= DBG_VERBOSE; + break; case 'd': + if (!strcasecmp(optarg, "all")) { + debug_mask = ~0; + break; + } else if (!strcasecmp(optarg, "list")) { + error("Debug categories:\n"); + error(" * all\n"); + for (i = 0; debug_category_str[i].name; i++) + error(" * %s\n", debug_category_str[i].name); + exit(EXIT_FAILURE); + } + for (i = 0; debug_category_str[i].name; i++) { if (!strcasecmp(optarg, debug_category_str[i].name)) break; |