From ae4cbcabd1e36ea6ca3dbb8b05b093504d46060d Mon Sep 17 00:00:00 2001 From: rofl0r Date: Thu, 15 Oct 2020 22:36:10 +0100 Subject: [PATCH] conf: remove trailing whitespace via C code, not regex --- src/conf.c | 3 +++ src/conf_regex.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index 0af3c6a..0b3a1a1 100644 --- a/src/conf.c +++ b/src/conf.c @@ -333,6 +333,9 @@ static int config_parse (struct config_s *conf, FILE * f) e = config_directive_find(p, strlen(p)); ++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)) { fprintf (stderr, "ERROR: Syntax error on line %lu\n", lineno); return 1; diff --git a/src/conf_regex.h b/src/conf_regex.h index c2d78f9..2f3f372 100644 --- a/src/conf_regex.h +++ b/src/conf_regex.h @@ -25,7 +25,7 @@ #define IPV6MASK "(" IPV6 "(/" DIGIT "+)?)" #define BEGIN "^" -#define END SPACE "*$" +#define END "$" STDCONF (logfile, STR, handle_logfile),