diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2009-08-15 03:01:51 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2009-08-15 03:01:51 +0200 |
commit | 62b45cb26d7868b21ba4b854d2d3b8befeee9327 (patch) | |
tree | 60142f5e526073c8c941e15e692731945c678e9b | |
parent | a245a2c83ce685c3dac57ef92f65f5a10d12c8b0 (diff) |
Only increment word count if len > 0.
-rw-r--r-- | main.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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'; |