mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Fix parsing of default settings
Default configuration file settings were not parsed in case a section was matched. Now we make sure that the default (unnamed) settings are always parsed.
This commit is contained in:
parent
8da06ebf2c
commit
9a1afc09c2
1 changed files with 12 additions and 0 deletions
|
|
@ -259,6 +259,17 @@ void config_file_parse(const int argc, char *argv[])
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse default (unnamed) settings
|
||||||
|
asprintf(&c->section_name, "%s", "");
|
||||||
|
ret = ini_parse(c->path, data_handler, NULL);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error: unable to parse configuration file (%d)\n", ret);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
c->section_name = NULL;
|
||||||
|
|
||||||
|
// Find matching section
|
||||||
ret = ini_parse(c->path, section_pattern_search_handler, NULL);
|
ret = ini_parse(c->path, section_pattern_search_handler, NULL);
|
||||||
if (!c->section_name)
|
if (!c->section_name)
|
||||||
{
|
{
|
||||||
|
|
@ -270,6 +281,7 @@ void config_file_parse(const int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse settings of found section
|
||||||
ret = ini_parse(c->path, data_handler, NULL);
|
ret = ini_parse(c->path, data_handler, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue