If there's no newline we don't count the last word - fix it

This commit is contained in:
sin 2014-01-10 22:51:13 +00:00
parent fbd786d22a
commit b744ad5216
1 changed files with 2 additions and 0 deletions

2
wc.c
View File

@ -95,6 +95,8 @@ wc(FILE *fp, const char *str)
nw++;
}
}
if (word)
nw++;
tc += nc;
tl += nl;
tw += nw;