+ bufsize = 100;
+ buffer = xmalloc(bufsize);
+
+ for(;;) {
+ line = readline(fp, &buffer, &bufsize);
+
+ if(!line) {
+ err = -1;
+ break;
+ }
+
+ if(feof(fp)) {
+ err = 0;
+ break;
+ }
+
+ lineno++;
+
+ variable = strtok(line, "\t =");
+
+ if(!variable)
+ continue; /* no tokens on this line */
+
+ if(variable[0] == '#')
+ continue; /* comment: ignore */
+
+ if(!strcmp(variable, "-----BEGIN"))
+ ignore = 1;
+
+ if(!ignore) {
+ value = strtok(NULL, "\t\n\r =");
+
+ if(!value || value[0] == '#') {
+ syslog(LOG_ERR, _("No value for variable `%s' on line %d while reading config file %s"),
+ variable, lineno, fname);
+ break;
+ }
+
+ cfg = new_config();
+ cfg->variable = xstrdup(variable);
+ cfg->value = xstrdup(value);
+ cfg->file = xstrdup(fname);
+ cfg->line = lineno;
+
+ config_add(config_tree, cfg);
+ }
+
+ if(!strcmp(variable, "-----END"))
+ ignore = 0;