Fix some C that gcc tags as unclean or unsafe. Rename 'a' structure to 'game'.
[super-star-trek.git] / sst.c
diff --git a/sst.c b/sst.c
index 2c888443c27eeaf4c6b943d71442fee786e68ecb..e4fe2afe0fcf55a0eab1f3f5d3a4001e47c6bd79 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -13,8 +13,6 @@ static int linecount; /* for paging */
 \r
 static void clearscreen(void);\r
 \r
-#define NUMCOMMANDS 34\r
-\r
 /* Compared to original version, I've changed the "help" command to\r
    "call" and the "terminate" command to "quit" to better match\r
    user expectations. The DECUS version apparently made those changes\r
@@ -52,7 +50,7 @@ static void clearscreen(void);
    */\r
 \r
 \r
-static char *commands[NUMCOMMANDS] = {\r
+static char *commands[] = {\r
        "srscan",\r
        "lrscan",\r
        "phasers",\r
@@ -88,6 +86,7 @@ static char *commands[NUMCOMMANDS] = {
        "quit",\r
        "help"\r
 };\r
+#define NUMCOMMANDS    sizeof(commands)/sizeof(commands[0])\r
 \r
 static void listCommands(int x) {\r
        prout("   SRSCAN    MOVE      PHASERS   CALL\n"\r
@@ -210,7 +209,7 @@ static void makemoves(void) {
                                warp(1);\r
                                break;\r
                        case 5:                 // shields\r
-                               sheild(1);\r
+                               doshield(1);\r
                                if (ididit) {\r
                                        attack(2);\r
                                        shldchg = 0;\r
@@ -345,7 +344,7 @@ static void makemoves(void) {
 }\r
 \r
 \r
-void main(int argc, char **argv) {\r
+int main(int argc, char **argv) {\r
        int i;\r
        int hitme;\r
        char ch;\r
@@ -401,8 +400,8 @@ void cramen(int i) {
                case IHP: s = "Planet"; break;\r
                case IHB: s = "Starbase"; break;\r
                case IHBLANK: s = "Black hole"; break;\r
-               case IHT: s = "Tholean"; break;\r
-               case IHWEB: s = "Tholean web"; break;\r
+               case IHT: s = "Tholian"; break;\r
+               case IHWEB: s = "Tholian web"; break;\r
                default: s = "Unknown??"; break;\r
        }\r
        proutn(s);\r
@@ -486,7 +485,8 @@ int scan(void) {
                        chew();\r
                        return IHEOL;\r
                }\r
-               gets(line);\r
+               fgets(line, sizeof(line), stdin);\r
+               line[strlen(line)-1] = '\0';\r
                linep = line;\r
        }\r
        // Skip leading white space\r