diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2016-03-23 13:51:33 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-03-29 13:19:24 +0200 |
commit | 89e3001be44aa2f25e51b139f044328230cbb098 (patch) | |
tree | 978bcc40823900d6632090ddf77d3d41bcc521a3 /src/rule.c | |
parent | 7fa2b0534745f53881ec74a0a73d4f870ea4b026 (diff) |
rule: don't print trailing statement whitespace
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@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r-- | src/rule.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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) |