Eat trailing whitespace in config files.

This commit is contained in:
Guus Sliepen 2004-03-15 18:05:41 +00:00
parent 4350704d65
commit a67a21ef3c

View file

@ -321,7 +321,7 @@ int read_config_file(avl_tree_t *config_tree, const char *fname)
int err = -2; /* Parse error */
FILE *fp;
char *buffer, *line;
char *variable, *value;
char *variable, *value, *eol;
int lineno = 0;
int len;
bool ignore = false;
@ -372,6 +372,10 @@ int read_config_file(avl_tree_t *config_tree, const char *fname)
variable = value = line;
eol = line + strlen(line);
while(strchr("\t ", *--eol))
*eol = '\0';
len = strcspn(value, "\t =");
value += len;
value += strspn(value, "\t ");
@ -381,6 +385,7 @@ int read_config_file(avl_tree_t *config_tree, const char *fname)
}
variable[len] = '\0';
if(!*value) {
logger(LOG_ERR, _("No value for variable `%s' on line %d while reading config file %s"),
variable, lineno, fname);