[nft PATCH 1/3] src/rule.c: don't print trailing statement whitespace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This trailing whitespace is annoying when working with the textual output
of nft.

Before:

table t {
	chain c {
		ct state new
			    ^
	}
}


After:

table t {
	chain c {
		ct state new
	}
}

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@xxxxxxxxx>
---
 src/rule.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/rule.c b/src/rule.c
index 85987b9..0ed7794 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -385,14 +385,15 @@ void rule_print(const struct rule *rule)
 
 	list_for_each_entry(stmt, &rule->stmts, list) {
 		stmt->ops->print(stmt);
-		printf(" ");
+		if (!list_is_last(&stmt->list, &rule->stmts))
+			printf(" ");
 	}
 
 	if (rule->comment)
-		printf("comment \"%s\" ", rule->comment);
+		printf(" comment \"%s\"", rule->comment);
 
 	if (handle_output > 0)
-		printf("# handle %" PRIu64, rule->handle.handle);
+		printf(" # handle %" PRIu64, rule->handle.handle);
 }
 
 struct scope *scope_init(struct scope *scope, const struct scope *parent)

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



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux