From 553fae7fdb4b04a91977ad907f130fe08290828d Mon Sep 17 00:00:00 2001 From: venaas Date: Wed, 30 May 2007 14:50:35 +0000 Subject: improved config parsing of comments git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@115 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- radsecproxy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'radsecproxy.c') diff --git a/radsecproxy.c b/radsecproxy.c index 673fe9b..37b9228 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -1866,14 +1866,14 @@ struct peer *server_create(char type) { } /* returns NULL on error, where to continue parsing if token and ok. E.g. "" will return token with empty string */ -char *strtokenquote(char *s, char **token, char *del, char *quote) { +char *strtokenquote(char *s, char **token, char *del, char *quote, char *comment) { char *t = s, *q, *r; if (!t || !token || !del) return NULL; while (*t && strchr(del, *t)) t++; - if (!*t) { + if (!*t || (comment && strchr(comment, *t))) { *token = NULL; return t + 1; /* needs to be non-NULL, but value doesn't matter */ } @@ -1917,7 +1917,7 @@ void getgeneralconfig(FILE *f, char *block, ...) { while (fgets(line, 1024, f)) { s = line; for (tcount = 0; tcount < 3; tcount++) { - s = strtokenquote(s, &tokens[tcount], " \t\n", "\"'"); + s = strtokenquote(s, &tokens[tcount], " \t\n", "\"'", tcount ? NULL : "#"); if (!s) debugx(1, DBG_ERR, "Syntax error in line starting with: %s", line); if (!tokens[tcount]) -- cgit v1.1