From 2360c8aa2fb852a7999b9716406e650423f5e4a4 Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Wed, 27 Jan 2010 10:37:12 +0200 Subject: [PATCH] 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 --- src/uci.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index 6fa55912..e35ea977 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -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); } -- 2.39.2