From f4d7ce9bfae9710fcb984f72d1119d8bf4ff2f8c Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 20 Jan 2020 09:29:05 -0800 Subject: [PATCH] ip: use print_nl() to handle one line mode The helper function print_nl() does the right thing and prints the newline or backslash. Signed-off-by: Stephen Hemminger --- ip/ipaddress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 964f14df..b7e91324 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -1633,7 +1633,8 @@ static int show_handler(struct rtnl_ctrl_data *ctrl, struct ifaddrmsg *ifa = NLMSG_DATA(n); open_json_object(NULL); - print_int(PRINT_ANY, "index", "if%d:\n", ifa->ifa_index); + print_int(PRINT_ANY, "index", "if%d:", ifa->ifa_index); + print_nl(); print_addrinfo(n, stdout); close_json_object(); return 0;