From: Eric S. Raymond Date: Sun, 19 Jul 2015 14:37:43 +0000 (-0400) Subject: More warning suppression. X-Git-Tag: 1.7~5 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=c933090a7a4c96592d6c3f0df61b7c0224187ada;p=wumpus.git More warning suppression. --- diff --git a/Makefile b/Makefile index ee64309..6ea41da 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ VERS=1.6 prefix?=/usr +CFLAGS = -Wall + all: wumpus superhack wumpus: wumpus.c diff --git a/superhack.c b/superhack.c index 7853168..c5461a1 100644 --- a/superhack.c +++ b/superhack.c @@ -15,6 +15,7 @@ #include #include #include +#include #include static int path[5]; @@ -37,6 +38,8 @@ static int loc[LOCS]; #define LOSE -1 static int finished; +#define IGNORE(r) do{if(r);}while(0) + static int cave[20][3] = { {1,4,7}, @@ -71,7 +74,7 @@ int getlet(prompt) char *prompt; { (void) printf("%s? ", prompt); - if(fgets(inp, sizeof(inp), stdin)) + if (fgets(inp, sizeof(inp), stdin)) return(tolower(inp[0])); else { fputs("\n",stdout); @@ -105,7 +108,7 @@ PM("Cambridge, Massachusetts. Your mission is to throw a pie in his face.\n"); PM(" If a pie hits the superhack, you win. If it hits you, you lose!\n"); (void) fputs("", stdout); - (void) fgets(inp, sizeof(inp), stdin); + IGNORE(fgets(inp, sizeof(inp), stdin)); (void) putchar('\n'); PM("Hazards:"); diff --git a/wumpus.c b/wumpus.c index 3afd568..6068fd6 100644 --- a/wumpus.c +++ b/wumpus.c @@ -368,7 +368,6 @@ badrange: /* 840 NEXT K */ } -ammo: if (finished == NOT) { /* 845 PRINT "MISSED" */ @@ -523,7 +522,7 @@ goodmove: } } -main(argc, argv) +int main(argc, argv) int argc; char *argv[]; {