aboutsummaryrefslogtreecommitdiffstats
path: root/src/word.c
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-07-04 10:39:16 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2024-07-04 10:39:16 -0400
commite61179fe37a64e5d9ad8d9cd03f66302bbb79a35 (patch)
tree760df4436d179da5a1cdce125f3eb742499ac9aa /src/word.c
parentAdd cmake and clang format (diff)
downloadcli-e61179fe37a64e5d9ad8d9cd03f66302bbb79a35.zip
Format files
Diffstat (limited to 'src/word.c')
-rw-r--r--src/word.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/word.c b/src/word.c
index f10a648..4b2249b 100644
--- a/src/word.c
+++ b/src/word.c
@@ -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;
}
-