From 0bce1bdafb1b5ad35c459fa3cf2ba0cdf74c7c16 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 6 Jul 2018 13:02:09 -0700 Subject: Fix wc column widths. --- toys/posix/wc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'toys/posix/wc.c') diff --git a/toys/posix/wc.c b/toys/posix/wc.c index 69c5f382..acd0b3a0 100644 --- a/toys/posix/wc.c +++ b/toys/posix/wc.c @@ -33,9 +33,13 @@ GLOBALS( static void show_lengths(unsigned long *lengths, char *name) { - int i, space = 7, first = 1; + int i, space, first = 1; + + // POSIX says there should never be leading spaces, but accepts that + // traditional implementations use 7 spaces, unless only one file + // is being counted, when there should be no leading spaces. + space = (toys.optc != 1) ? 7 : 0; - for (i = 0; i<4; i++) if (toys.optflags == (1<