diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-05-18 14:44:37 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-05-18 14:44:37 -0400 |
commit | 16ac7a879fad8c42946e70e6bcec3dd4918db5a8 (patch) | |
tree | 479783b4e43351f049a6983c7b13171a125061c4 | |
parent | 3627905c4663029ef7da25503cdf13359c1a4ed0 (diff) |
remove warning; fix do {} while loop condition
-rw-r--r-- | wc.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |