-/* $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,
#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>
#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);
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,
}
*gp = 0;
} else
- (void) strcpy(genocided, sfoo);
+ (void) strlcpy(genocided, sfoo,
+ sizeof(genocided));
(void) strcpy(fut_geno, genocided);
}
}
}
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) ();
#ifdef MAIL
ckmailstatus();
#endif
- rhack((char *) 0);
+ rhack(NULL);
}
if (multi && multi % 7 == 0)
(void) fflush(stdout);
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);
}
/*