mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add support for defaults in config file
If no section name is specified the configuration will be considered the default one. This allows to set e.g. a default color code for sections which do not configure a color code.
This commit is contained in:
parent
03cf4ef197
commit
09bcd91bf0
1 changed files with 64 additions and 63 deletions
|
|
@ -86,9 +86,10 @@ static int data_handler(void *user, const char *section, const char *name,
|
||||||
{
|
{
|
||||||
UNUSED(user);
|
UNUSED(user);
|
||||||
|
|
||||||
if (strcmp(section, c->section_name))
|
// If section matches user input or unnamed section
|
||||||
return 0;
|
if ((!strcmp(section, c->section_name)) || (!strcmp(section, "")))
|
||||||
|
{
|
||||||
|
// Set configuration parameter if found
|
||||||
if (!strcmp(name, "tty"))
|
if (!strcmp(name, "tty"))
|
||||||
{
|
{
|
||||||
asprintf(&c->tty, value, c->match);
|
asprintf(&c->tty, value, c->match);
|
||||||
|
|
@ -150,7 +151,7 @@ static int data_handler(void *user, const char *section, const char *name,
|
||||||
{
|
{
|
||||||
option.color = atoi(value);
|
option.color = atoi(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue