]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: use print_nl() to handle one line mode
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 20 Jan 2020 17:29:05 +0000 (09:29 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 20 Jan 2020 17:32:51 +0000 (09:32 -0800)
The helper function print_nl() does the right thing and prints
the newline or backslash.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ipaddress.c

index 964f14df93f04a3be4fdfd1bb483d9d93622740a..b7e9132404b1619f2a41e8fed330ca477588de76 100644 (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;