diff mbox

[nft,3/4] rule: delete extra space in sets printing

Message ID 145190991706.22285.17585254866421222372.stgit@r2d2.cica.es
State Changes Requested
Delegated to: Pablo Neira
Headers show

Commit Message

Arturo Borrero Jan. 4, 2016, 12:18 p.m. UTC
The extra space is printed when sets are printed in tabulated format.
However, the space is still required in printing in plain format (ie, monitor).

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 0 files changed


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Pablo Neira Ayuso Jan. 5, 2016, 11:28 a.m. UTC | #1
On Mon, Jan 04, 2016 at 01:18:37PM +0100, Arturo Borrero Gonzalez wrote:
> The extra space is printed when sets are printed in tabulated format.
> However, the space is still required in printing in plain format (ie, monitor).
> 
> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
> ---
>  0 files changed
> 
> diff --git a/src/rule.c b/src/rule.c
> index c0e45aa..ab39513 100644
> --- a/src/rule.c
> +++ b/src/rule.c
> @@ -267,7 +267,10 @@ static void set_print_declaration(const struct set *set,
>  	if (opts->table != NULL)
>  		printf(" %s", opts->table);
>  
> -	printf(" %s { %s", set->handle.set, opts->nl);
> +	printf(" %s {%s", set->handle.set, opts->nl);
> +
> +	if (!strcmp(opts->nl, ""))

This could be replaced by:

        if (!opts->nl[0])

But could you post what output you're trying to fix?

Thanks.

> +		printf(" ");
>  
>  	printf("%s%stype %s", opts->tab, opts->tab, set->keytype->name);
>  	if (set->flags & SET_F_MAP)
> 
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arturo Borrero Jan. 5, 2016, 11:35 a.m. UTC | #2
On 5 January 2016 at 12:28, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
>
> But could you post what output you're trying to fix?
>

My email client would mess the text so find attached an example.
diff mbox

Patch

diff --git a/src/rule.c b/src/rule.c
index c0e45aa..ab39513 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -267,7 +267,10 @@  static void set_print_declaration(const struct set *set,
 	if (opts->table != NULL)
 		printf(" %s", opts->table);
 
-	printf(" %s { %s", set->handle.set, opts->nl);
+	printf(" %s {%s", set->handle.set, opts->nl);
+
+	if (!strcmp(opts->nl, ""))
+		printf(" ");
 
 	printf("%s%stype %s", opts->tab, opts->tab, set->keytype->name);
 	if (set->flags & SET_F_MAP)