ifstream inf("/usr/gp2x/common.ini", ios_base::in);
if (inf.is_open()) {
string line;
string section = "";
while (getline(inf, line, '\n')) {
line = trim(line);
if (line[0]=='[' && line[line.length()-1]==']') {
section = line.substr(1,line.length()-2);
} else {
string::size_type pos = line.find("=");
string name = trim(line.substr(0,pos));
string value = trim(line.substr(pos+1,line.length()));
if (section=="usbnet") {
if (name=="enable")
usbnet = value=="true" ? true : false;
else if (name=="ip")
ip = value;
} else if (section=="server") {
if (name=="inet")
inet = value=="true" ? true : false;
else if (name=="samba")
samba = value=="true" ? true : false;
else if (name=="web")
web = value=="true" ? true : false;
}
}
}
inf.close();
}