From: Eric S. Raymond Date: Fri, 17 May 1996 17:30:35 +0000 (+0000) Subject: Slipstream in Larry Schwimmer's input fix. X-Git-Tag: 1-3~4 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=cc6729cf4476397bafbf23ad0f8e14016052015f;p=wumpus.git Slipstream in Larry Schwimmer's input fix. --- diff --git a/wumpus.c b/wumpus.c index 8b3cc47..bf9f0a6 100644 --- a/wumpus.c +++ b/wumpus.c @@ -2,7 +2,7 @@ * wumpus.c --- a faithful translation of the classic "Hunt The Wumpus" game. * * Translator: Eric S. Raymond - * Version: $Id$ + * Version: $Id: wumpus.c,v 1.3 1993/11/07 19:19:27 esr Exp esr $ * * This was the state of the art 20 years ago, in 1972. We've come a long * way, baby. @@ -31,6 +31,7 @@ */ #include +#include /* 5 REM *** HUNT THE WUMPUS *** */ @@ -102,16 +103,24 @@ int getnum(prompt) char *prompt; { (void) printf("%s\n?", prompt); - (void) fgets(inp, sizeof(inp), stdin); - return(atoi(inp)); + if (fgets(inp, sizeof(inp), stdin)) + return(atoi(inp)); + else { + fputs("\n",stdout); + exit(1); + } } int getlet(prompt) char *prompt; { (void) printf("%s\n?", prompt); - (void) fgets(inp, sizeof(inp), stdin); - return(inp[0]); + if (fgets(inp, sizeof(inp), stdin)) + return(toupper(inp[0])); + else { + fputs("\n",stdout); + exit(1); + } } void print_instructions()