From: Yann Dirson Date: Mon, 14 Oct 2013 19:34:04 +0000 (+0200) Subject: Detect EOF waiting for user input in xshogi and raw modes, and trigger exit. X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=389702a9b4201dd03f756606f41eb58516997272;p=gnushogi.git Detect EOF waiting for user input in xshogi and raw modes, and trigger exit. No idea why the raw implementation of ExitShogi() did not call exit(). Even after detecting EOF, we were thrown into a tight loop... --- diff --git a/gnushogi/commondsp.c b/gnushogi/commondsp.c index 31dc80e..1f39b78 100644 --- a/gnushogi/commondsp.c +++ b/gnushogi/commondsp.c @@ -1745,8 +1745,8 @@ InputCommand(char *command) { s[0] = sx[0] = '\0'; - while(!sx[0]) - (void)fgets(sx, 80, stdin); + while(!eof && !sx[0]) + eof = (fgets(sx, 80, stdin) == NULL); } else { diff --git a/gnushogi/rawdsp.c b/gnushogi/rawdsp.c index 2109ca9..d3f3055 100644 --- a/gnushogi/rawdsp.c +++ b/gnushogi/rawdsp.c @@ -204,6 +204,8 @@ Raw_ExitShogi(void) if (!nolist) ListGame(); + + exit(0); }