if (bail)
{
- printf("There were errors in your configuration:\n%s",errstr.str().c_str());
+ /* Unneeded because of the log() aboive? */
+ // printf("There were errors in your configuration:\n%s",errstr.str().c_str());
Exit(0);
}
else
*/
if((ch == '#') && !in_quote)
- {
in_comment = true;
- continue;
+
+ if(((ch == '\n') || (ch == '\r')) && in_quote)
+ {
+ errorstream << "Got a newline within a quoted section, this is probably a typo: " << filename << ":" << linenumber << std::endl;
+ return false;
}
switch(ch)
ch = ' ';
}
+ if(in_comment)
+ continue;
+
line += ch;
if(ch == '<')
{
if(!in_quote)
{
- errorstream << "Got another opening < when the first one wasn't closed on line " << linenumber << std::endl;
+ errorstream << "Got another opening < when the first one wasn't closed: " << filename << ":" << linenumber << std::endl;
return false;
}
}
{
if(in_quote)
{
- errorstream << "We're in a quote but outside a tag, interesting. Line: " << linenumber << std::endl;
+ errorstream << "We're in a quote but outside a tag, interesting. " << filename << ":" << linenumber << std::endl;
return false;
}
else
{
if(in_quote)
{
- errorstream << "Found a (closing) \" outside a tag on line " << linenumber << std::endl;
+ errorstream << "Found a (closing) \" outside a tag: " << filename << ":" << linenumber << std::endl;
}
else
{
- errorstream << "Found a (opening) \" outside a tag on line " << linenumber << std::endl;
+ errorstream << "Found a (opening) \" outside a tag: " << filename << ":" << linenumber << std::endl;
}
}
}
}
else
{
- errorstream << "Got a closing > when we weren't inside a tag on line " << linenumber << std::endl;
+ errorstream << "Got a closing > when we weren't inside a tag: " << filename << ":" << linenumber << std::endl;
return false;
}
}
got_name = got_key = in_quote = false;
- std::cout << "ParseLine(data, '" << line << "', " << linenumber << ", stream)" << std::endl;
+ // std::cout << "ParseLine(data, '" << line << "', " << linenumber << ", stream)" << std::endl;
for(std::string::iterator c = line.begin(); c != line.end(); c++)
{
if((tagname == "include") && (current_key == "file"))
{
- this->DoInclude(target, current_value, errorstream);
+ if(!this->DoInclude(target, current_value, errorstream))
+ return false;
}
current_key.clear();
/* Finished parsing the tag, add it to the config hash */
target.insert(std::pair<std::string, KeyValList > (tagname, results));
- std::cout << "Finished parsing " << tagname << std::endl;
- std::cout << "Count of <server> tag: " << target.count("server") << std::endl;
return true;
}
}
else
{
- log(DEBUG, "ConfValue got an out-of-range index %d", index);
+ log(DEBUG, "ConfValue got an out-of-range index %d", pos);
}
return false;
}
else
{
- log(DEBUG, "ConfVarEnum got an out-of-range index %d", index);
+ log(DEBUG, "ConfVarEnum got an out-of-range index %d", pos);
}
return 0;