summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-08-15 03:01:51 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2009-08-15 03:01:51 +0200
commit62b45cb26d7868b21ba4b854d2d3b8befeee9327 (patch)
tree60142f5e526073c8c941e15e692731945c678e9b
parenta245a2c83ce685c3dac57ef92f65f5a10d12c8b0 (diff)
Only increment word count if len > 0.
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index 02686ec..300a424 100644
--- a/main.c
+++ b/main.c
@@ -59,7 +59,8 @@ int main(int argc, char **argv) {
int len = 0;
for(char *pos = text; pos < end; pos++) {
if(isblank(*pos)) {
- user->words++;
+ if(len)
+ user->words++;
word[len] = '\0';
len = 0;
*word = '\0';