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 <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2020-01-20 09:29:05 -08:00
parent 970db267a0
commit f4d7ce9bfa

View File

@ -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;