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
This commit is contained in:
Daniel Eklöf 2019-07-17 10:12:14 +02:00
parent c11cc2be57
commit de575ac58e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 66 additions and 16 deletions

4
main.c
View file

@ -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'},