From abd0c85dcd432c16c134daecc7b132e482cde51e Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Sun, 16 Jun 2002 06:04:43 +0000 Subject: [PATCH] When counting words, check the correct character variable to see whether it's a space or not. Noticed by: bde --- usr.bin/wc/wc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c index 7562f9d1f59d..6eb2602160e9 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;