summaryrefslogtreecommitdiff
path: root/src/io/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/io/config.c')
-rw-r--r--src/io/config.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/io/config.c b/src/io/config.c
index 36afbef..bf9d96a 100644
--- a/src/io/config.c
+++ b/src/io/config.c
@@ -32,9 +32,20 @@ static bool get_words(char* buf, char** words, int count) {
int offset = 0;
int i = 0;
- for(i = 0; i < count; i++) {
+ while(1) {
char c;
- while(c = buf[offset], c != ' ' && c != '\0' && c != '\n') {
+ while(1) {
+ if (offset == MAX_LEN) return false;
+ c = buf[offset];
+
+ if (c == '\0' || c == '\n') {
+ break;
+ }
+
+ if (c == ' ' && i + 1 != count) {
+ break;
+ }
+
offset++;
}
@@ -48,8 +59,11 @@ static bool get_words(char* buf, char** words, int count) {
if (c == '\0' || c == '\n') {
break;
+ } else if (i + 1 == count) {
+ break;
}
+ i++;
}
return i + 1 == count;
}