sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit 39802832af40f1a24aa362ca73e369a0cd26ecf2
parent 0c8fe5d19b70792a8aede0a62fe09d3a1b6b3d2c
Author: sin <sin@2f30.org>
Date:   Fri,  6 Feb 2015 19:46:37 +0000

wc: Make output POSIX compliant

Diffstat:
Mwc.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/wc.c b/wc.c @@ -17,13 +17,14 @@ void output(const char *str, size_t nc, size_t nl, size_t nw) { int noflags = !cmode && !lflag && !wflag; + int first = 1; if (lflag || noflags) - printf(" %5zu", nl); + printf("%*.zu", first ? (first = 0) : 7, nl); if (wflag || noflags) - printf(" %5zu", nw); + printf("%*.zu", first ? (first = 0) : 7, nw); if (cmode || noflags) - printf(" %5zu", nc); + printf("%*.zu", first ? (first = 0) : 7, nc); if (str) printf(" %s", str); putchar('\n');