summaryrefslogtreecommitdiffstats
path: root/usr.bin/wc/wc.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-06-16 06:04:43 +0000
committertjr <tjr@FreeBSD.org>2002-06-16 06:04:43 +0000
commit73014ec07eb9f856a6fa05c4952dc107e7cb64ab (patch)
treeb8a0f069dff0a7ad0314a1b4d3215fe489854c03 /usr.bin/wc/wc.c
parentf5b77cf9df9992b19e9ee5e6941f970537bcc598 (diff)
downloadFreeBSD-src-73014ec07eb9f856a6fa05c4952dc107e7cb64ab.zip
FreeBSD-src-73014ec07eb9f856a6fa05c4952dc107e7cb64ab.tar.gz
When counting words, check the correct character variable to see whether it's
a space or not. Noticed by: bde
Diffstat (limited to 'usr.bin/wc/wc.c')
-rw-r--r--usr.bin/wc/wc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c
index 7562f9d..6eb2602 100644
--- a/usr.bin/wc/wc.c
+++ b/usr.bin/wc/wc.c
@@ -140,7 +140,7 @@ cnt(file)
int clen, fd, len, warned;
short gotsp;
u_char *p;
- u_char buf[MAXBSIZE], ch;
+ u_char buf[MAXBSIZE];
wchar_t wch;
linect = wordct = charct = 0;
@@ -235,7 +235,7 @@ word: gotsp = 1;
if (wch == L'\n')
++linect;
/* XXX Non-portable; should use iswspace() */
- if (isspace(ch))
+ if (isspace(wch))
gotsp = 1;
else if (gotsp) {
gotsp = 0;
OpenPOWER on IntegriCloud