From 7c1ccf819bd3a77518f4fe8970355eb78bd5ee59 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 28 Jul 2009 14:17:41 +0200 Subject: debug: allow runtime control of debugging output Signed-off-by: Patrick McHardy --- src/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 3daa294e..21606ee7 100644 --- a/src/main.c +++ b/src/main.c @@ -26,6 +26,9 @@ #include unsigned int numeric_output; +#ifdef DEBUG +unsigned int debug_level; +#endif const char *include_paths[INCLUDE_PATHS_MAX] = { DEFAULT_INCLUDE_PATH }; static unsigned int num_include_paths = 1; @@ -37,6 +40,7 @@ enum opt_vals { OPT_INTERACTIVE = 'i', OPT_INCLUDEPATH = 'I', OPT_NUMERIC = 'n', + OPT_DEBUG = 'd', OPT_INVALID = '?', }; @@ -69,6 +73,13 @@ static const struct option options[] = { .val = OPT_INCLUDEPATH, .has_arg = 1, }, +#ifdef DEBUG + { + .name = "debug", + .val = OPT_DEBUG, + .has_arg = 1, + }, +#endif { .name = NULL } @@ -90,6 +101,9 @@ static void show_help(const char *name) " When specified twice, also show Internet protocols,\n" " Internet services, user IDs and group IDs numerically.\n" " -i/--includepath Add to the paths searched for include files.\n" +#ifdef DEBUG +" --debug Specify debugging level\n" +#endif "\n", name); } @@ -142,6 +156,11 @@ int main(int argc, char * const *argv) case OPT_NUMERIC: numeric_output++; break; +#ifdef DEBUG + case OPT_DEBUG: + debug_level |= DEBUG_NETLINK; + break; +#endif case OPT_INVALID: exit(NFT_EXIT_FAILURE); } -- cgit v1.2.3