1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Standardize set_option function

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>
This commit is contained in:
Joona Kiiski 2010-01-27 10:37:12 +02:00 committed by Marco Costalba
parent 32bd6e44f0
commit 2360c8aa2f

View file

@ -224,7 +224,7 @@ namespace {
void set_option(UCIInputParser& uip) {
string token, name;
string token, name, value;
if (!(uip >> token)) // operator>>() skips any whitespace
return;
@ -234,13 +234,12 @@ namespace {
while (uip >> token && token != "value")
name += (" " + token);
if (token == "value")
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);
}