diff options
author | Hoang Le <hoang.h.le@dektech.com.au> | 2018-12-06 08:40:06 +0700 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2018-12-07 09:24:01 -0800 |
commit | 853adffe13dfa0fb00a0e0b589ffba4e12fc06c2 (patch) | |
tree | 1cff61f3920ebc22aa14d1537d1e5ce016ec2873 /tipc | |
parent | 2e320d8b7e74d667628ede35d2ec0340347cd2af (diff) |
tipc: fix misalignment printout in non-JSON output
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>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'tipc')
-rw-r--r-- | tipc/nametable.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tipc/nametable.c b/tipc/nametable.c index eb4bd0bd..d899eeb6 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(); |