summaryrefslogtreecommitdiff
path: root/wc.c
diff options
context:
space:
mode:
Diffstat (limited to 'wc.c')
-rw-r--r--wc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/wc.c b/wc.c
index 378b655..160f6ed 100644
--- a/wc.c
+++ b/wc.c
@@ -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) {