From 934361ee3236f36b97b30c8ebd8255fa26a24115 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 2 Aug 2019 13:43:09 -0400 Subject: fix operand processing --- wc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wc.c b/wc.c index 60384de..de7a41b 100644 --- a/wc.c +++ b/wc.c @@ -82,15 +82,17 @@ int is_space(wint_t c, int flags) return isspace(c); } +#ifdef __STDC_MB_MIGHT_NEQ_WC__ int is_newline(wint_t c, int flags) { - #ifdef __STDC_MB_MIGHT_NEQ_WC__ if (flags & CHARS) { return c == L'\n'; } - #endif return c == '\n'; } +#else +#define is_newline(_c, _flags) ((_c) == '\n') +#endif int wc(char *path, int flags) { @@ -179,7 +181,7 @@ int main(int argc, char *argv[]) do { ret |= wc(argv[optind++], flags); - } while (argv[optind]); + } while (optind < argc); if (total) { flagprint(total_n, total_w, total_c, "total", flags); -- cgit v1.2.1