Simplify condition in wc(1)
This commit is contained in:
parent
cd0b771cbb
commit
d412dad470
3
wc.c
3
wc.c
@ -32,8 +32,7 @@ wc(FILE *fp, const char *str)
|
|||||||
size_t nc = 0, nl = 0, nw = 0;
|
size_t nc = 0, nl = 0, nw = 0;
|
||||||
|
|
||||||
while ((rlen = efgetrune(&c, fp, str))) {
|
while ((rlen = efgetrune(&c, fp, str))) {
|
||||||
nc += (cmode == 'c' || !cmode) ? rlen :
|
nc += (cmode == 'c' || !cmode) ? rlen : (c != Runeerror);
|
||||||
(c != Runeerror) ? 1 : 0;
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
nl++;
|
nl++;
|
||||||
if (!isspacerune(c))
|
if (!isspacerune(c))
|
||||||
|
Loading…
Reference in New Issue
Block a user