Skip to contentSkip to conversation

rule: Reformat the string to output so it breaks line relevantly

PATCH New Tomasz Bursztyka 1 participant 1 message Feb 11, 2014 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rule: Reformat the string to output so it breaks line relevantly

As for chain and table.

---
 src/rule.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
src/rule.c +3 -3
index 53d2ebf..887b506 100644
@@ -787,20 +787,20 @@ static int nft_rule_snprintf_default(char *buf, size_t size, struct nft_rule *r,
 	struct nft_rule_expr *expr;
 	int ret, len = size, offset = 0;
 
-	ret = snprintf(buf, len, "%s %s %s %"PRIu64" %"PRIu64"\n",
+	ret = snprintf(buf, len, "%s %s %s %"PRIu64" %"PRIu64"",
 			nft_family2str(r->family), r->table, r->chain,
 			r->handle, r->position);
 	SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
 	list_for_each_entry(expr, &r->expr_list, head) {
-		ret = snprintf(buf+offset, len, "  [ %s ", expr->ops->name);
+		ret = snprintf(buf+offset, len, "\n  [ %s ", expr->ops->name);
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
 		ret = nft_rule_expr_snprintf(buf+offset, len, expr,
 					     type, flags);
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 
-		ret = snprintf(buf+offset, len, "]\n");
+		ret = snprintf(buf+offset, len, "]");
 		SNPRINTF_BUFFER_SIZE(ret, size, len, offset);
 	}
 
Signature · 1 line
1.8.3.2