]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip-link: fix column alignment
authorChristian Hesse <mail@eworm.de>
Mon, 3 Nov 2014 07:21:11 +0000 (08:21 +0100)
committerStephen Hemminger <shemming@brocade.com>
Fri, 7 Nov 2014 00:02:29 +0000 (16:02 -0800)
Width is the maximum number of characters used for the value, excluding a
field separator. So append a single whitespace.

ip/ipaddress.c

index efea88c7e8227ef754b6f4ca8a076bb84cb2f19d..e240bb5486433b6c9849474917c0bb9d2bf4f29f 100644 (file)
@@ -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,