summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-08-02 13:43:09 -0400
committerJakob Kaivo <jkk@ung.org>2019-08-02 13:43:09 -0400
commit934361ee3236f36b97b30c8ebd8255fa26a24115 (patch)
tree479783b4e43351f049a6983c7b13171a125061c4
parent3627905c4663029ef7da25503cdf13359c1a4ed0 (diff)
fix operand processing
-rw-r--r--wc.c8
1 files 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);