Improve configsys option parsing

Up until now all the options in the config system have only been
able to take one word (or one string with no spaces) as a parameter.
This update improves it so it takes everything after the = up until
the end of the line (or the first #) as the parameter.
This commit is contained in:
Matt Jenkins
2014-04-29 13:37:09 +01:00
parent 1b15bcff49
commit 07b6681eef

View File

@@ -160,11 +160,19 @@ bool config::load(const char *filename)
pos = temp.find("="); pos = temp.find("=");
if(pos>0) if(pos>0)
{ {
stringstream data;
string l,r; string l,r;
l = temp.substr(0,pos); l = temp.substr(0,pos);
uc(l); uc(l);
r = temp.substr(pos+1,temp.size()); r = temp.substr(pos+1,temp.size());
this->instances["GLOBAL"].settings[l] = r; data << r;
while (in >> temp) {
if (temp[0] == '#') {
break;
}
data << " " << temp;
}
this->instances["GLOBAL"].settings[l] = data.str();
this->instances["GLOBAL"].device="GLOBAL"; this->instances["GLOBAL"].device="GLOBAL";
this->instances["GLOBAL"].unit=0; this->instances["GLOBAL"].unit=0;
} }