From b744ad5216e4ab66151d97086162c8cf8aff8380 Mon Sep 17 00:00:00 2001 From: sin Date: Fri, 10 Jan 2014 22:51:13 +0000 Subject: [PATCH] If there's no newline we don't count the last word - fix it --- wc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wc.c b/wc.c index ba76a68..cd0bf46 100644 --- a/wc.c +++ b/wc.c @@ -95,6 +95,8 @@ wc(FILE *fp, const char *str) nw++; } } + if (word) + nw++; tc += nc; tl += nl; tw += nw;