From: Timo Kokkonen Date: Fri, 29 Apr 2011 20:04:58 +0000 (+0300) Subject: options: Make verbose level adjustable X-Git-Url: http://git.itanic.dy.fi/?p=glucose;a=commitdiff_plain;h=fece31a026884dda16c9733077ccf885fd7671b3 options: Make verbose level adjustable Signed-off-by: Timo Kokkonen --- diff --git a/options.c b/options.c index 4e2a539..90fb448 100644 --- a/options.c +++ b/options.c @@ -1,5 +1,6 @@ #include #include +#include #include "options.h" @@ -8,7 +9,7 @@ int read_args(int argc, char *argv[], struct user_options *opts) int option_index = 0, c; static struct option long_options[] = { { .val = 'd', .name = "device", .has_arg = 1, }, - { .val = 'v', .name = "verbose", }, + { .val = 'v', .name = "verbose", .has_arg = 2}, }; char short_options[] = "d:v"; @@ -26,7 +27,10 @@ int read_args(int argc, char *argv[], struct user_options *opts) opts->usbdev = optarg; break; case 'v': - opts->trace_level++; + if (optarg) + opts->trace_level = atoi(optarg); + else + opts->trace_level++; case '?': return -1; }