summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-15 01:28:58 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-15 01:28:58 +0000
commitcc5bc5b3637c1ec79c59406a6f4b8997f44b4e81 (patch)
tree8671da8a1ed364c54b2096328472d1d67440bfe1 /src
parent2d07704bb6a0d2b474ed2471c0cb3ce497f40646 (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
Diffstat (limited to 'src')
-rw-r--r--src/config.c13
1 files changed, 11 insertions, 2 deletions
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();