From: Christian Hesse Date: Mon, 3 Nov 2014 07:21:11 +0000 (+0100) Subject: ip-link: fix column alignment X-Git-Tag: v3.18.0~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4fe81d26cd4e9077bb93376de0cc69e292fb1c5;p=thirdparty%2Fiproute2.git ip-link: fix column alignment Width is the maximum number of characters used for the value, excluding a field separator. So append a single whitespace. --- diff --git a/ip/ipaddress.c b/ip/ipaddress.c index efea88c7e..e240bb548 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -327,7 +327,7 @@ static void print_num(FILE *fp, unsigned width, uint64_t count) char buf[64]; if (!human_readable || count < base) { - fprintf(fp, "%-*"PRIu64, width, count); + fprintf(fp, "%-*"PRIu64" ", width, count); return; } @@ -346,7 +346,7 @@ static void print_num(FILE *fp, unsigned width, uint64_t count) snprintf(buf, sizeof(buf), "%.1f%c%s", (double) count / powi, *prefix, use_iec ? "i" : ""); - fprintf(fp, "%-*s", width, buf); + fprintf(fp, "%-*s ", width, buf); } static void print_link_stats64(FILE *fp, const struct rtnl_link_stats64 *s,