diff options
author | venaas <venaas> | 2007-05-30 14:50:35 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2007-05-30 14:50:35 +0000 |
commit | 553fae7fdb4b04a91977ad907f130fe08290828d (patch) | |
tree | b07de6401c1d77890c471f82cfe13f7844afb9dc | |
parent | dbb14fef5f262d0427bcd415b3c9ecfb47eea9d8 (diff) |
improved config parsing of comments
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@115 e88ac4ed-0b26-0410-9574-a7f39faa03bf
-rw-r--r-- | radsecproxy.c | 6 |
1 files changed, 3 insertions, 3 deletions
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]) |