diff options
Diffstat (limited to 'coreutils/wc.c')
-rw-r--r-- | coreutils/wc.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/coreutils/wc.c b/coreutils/wc.c index d0e5482ca..3e32e3d6d 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -43,22 +43,19 @@ | |||
43 | 43 | ||
44 | #include "libbb.h" | 44 | #include "libbb.h" |
45 | 45 | ||
46 | #if ENABLE_LOCALE_SUPPORT | 46 | #if !ENABLE_LOCALE_SUPPORT |
47 | #define isspace_given_isprint(c) isspace(c) | 47 | # undef isprint |
48 | #else | 48 | # undef isspace |
49 | #undef isspace | 49 | # define isprint(c) ((unsigned)((c) - 0x20) <= (0x7e - 0x20)) |
50 | #undef isprint | 50 | # define isspace(c) ((c) == ' ') |
51 | #define isspace(c) ((((c) == ' ') || (((unsigned int)((c) - 9)) <= (13 - 9)))) | ||
52 | #define isprint(c) (((unsigned int)((c) - 0x20)) <= (0x7e - 0x20)) | ||
53 | #define isspace_given_isprint(c) ((c) == ' ') | ||
54 | #endif | 51 | #endif |
55 | 52 | ||
56 | #if ENABLE_FEATURE_WC_LARGE | 53 | #if ENABLE_FEATURE_WC_LARGE |
57 | #define COUNT_T unsigned long long | 54 | # define COUNT_T unsigned long long |
58 | #define COUNT_FMT "llu" | 55 | # define COUNT_FMT "llu" |
59 | #else | 56 | #else |
60 | #define COUNT_T unsigned | 57 | # define COUNT_T unsigned |
61 | #define COUNT_FMT "u" | 58 | # define COUNT_FMT "u" |
62 | #endif | 59 | #endif |
63 | 60 | ||
64 | enum { | 61 | enum { |
@@ -123,11 +120,11 @@ int wc_main(int argc UNUSED_PARAM, char **argv) | |||
123 | c = getc(fp); | 120 | c = getc(fp); |
124 | if (isprint(c)) { | 121 | if (isprint(c)) { |
125 | ++linepos; | 122 | ++linepos; |
126 | if (!isspace_given_isprint(c)) { | 123 | if (!isspace(c)) { |
127 | in_word = 1; | 124 | in_word = 1; |
128 | continue; | 125 | continue; |
129 | } | 126 | } |
130 | } else if (((unsigned int)(c - 9)) <= 4) { | 127 | } else if ((unsigned)(c - 9) <= 4) { |
131 | /* \t 9 | 128 | /* \t 9 |
132 | * \n 10 | 129 | * \n 10 |
133 | * \v 11 | 130 | * \v 11 |