]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables-monitor: add --version option
authorFlorian Westphal <fw@strlen.de>
Wed, 4 Jul 2018 10:35:22 +0000 (12:35 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 4 Jul 2018 10:35:22 +0000 (12:35 +0200)
... for consistency with other commands.

Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/xtables-monitor.c

index e0a2d98fc2ef609b7223b7204d90f34b6867cb6d..08292a79a0af04f934e69da5547fd52e9bc82b5b 100644 (file)
@@ -575,6 +575,7 @@ static const struct option options[] = {
        {.name = "event", .has_arg = false, .val = 'e'},
        {.name = "ipv4", .has_arg = false, .val = '4'},
        {.name = "ipv6", .has_arg = false, .val = '6'},
+       {.name = "version", .has_arg = false, .val = 'V'},
        {NULL},
 };
 
@@ -618,7 +619,7 @@ int xtables_monitor_main(int argc, char *argv[])
 
        memset(&cb_arg, 0, sizeof(cb_arg));
        opterr = 0;
-       while ((c = getopt_long(argc, argv, "ceht46", options, NULL)) != -1) {
+       while ((c = getopt_long(argc, argv, "ceht46V", options, NULL)) != -1) {
                switch (c) {
                case 'c':
                        counters = true;
@@ -638,8 +639,11 @@ int xtables_monitor_main(int argc, char *argv[])
                case '6':
                        cb_arg.nfproto = NFPROTO_IPV6;
                        break;
+               case 'V':
+                       printf("xtables-monitor %s\n", IPTABLES_VERSION);
+                       exit(0);
                default:
-                       fprintf(stderr, "xtables-monitor %s: Bad argument.\n", XTABLES_VERSION);
+                       fprintf(stderr, "xtables-monitor %s: Bad argument.\n", IPTABLES_VERSION);
                        fprintf(stderr, "Try `xtables-monitor -h' for more information.");
                        exit(PARAMETER_PROBLEM);
                }