From: Florian Westphal Date: Wed, 4 Jul 2018 10:35:22 +0000 (+0200) Subject: xtables-monitor: add --version option X-Git-Tag: v1.8.0~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7fec51277e4172d7d05db60e29b4c6cc9746c90;p=thirdparty%2Fiptables.git xtables-monitor: add --version option ... for consistency with other commands. Signed-off-by: Florian Westphal --- diff --git a/iptables/xtables-monitor.c b/iptables/xtables-monitor.c index e0a2d98f..08292a79 100644 --- a/iptables/xtables-monitor.c +++ b/iptables/xtables-monitor.c @@ -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); }