diff options
author | Jim Meyering <jim@meyering.net> | 2001-12-13 11:12:18 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-12-13 11:12:18 +0000 |
commit | 8471372f24b80813e8b419afe41222ab1bfed7b1 (patch) | |
tree | 80d7fb9c1e4765234dbbaf46180e4f0b347e2c68 /src/wc.c | |
parent | 80f17f22f26b2df8c985e744742c47136ce6d530 (diff) | |
download | coreutils-8471372f24b80813e8b419afe41222ab1bfed7b1.tar.xz |
(wc): Use ISSPACE and iswspace in addition to hard-coding
the ASCII space character.
Diffstat (limited to 'src/wc.c')
-rw-r--r-- | src/wc.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -32,13 +32,17 @@ # include <wchar.h> #endif -/* Get iswprint(). */ +/* Get iswprint(), iswspace(). */ #if HAVE_WCTYPE_H # include <wctype.h> #endif #if !defined iswprint && !HAVE_ISWPRINT # define iswprint(wc) 1 #endif +#if !defined iswspace && !HAVE_ISWSPACE +# define iswspace(wc) \ + ((wc) == (unsigned char) (wc) && ISSPACE ((unsigned char) (wc))) +#endif /* Include this after wctype.h so that we `#undef' ISPRINT (from Solaris's euc.h, from widec.h, from wctype.h) before @@ -378,6 +382,8 @@ wc (int fd, const char *file) int width = wcwidth (wide_char); if (width > 0) linepos += width; + if (iswspace (wide_char)) + goto mb_word_separator; in_word = 1; } break; @@ -452,6 +458,8 @@ wc (int fd, const char *file) if (ISPRINT ((unsigned char) p[-1])) { linepos++; + if (ISSPACE ((unsigned char) p[-1])) + goto word_separator; in_word = 1; } break; |