[hackers] [sbase] wc: Show line/char/word count even if it's zero || Dionysis Grigoropoulos

From: <git_AT_suckless.org>
Date: Wed, 1 Apr 2015 12:11:10 +0200 (CEST)

commit bbd2b4d2439e13d44ec7d1f55bbc84f23d256401
Author: Dionysis Grigoropoulos <info_AT_erethon.com>
Date: Wed Apr 1 03:15:17 2015 +0300

    wc: Show line/char/word count even if it's zero
    
    Fix a bug where if a line, character or word count is zero, it's not
    printed

diff --git a/wc.c b/wc.c
index 0ff3b8d..0b196d8 100644
--- a/wc.c
+++ b/wc.c
_AT_@ -14,11 +14,11 @@ output(const char *str, size_t nc, size_t nl, size_t nw)
         int first = 1;
 
         if (lflag || noflags)
- printf("%*.zu", first ? (first = 0) : 7, nl);
+ printf("%*.1zu", first ? (first = 0) : 7, nl);
         if (wflag || noflags)
- printf("%*.zu", first ? (first = 0) : 7, nw);
+ printf("%*.1zu", first ? (first = 0) : 7, nw);
         if (cmode || noflags)
- printf("%*.zu", first ? (first = 0) : 7, nc);
+ printf("%*.1zu", first ? (first = 0) : 7, nc);
         if (str)
                 printf(" %s", str);
         putchar('\n');
Received on Wed Apr 01 2015 - 12:11:10 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 01 2015 - 12:12:23 CEST