diff options
Diffstat (limited to 'src/tsnif.c')
-rw-r--r-- | src/tsnif.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/tsnif.c b/src/tsnif.c index 9cba8e0..ef83561 100644 --- a/src/tsnif.c +++ b/src/tsnif.c @@ -123,6 +123,8 @@ static int get_type(char *optarg) static int get_args(int argc, char **argv) { + int ret = 0; + while (1) { int c; int option_index = 0; @@ -130,13 +132,14 @@ static int get_args(int argc, char **argv) {"type", required_argument, 0, 't'}, {"idx", required_argument, 0, 'i'}, {"store", required_argument, 0, 's'}, - {"version", no_argument, 0, 'v'}, - {"debug", no_argument, 0, 'd'}, + {"version", no_argument, 0, 'V'}, + {"debug", required_argument, 0, 'd'}, + {"verbose", required_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; - c = getopt_long(argc, argv, "t:i:s:vdh", + c = getopt_long(argc, argv, "t:i:s:v:d:hV", long_options, &option_index); if (c == -1) @@ -164,12 +167,16 @@ static int get_args(int argc, char **argv) store = 1; break; + case 'V': + print_version(argv[0]); + break; + case 'v': - printf("tsnif "CONFIG_TSNIF_VER"\n"); + ret = debug_parse_flags(0, optarg); break; case 'd': - tsnif_debug = 1; + ret = debug_parse_flags(1, optarg); break; case 'h': @@ -182,9 +189,9 @@ static int get_args(int argc, char **argv) } /* while(1) */ if ((type == -1) || (idx == -1)) - return -1; + return -EINVAL; - return 0; + return ret; } static int process_input(void) |