Nicer error message when a variable is not found in the default section

This commit is contained in:
Pierre Pronchery 2007-11-06 18:16:18 +00:00
parent b1fda8687c
commit 1753c7b223

View File

@ -83,8 +83,12 @@ char * config_get(Config * config, char const * section, char const * variable)
{
if((value = hash_get(h, variable)) != NULL) /* found value */
return value;
error_set_code(1, "%s%s%s", variable, ": Not found in section ",
section);
if(section[0] == '\0')
error_set_code(1, "%s%s%s", variable, ": Not found in"
" default section");
else
error_set_code(1, "%s%s%s", variable, ": Not found in"
" section ", section);
return NULL;
}
if(section[0] == '\0')