diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2024-07-04 10:39:16 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2024-07-04 10:39:16 -0400 |
| commit | e61179fe37a64e5d9ad8d9cd03f66302bbb79a35 (patch) | |
| tree | 760df4436d179da5a1cdce125f3eb742499ac9aa /src/word.c | |
| parent | Add cmake and clang format (diff) | |
| download | cli-e61179fe37a64e5d9ad8d9cd03f66302bbb79a35.zip | |
Format files
Diffstat (limited to 'src/word.c')
| -rw-r--r-- | src/word.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -7,13 +7,13 @@ int read_word(FILE *fp, char *word, size_t length) { size_t position = 0; while ((ch = read_char(fp)) == ' ') - ; + ; while (ch != ' ' && ch != EOF) { - if (position < length) { - word[position++] = ch; - } - ch = read_char(fp); + if (position < length) { + word[position++] = ch; + } + ch = read_char(fp); } word[position] = '\0'; return ch; @@ -22,8 +22,7 @@ int read_word(FILE *fp, char *word, size_t length) { static inline int read_char(FILE *fp) { int ch = getc(fp); if (ch == '\n' || ch == '\t') { - return ' '; + return ' '; } return ch; } - |