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;
+ 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)
{
case '\n':
{
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;
*/
bool BindSocket(int sockfd, struct sockaddr_in client, struct sockaddr_in server, int port, char* addr)
{
- memset((char *)&server,0,sizeof(server));
+ memset(&server,0,sizeof(server));
struct in_addr addy;
bool resolved = false;
char resolved_addr[128];
}
else
{
- setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on));
+ setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
/* This is BSD compatible, setting l_onoff to 0 is *NOT* http://web.irc.org/mla/ircd-dev/msg02259.html */
linger.l_onoff = 1;
linger.l_linger = 1;
- setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (const char*)&linger,sizeof(linger));
+ setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &linger,sizeof(linger));
return (sockfd);
}
}