]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: don't use fprintf() when count cells
authorKarel Zak <kzak@redhat.com>
Mon, 7 Dec 2015 11:22:29 +0000 (12:22 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 7 Dec 2015 11:22:29 +0000 (12:22 +0100)
fprintf("%*s") is based on bytes, no cells.

Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/table_print.c

index 24f1d5a4dcab559a94033d99cbe26b37c7d76456..91234b16a3b4e6974fb00b4ce6e4db0bbe8cfecb 100644 (file)
@@ -343,7 +343,9 @@ static int print_data(struct libscols_table *tb,
                        size_t xw = cl->width;
                        if (color)
                                fputs(color, tb->out);
-                       fprintf(tb->out, "%*s", (int) xw, data);
+                       for (i = len; i < width; i++)
+                               fputc(' ', tb->out);
+                       fputs(data, tb->out);
                        if (color)
                                fputs(UL_COLOR_RESET, tb->out);
                        if (len < xw)