Report config syntax errors

This commit is contained in:
Vftdan 2024-08-19 21:13:38 +02:00
parent 0967e9eb85
commit 399f0b278e
1 changed files with 4 additions and 1 deletions

5
main.c
View File

@ -99,7 +99,10 @@ main(int argc, char ** argv)
config_t config_tree; config_t config_tree;
FullConfig loaded_config; FullConfig loaded_config;
config_init(&config_tree); config_init(&config_tree);
config_read_file(&config_tree, config_filename); if (config_read_file(&config_tree, config_filename) != CONFIG_TRUE) {
fprintf(stderr, "Config syntax error: %s:%d: %s\n", config_error_file(&config_tree), config_error_line(&config_tree), config_error_text(&config_tree));
exit(1);
}
config_set_auto_convert(&config_tree, CONFIG_TRUE); config_set_auto_convert(&config_tree, CONFIG_TRUE);
if (!load_config(config_root_setting(&config_tree), &loaded_config)) { if (!load_config(config_root_setting(&config_tree), &loaded_config)) {
perror("Failed to load config"); perror("Failed to load config");