Previously input like "setoption name Use Search Log value true "
(note space at the end of the line) didn't work.
Now parse value same way as option name. This way we implicitly
left- and right-trim value.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
void set_option(UCIInputParser& uip) {
void set_option(UCIInputParser& uip) {
+ string token, name, value;
if (!(uip >> token)) // operator>>() skips any whitespace
return;
if (!(uip >> token)) // operator>>() skips any whitespace
return;
while (uip >> token && token != "value")
name += (" " + token);
while (uip >> token && token != "value")
name += (" " + token);
+ if (token == "value" && uip >> value)
- // Reads until end of line and left trim white space
- getline(uip, token);
- token.erase(0, token.find_first_not_of(" \n\r\t"));
+ while (uip >> token)
+ value += (" " + token);
- set_option_value(name, token);
+ set_option_value(name, value);
} else
push_button(name);
}
} else
push_button(name);
}