diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-15 01:28:58 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-15 01:28:58 +0000 |
commit | cc5bc5b3637c1ec79c59406a6f4b8997f44b4e81 (patch) | |
tree | 8671da8a1ed364c54b2096328472d1d67440bfe1 | |
parent | 2d07704bb6a0d2b474ed2471c0cb3ce497f40646 (diff) |
Config file parser in ServerConfig::LoadConf modified to allow for a single-directive single-line block.
This allows for a construct like: module { name = "load_me" }
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1687 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | src/config.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..5c1b617a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/autom4te.cache +Makefile +config.cache +config.log +config.status diff --git a/src/config.c b/src/config.c index 73660d286..f9144b663 100644 --- a/src/config.c +++ b/src/config.c @@ -1050,8 +1050,17 @@ bool ServerConfig::LoadConf(ConfigDataHash &target, const char *filename, std::o return false; } if (!wordbuffer.empty() || !itemname.empty()) { - errorstream << "Unexpected end of section: " << filename << ":" << linenumber << std::endl; - return false; + // this will allow for the construct: section { key = value } + // but will not allow for anything else, such as: section { key = value; key = value } + if (!sectiondata.empty()) { + errorstream << "Unexpected end of section: " << filename << ":" << linenumber << std::endl; + return false; + } + // this is the same as the below section for testing if itemname is non-empty after the loop, but done inside it to allow the above construct + if (debug) alog("ln %d EOL: s='%s' '%s' set to '%s'", linenumber, section.c_str(), itemname.c_str(), wordbuffer.c_str()); + sectiondata.push_back(KeyVal(itemname, wordbuffer)); + wordbuffer.clear(); + itemname.clear(); } target.insert(std::pair<std::string, KeyValList>(section, sectiondata)); section.clear(); |