From 14ef5f6b329bf73b54bdb6f5da57a88aabbc3fa7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 22 Jun 2015 13:02:23 +0200 Subject: [PATCH] platform: prettify and line-wrap route_to_string() print statements (cherry picked from commit 2170804213c51d52585084a26dce211fe7cd05a3) --- src/platform/nm-platform.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 43647acfa0..7c3be22ac6 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -2672,10 +2672,20 @@ nm_platform_ip4_route_to_string (const NMPlatformIP4Route *route) _to_string_dev (NULL, route->ifindex, str_dev, sizeof (str_dev)); - g_snprintf (_nm_platform_to_string_buffer, sizeof (_nm_platform_to_string_buffer), "%s/%d via %s%s metric %"G_GUINT32_FORMAT" mss %"G_GUINT32_FORMAT" src %s%s%s", - s_network, route->plen, s_gateway, + g_snprintf (_nm_platform_to_string_buffer, sizeof (_nm_platform_to_string_buffer), + "%s/%d" + " via %s" + "%s" + " metric %"G_GUINT32_FORMAT + " mss %"G_GUINT32_FORMAT + " src %s" /* source */ + "%s%s" /* scope */ + "", + s_network, route->plen, + s_gateway, str_dev, - route->metric, route->mss, + route->metric, + route->mss, source_to_string (route->source), route->scope_inv ? " scope " : "", route->scope_inv ? (rtnl_scope2str (nm_platform_route_scope_inv (route->scope_inv), str_scope, sizeof (str_scope))) : ""); @@ -2707,10 +2717,19 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route) _to_string_dev (NULL, route->ifindex, str_dev, sizeof (str_dev)); - g_snprintf (_nm_platform_to_string_buffer, sizeof (_nm_platform_to_string_buffer), "%s/%d via %s%s metric %"G_GUINT32_FORMAT" mss %"G_GUINT32_FORMAT" src %s", - s_network, route->plen, s_gateway, + g_snprintf (_nm_platform_to_string_buffer, sizeof (_nm_platform_to_string_buffer), + "%s/%d" + " via %s" + "%s" + " metric %"G_GUINT32_FORMAT + " mss %"G_GUINT32_FORMAT + " src %s" /* source */ + "", + s_network, route->plen, + s_gateway, str_dev, - route->metric, route->mss, + route->metric, + route->mss, source_to_string (route->source)); return _nm_platform_to_string_buffer; }