version 1.4.50b
[polyglot.git] / uci.c
diff --git a/uci.c b/uci.c
index 9326ec7..5eff8cc 100644 (file)
--- a/uci.c
+++ b/uci.c
@@ -10,6 +10,7 @@
 \r
 #include "board.h"\r
 #include "engine.h"\r
+#include "gui.h"\r
 #include "move.h"\r
 #include "move_do.h"\r
 #include "move_legal.h"\r
@@ -18,6 +19,7 @@
 #include "line.h"\r
 #include "uci.h"\r
 \r
+\r
 // constants\r
 \r
 static const bool UseDebug = FALSE;\r
@@ -148,6 +150,11 @@ void uci_open(uci_t * uci, engine_t * engine) {
 \r
    do {\r
       engine_get(uci->engine,string);\r
+      // Handle the case that the engine is really a WB engine somewhat gracefully.\r
+      if((strstr(string,"Illegal") || strstr(string,"Error"))\r
+         &&strstr(string,"uci")){\r
+          my_fatal("uci_open(): Not an UCI engine (not found).\n");\r
+      }\r
       event = uci_parse(uci,string);\r
    } while (!engine_eof(Engine) && (event & EVENT_UCI) == 0);\r
 }\r
@@ -331,7 +338,7 @@ int uci_parse(uci_t * uci, const char string[]) {
    parse_open(parse,string);\r
 \r
    if (parse_get_word(parse,command,StringSize)) {\r
-\r
+       \r
       parse_get_string(parse,argument,StringSize);\r
       if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" ARGUMENT \"%s\"\n",command,argument);\r
 \r