Code cleanup patches.
[wumpus.git] / superhack.c
index eacb8eb2d9befc0e91a9c3d7663e5a1ca92dfc0f..78531685b9dbdb45eae392b6a1f56ef73c34f11b 100644 (file)
@@ -13,6 +13,9 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/socket.h>
 
 static int path[5];
 static int j, k, scratchloc, pies;
@@ -80,8 +83,6 @@ char *prompt;
 
 void print_instructions()
 {
-    char ebuf[BUFSIZ];
-
     PM("Welcome to `Hunt the Superhack'\n")
 
 PM("   The superhack lives on the 9th floor of 45 Technology Square in");
@@ -231,7 +232,7 @@ void throw()
     }
 
     for (k = 0; k < j9; k++)
-       if (path[k] == path[k - 2])
+       if (k >= 2 && path[k] == path[k - 2])
        {
            (void) puts("Pies can't fly that crookedly --- try again.");
            return;
@@ -261,7 +262,6 @@ void throw()
 
     }
 
- ammo:
     if (finished == NOT)
     {
        (void) puts("You missed.");
@@ -350,9 +350,7 @@ goodmove:
     }
 }
 
-main(argc, argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
 {
     if (argc >= 2 && strcmp(argv[1], "-s") == 0)
        srand(atoi(argv[2]));
@@ -423,6 +421,7 @@ char *argv[];
            break;
        }
     }
+    return 0;
 }
 
 /* superhack.c ends here */