diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-11-25 14:49:32 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-11-25 14:49:32 -0500 |
commit | c1b0486affa2e0fea086a57565ab88aac630b7f4 (patch) | |
tree | a529ee028e25c51ebcdc823f3054bd200e9c1b33 | |
parent | fdc345a4d7ff9f55f169eb69e8641bea082d0015 (diff) |
clean up output a bit
-rw-r--r-- | wc.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -52,12 +52,16 @@ static void wc_print(uintmax_t n, uintmax_t w, uintmax_t c, char *f, int flags) flags = WC_LINES | WC_WORDS | WC_CHARS; } + flags &= (WC_LINES | WC_WORDS | WC_CHARS); + if (flags & WC_LINES) { - printf("%ju%s", n, flags ^ WC_LINES ? " " : ""); + flags ^= WC_LINES; + printf("%ju%s", n, flags ? " " : ""); } if (flags & WC_WORDS) { - printf("%ju%s", w, flags ^ (WC_LINES | WC_WORDS) ? " " : ""); + flags ^= WC_WORDS; + printf("%ju%s", w, flags ? " " : ""); } if (flags & WC_CHARS) { |