All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [iproute2-next] tipc: fix misalignment printout in non-JSON output
@ 2018-12-06  1:40 Hoang Le
  0 siblings, 0 replies; only message in thread
From: Hoang Le @ 2018-12-06  1:40 UTC (permalink / raw
  To: dsahern, netdev, tipc-discussion

In the commit 1304f50a5be0ed ("tipc: JSON support for showing nametable"),
introduced misalignment in the columns of the printout in non-JSON mode
compare to the list header. Add one space per column to make alignment
with the list header.

before:
$tipc name show
Type       Lower      Upper      Scope    Port       Node
1         1         1         node    4071367628

after:
$tipc name show
Type       Lower      Upper      Scope    Port       Node
1          1          1          node     4071367628

Reported-by: Jon Maloy <jon.maloy@ericsson.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
---
 tipc/nametable.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tipc/nametable.c b/tipc/nametable.c
index eb4bd0bda835..d899eeb67c07 100644
--- a/tipc/nametable.c
+++ b/tipc/nametable.c
@@ -58,14 +58,19 @@ static int nametable_show_cb(const struct nlmsghdr *nlh, void *data)
 	open_json_object(NULL);
 	print_uint(PRINT_ANY, "type", "%-10u",
 			   mnl_attr_get_u32(publ[TIPC_NLA_PUBL_TYPE]));
+	print_string(PRINT_FP, NULL, " ", "");
 	print_uint(PRINT_ANY, "lower", "%-10u",
 			   mnl_attr_get_u32(publ[TIPC_NLA_PUBL_LOWER]));
+	print_string(PRINT_FP, NULL, " ", "");
 	print_uint(PRINT_ANY, "upper", "%-10u",
 			   mnl_attr_get_u32(publ[TIPC_NLA_PUBL_UPPER]));
+	print_string(PRINT_FP, NULL, " ", "");
 	print_string(PRINT_ANY, "scope", "%-8s",
 			     scope[mnl_attr_get_u32(publ[TIPC_NLA_PUBL_SCOPE])]);
+	print_string(PRINT_FP, NULL, " ", "");
 	print_uint(PRINT_ANY, "port", "%-10u",
 			   mnl_attr_get_u32(publ[TIPC_NLA_PUBL_REF]));
+	print_string(PRINT_FP, NULL, " ", "");
 	print_string(PRINT_ANY, "node", "%s", str);
 	print_string(PRINT_FP, NULL, "\n", "");
 	close_json_object();
-- 
2.17.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-06  1:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-06  1:40 [iproute2-next] tipc: fix misalignment printout in non-JSON output Hoang Le

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.