]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
main: fix nft --help output fallout from 719e4427
authorŠtěpán Němec <snemec@redhat.com>
Mon, 22 Feb 2021 12:03:19 +0000 (13:03 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 22 Feb 2021 13:54:00 +0000 (14:54 +0100)
Long options were missing the double dash.

Fixes: 719e44277f8e ("main: use one data-structure to initialize getopt_long(3) arguments and help.")
Cc: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Štěpán Němec <snemec@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/main.c

index 80cf1acf0f7f44c41345a5cebc4c0c8131f0b5df..8c47064459ecb40ed5c17d4fdc63b0c4d0397717 100644 (file)
@@ -175,16 +175,17 @@ static const struct option *get_options(void)
 
 static void print_option(const struct nft_opt *opt)
 {
-       char optbuf[33] = "";
+       char optbuf[35] = "";
        int i;
 
        i = snprintf(optbuf, sizeof(optbuf), "  -%c", opt->val);
        if (opt->name)
-               i += snprintf(optbuf + i, sizeof(optbuf) - i, ", %s", opt->name);
+               i += snprintf(optbuf + i, sizeof(optbuf) - i, ", --%s",
+                             opt->name);
        if (opt->arg)
                i += snprintf(optbuf + i, sizeof(optbuf) - i, " %s", opt->arg);
 
-       printf("%-32s%s\n", optbuf, opt->help);
+       printf("%-34s%s\n", optbuf, opt->help);
 }
 
 static void show_help(const char *name)