If the input file ends without a space or newline, don't ignore the last word

(Closes #4)
This commit is contained in:
Fabian Kurz 2021-12-30 10:14:37 +01:00
parent eb5742e70b
commit 3f067bd7a6
1 changed files with 7 additions and 1 deletions

View File

@ -528,9 +528,15 @@ cw.encoding = UTF8;
} /* word */
} /* eof */
/* If the file ends without newline or space, but directly with EOF after
* the last word, this one is lost, so we need to add it... */
if (strlen(word) && word[0] != '|' && word[0] != '#') {
makeword(mapstring(word, &cw), &cw);
chw++;
}
/* CGI: Add some silence (500ms) to the end of the file */
#ifdef CGI
add_silence(500, &cw);