From de575ac58efa65180c3c22e427de612dbdc26706 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 17 Jul 2019 10:12:14 +0200 Subject: conf: improve configuration file parsing * Strip whitespaces from keys and values * Detect (and ignore) comments * Detect syntax errors (no value specified etc) * Error out on syntax errors and invalid keys --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index faf8b926..18673401 100644 --- a/main.c +++ b/main.c @@ -273,7 +273,9 @@ main(int argc, char *const *argv) { int ret = EXIT_FAILURE; - struct config conf = config_load(); + struct config conf = {NULL}; + if (!config_load(&conf)) + return ret; static const struct option longopts[] = { {"font", required_argument, 0, 'f'}, -- cgit v1.3