* wumpus.c --- a faithful translation of the classic "Hunt The Wumpus" game.
*
* Translator: Eric S. Raymond <esr@snark.thyrsus.com>
- * 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.
*/
#include <stdio.h>
+#include <ctype.h>
/* 5 REM *** HUNT THE WUMPUS *** */
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()