From: Timo Kokkonen Date: Mon, 7 Oct 2013 14:38:01 +0000 (+0300) Subject: options: Make trace level adjustable X-Git-Url: http://git.itanic.dy.fi/?p=log-plotter;a=commitdiff_plain;h=112b349d73432945d85fa5d57c283a58c5cc5d22 options: Make trace level adjustable We already have a TRACE_DEBUG level but we can't show up the prints there unless we are able to adjust the trace level too. Now we can. Signed-off-by: Timo Kokkonen --- diff --git a/options.c b/options.c index 38b29a3..5abca17 100644 --- a/options.c +++ b/options.c @@ -4,6 +4,7 @@ #include #include "options.h" +#include "debug.h" static void set_default_options(struct plotter_options *opts) { @@ -20,8 +21,10 @@ int read_args(int argc, char *argv[], struct plotter_options *opts) { .val = 'd', .name = "device", .has_arg = 1, }, { .val = 'o', .name = "output", .has_arg = 1 }, { .val = 'o', .name = "baud", .has_arg = 1 }, + { .val = 'v', .name = "verbose", .has_arg = 2 }, + { .val = 'q', .name = "quiet", }, }; - char short_options[] = "d:o:b:"; + char short_options[] = "d:o:b:vq"; set_default_options(opts); @@ -42,6 +45,14 @@ int read_args(int argc, char *argv[], struct plotter_options *opts) case 'b': opts->baud_rate = atoi(optarg); break; + case 'v': + trace_level++; + pr_debug("Increased trace level to %d\n", trace_level); + break; + case 'q': + trace_level--; + pr_debug("Degreased trace level to %d\n", trace_level); + break; case '?': return -1; }