netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nft PATCH 1/2] main: fix nft --help output fallout from 719e4427
@ 2021-02-22 12:03 Štěpán Němec
  2021-02-22 12:03 ` [nft PATCH 2/2] doc: nft: fix some typos and formatting issues Štěpán Němec
  2021-02-22 13:52 ` [nft PATCH 1/2] main: fix nft --help output fallout from 719e4427 Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Štěpán Němec @ 2021-02-22 12:03 UTC (permalink / raw)
  To: netfilter-devel, Pablo Neira Ayuso; +Cc: Phil Sutter, Jeremy Sowden

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>
---
 src/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 80cf1acf0f7f..8c47064459ec 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-22 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-22 12:03 [nft PATCH 1/2] main: fix nft --help output fallout from 719e4427 Štěpán Němec
2021-02-22 12:03 ` [nft PATCH 2/2] doc: nft: fix some typos and formatting issues Štěpán Němec
2021-02-22 13:52   ` Pablo Neira Ayuso
2021-02-22 13:52 ` [nft PATCH 1/2] main: fix nft --help output fallout from 719e4427 Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).