]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - hack/hack.main.c
Integrate Warp Kit into the NetBSD build
[bsdgames-darwin.git] / hack / hack.main.c
index 28eec738adf8b0ce3cac07bbeb429456c7fbffde..5083a36e4af960c2c008a9cbde60a7870de383c1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: hack.main.c,v 1.12 2009/06/07 20:13:18 dholland Exp $  */
+/*     $NetBSD: hack.main.c,v 1.17 2011/08/06 20:42:43 dholland Exp $  */
 
 /*
  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hack.main.c,v 1.12 2009/06/07 20:13:18 dholland Exp $");
+__RCSID("$NetBSD: hack.main.c,v 1.17 2011/08/06 20:42:43 dholland Exp $");
 #endif                         /* not lint */
 
 #include <signal.h>
@@ -90,7 +90,8 @@ const char     *catmore;      /* default pager */
 #endif
 char            SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */
 char           *hname;         /* name of the game (argv[0] of call) */
-char            obuf[BUFSIZ];  /* BUFSIZ is defined in stdio.h */
+
+static char obuf[BUFSIZ];      /* BUFSIZ is defined in stdio.h */
 
 int main(int, char *[]);
 static void chdirx(const char *, boolean);
@@ -183,7 +184,7 @@ main(int argc, char *argv[])
        cls();
        u.uhp = 1;              /* prevent RIP on early quits */
        u.ux = FAR;             /* prevent nscr() */
-       (void) signal(SIGHUP, hangup);
+       (void) signal(SIGHUP, hang_up);
 
        /*
         * Find the creation date of this game,
@@ -300,7 +301,8 @@ main(int argc, char *argv[])
                                }
                                *gp = 0;
                        } else
-                               (void) strcpy(genocided, sfoo);
+                               (void) strlcpy(genocided, sfoo,
+                                               sizeof(genocided));
                        (void) strcpy(fut_geno, genocided);
                }
        }
@@ -416,8 +418,10 @@ not_recovered:
                }
                if (multi < 0) {
                        if (!++multi) {
-                               pline(nomovemsg ? nomovemsg :
-                                     "You can move again.");
+                               if (nomovemsg)
+                                       pline("%s", nomovemsg);
+                               else
+                                       pline("You can move again.");
                                nomovemsg = 0;
                                if (afternmv)
                                        (*afternmv) ();
@@ -467,7 +471,7 @@ not_recovered:
 #ifdef MAIL
                        ckmailstatus();
 #endif
-                       rhack((char *) 0);
+                       rhack(NULL);
                }
                if (multi && multi % 7 == 0)
                        (void) fflush(stdout);
@@ -478,12 +482,12 @@ void
 glo(int foo)
 {
        /* construct the string  xlock.n  */
-       char           *tf;
+       size_t pos;
 
-       tf = lock;
-       while (*tf && *tf != '.')
-               tf++;
-       (void) sprintf(tf, ".%d", foo);
+       pos = 0;
+       while (lock[pos] && lock[pos] != '.')
+               pos++;
+       (void) snprintf(lock + pos, sizeof(lock) - pos, ".%d", foo);
 }
 
 /*