Simplify condition in wc(1)

This commit is contained in:
sin 2015-04-20 11:26:05 +01:00
parent cd0b771cbb
commit d412dad470

3
wc.c
View File

@ -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))