]> git.itanic.dy.fi Git - log-plotter/commitdiff
options: Make trace level adjustable
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 7 Oct 2013 14:38:01 +0000 (17:38 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 7 Oct 2013 14:38:01 +0000 (17:38 +0300)
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 <timo.t.kokkonen@iki.fi>
options.c

index 38b29a3abd48f645c378713e5c0e850c75897da4..5abca172add36bbee925efa6cbe8b5d1e201fa9d 100644 (file)
--- a/options.c
+++ b/options.c
@@ -4,6 +4,7 @@
 #include <string.h>
 
 #include "options.h"
 #include <string.h>
 
 #include "options.h"
+#include "debug.h"
 
 static void set_default_options(struct plotter_options *opts)
 {
 
 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 = '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);
 
 
        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 '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;
                }
                case '?':
                        return -1;
                }