nomove:\r
fflush(toE); fflush(stdout);\r
i = 0; while((x = getchar()) != EOF && (line[i] = x) != '\n') i++;\r
- line[++i] = 0; if(x == EOF) { printf("# EOF\n"); EPRINT((f, "# quit\n")) exit(-1); }\r
+ line[++i] = 0; if(x == EOF) { printf("# EOF\n"); sprintf(line, "quit -1\n"); }\r
sscanf(line, "%s", command);\r
if(!strcmp(command, "offer")) { drawOffer = 1; goto nomove; } // backlogged anyway, so this can be done instantly\r
if(think) { // command arrived during thinking; order abort for 'instant commands'\r
else if(!strcmp(command, "name")) { if(namOpt) EPRINT((f, "# setoption name UCI_Opponent value none none %s %s", comp ? "computer" : "human", line+5)) }\r
else if(!strcmp(command, "computer")) comp = 1;\r
else if(!strcmp(command, "result")) { if(sc == 's') EPRINT((f, "# gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose")) }\r
- else if(!strcmp(command, "quit")) { EPRINT((f, "# quit\n")) fflush(toE), exit(0); }\r
+ else if(!strcmp(command, "quit")) { EPRINT((f, "# quit\n")) fflush(toE), exit(atoi(line+4)); }\r
}\r
}\r
\r