]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Improve xtables-monitor first impression
authorPhil Sutter <phil@nwl.cc>
Tue, 7 Aug 2018 11:06:39 +0000 (13:06 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 9 Aug 2018 19:48:53 +0000 (21:48 +0200)
First time users are likely to call 'xtables-monitor --help' to see
what's going on. Make this situation a bit more pleasant for them:

* When complaining about illegal arguments, add a final newline
  character to the error message.

* Actually support '--help' long option as an alias to '-h'.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/xtables-monitor.c

index 035bc9f2b353bdcf399f83ec95fc264421eaf2fe..3b1ca777a28a0d60fca014c759186aa31860ad9b 100644 (file)
@@ -568,6 +568,7 @@ static const struct option options[] = {
        {.name = "ipv4", .has_arg = false, .val = '4'},
        {.name = "ipv6", .has_arg = false, .val = '6'},
        {.name = "version", .has_arg = false, .val = 'V'},
+       {.name = "help", .has_arg = false, .val = 'h'},
        {NULL},
 };
 
@@ -635,7 +636,7 @@ int xtables_monitor_main(int argc, char *argv[])
                        exit(0);
                default:
                        fprintf(stderr, "xtables-monitor %s: Bad argument.\n", IPTABLES_VERSION);
-                       fprintf(stderr, "Try `xtables-monitor -h' for more information.");
+                       fprintf(stderr, "Try `xtables-monitor -h' for more information.\n");
                        exit(PARAMETER_PROBLEM);
                }
        }