conf: remove trailing whitespace via C code, not regex

This commit is contained in:
rofl0r 2020-10-15 22:36:10 +01:00
parent 22f059dc5e
commit ae4cbcabd1
2 changed files with 4 additions and 1 deletions

View File

@ -333,6 +333,9 @@ static int config_parse (struct config_s *conf, FILE * f)
e = config_directive_find(p, strlen(p)); e = config_directive_find(p, strlen(p));
++q; ++q;
while(isspace(*q))++q; while(isspace(*q))++q;
p = q;
while(*p && *p != '\n') ++p;
while(isspace(*p)) *(p--) = 0;
if (!e || e->value == CD_NIL || check_match (conf, q, lineno, e->value)) { if (!e || e->value == CD_NIL || check_match (conf, q, lineno, e->value)) {
fprintf (stderr, "ERROR: Syntax error on line %lu\n", lineno); fprintf (stderr, "ERROR: Syntax error on line %lu\n", lineno);
return 1; return 1;

View File

@ -25,7 +25,7 @@
#define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)" #define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)"
#define BEGIN "^" #define BEGIN "^"
#define END SPACE "*$" #define END "$"
STDCONF (logfile, STR, handle_logfile), STDCONF (logfile, STR, handle_logfile),