From 1f487855a5097c65aaad4752df259b9a877ba364 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 9 Feb 2003 12:33:18 +0000 Subject: Changed to work with new log-level Fixed to allow comments in config file to work properly git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@166 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd_io.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/inspircd_io.cpp') diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index 6e36de477..d8e095441 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -105,7 +105,7 @@ int EnumConf(const char* filename, const char* tag) { FILE *config; int ptr = 0; - char buffer[MAXBUF], c_tag[MAXBUF], c; + char buffer[MAXBUF], c_tag[MAXBUF], c, lastc; int in_token, in_quotes, tptr, j, idx = 0; char* key; @@ -118,9 +118,19 @@ int EnumConf(const char* filename, const char* tag) ptr = 0; in_token = 0; in_quotes = 0; + lastc = '\0'; while (!feof(config)) { + lastc = c; c = fgetc(config); + if ((c == '#') && (lastc == '\n')) + { + while ((c != '\n') && (!feof(config))) + { + lastc = c; + c = fgetc(config); + } + } if ((c == '<') && (!in_quotes)) { tptr = 0; @@ -184,7 +194,7 @@ int ReadConf(const char* filename, const char* tag, const char* var, int index, { FILE *config; int ptr = 0; - char buffer[MAXBUF], c_tag[MAXBUF], c; + char buffer[MAXBUF], c_tag[MAXBUF], c, lastc; int in_token, in_quotes, tptr, j, idx = 0; char* key; @@ -197,9 +207,19 @@ int ReadConf(const char* filename, const char* tag, const char* var, int index, ptr = 0; in_token = 0; in_quotes = 0; + lastc = '\0'; while (!feof(config)) { + lastc = c; c = fgetc(config); + if ((c == '#') && (lastc == '\n')) + { + while ((c != '\n') && (!feof(config))) + { + lastc = c; + c = fgetc(config); + } + } if ((c == '<') && (!in_quotes)) { tptr = 0; -- cgit v1.2.3