From 389702a9b4201dd03f756606f41eb58516997272 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Mon, 14 Oct 2013 21:34:04 +0200 Subject: [PATCH] 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... --- gnushogi/commondsp.c | 4 ++-- gnushogi/rawdsp.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) 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); } -- 1.7.0.4