read in all config line tokens (fixes the binds not saving)
This commit is contained in:
parent
d7260b5a6a
commit
4727164d5c
|
@ -231,7 +231,7 @@ void configfile_load(const char *filename) {
|
||||||
// Go through each line in the file
|
// Go through each line in the file
|
||||||
while ((line = read_file_line(file)) != NULL) {
|
while ((line = read_file_line(file)) != NULL) {
|
||||||
char *p = line;
|
char *p = line;
|
||||||
char *tokens[2];
|
char *tokens[1 + MAX_BINDS];
|
||||||
int numTokens;
|
int numTokens;
|
||||||
|
|
||||||
while (isspace(*p))
|
while (isspace(*p))
|
||||||
|
@ -240,7 +240,7 @@ void configfile_load(const char *filename) {
|
||||||
if (!*p || *p == '#') // comment or empty line
|
if (!*p || *p == '#') // comment or empty line
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
numTokens = tokenize_string(p, 2, tokens);
|
numTokens = tokenize_string(p, sizeof(tokens) / sizeof(tokens[0]), tokens);
|
||||||
if (numTokens != 0) {
|
if (numTokens != 0) {
|
||||||
if (numTokens >= 2) {
|
if (numTokens >= 2) {
|
||||||
const struct ConfigOption *option = NULL;
|
const struct ConfigOption *option = NULL;
|
||||||
|
@ -274,7 +274,9 @@ void configfile_load(const char *filename) {
|
||||||
default:
|
default:
|
||||||
assert(0); // bad type
|
assert(0); // bad type
|
||||||
}
|
}
|
||||||
printf("option: '%s', value: '%s'\n", tokens[0], tokens[1]);
|
printf("option: '%s', value:", tokens[0]);
|
||||||
|
for (int i = 1; i < numTokens; ++i) printf(" '%s'", tokens[i]);
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
puts("error: expected value");
|
puts("error: expected value");
|
||||||
|
|
Loading…
Reference in New Issue