diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2003-02-09 12:33:18 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2003-02-09 12:33:18 +0000 |
commit | 1f487855a5097c65aaad4752df259b9a877ba364 (patch) | |
tree | 494f7b3732726b10f41728c4b91e4d07a8655dff /src/inspircd_io.cpp | |
parent | 330da271fb8fff08865c7c489a5d4b4bdabcffd2 (diff) |
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
Diffstat (limited to 'src/inspircd_io.cpp')
-rw-r--r-- | src/inspircd_io.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
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; |