summaryrefslogtreecommitdiffstats
path: root/larn/scores.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2001-02-05 00:57:32 +0000
committerchristos <christos@NetBSD.org>2001-02-05 00:57:32 +0000
commitb1c8e14afd5a078ca925fe471733a693ca4a8076 (patch)
tree479753089c657c4900becbda1592945edbc418bb /larn/scores.c
parent5813ff28d2110a139386e10f5e3977f3b88dbda8 (diff)
downloadbsdgames-darwin-b1c8e14afd5a078ca925fe471733a693ca4a8076.tar.gz
bsdgames-darwin-b1c8e14afd5a078ca925fe471733a693ca4a8076.tar.zst
bsdgames-darwin-b1c8e14afd5a078ca925fe471733a693ca4a8076.zip
- rename getchar to lgetchar to avoid conflicts with the stdio getchar
- fix redundant decls and nested externs - use snprintf instead of sprintf
Diffstat (limited to 'larn/scores.c')
-rw-r--r--larn/scores.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/larn/scores.c b/larn/scores.c
index 2fbe635e..e9082a95 100644
--- a/larn/scores.c
+++ b/larn/scores.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scores.c,v 1.10 1997/10/18 20:03:48 christos Exp $ */
+/* $NetBSD: scores.c,v 1.11 2001/02/05 00:57:34 christos Exp $ */
/*
* scores.c Larn is copyrighted 1986 by Noah Morgan.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: scores.c,v 1.10 1997/10/18 20:03:48 christos Exp $");
+__RCSID("$NetBSD: scores.c,v 1.11 2001/02/05 00:57:34 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
#include <sys/times.h>
@@ -668,9 +668,11 @@ invalid:
mod = "an";
else
mod = "a";
- sprintf(logg.what, "killed by %s %s", mod, monster[x].name);
+ snprintf(logg.what, sizeof(logg.what),
+ "killed by %s %s", mod, monster[x].name);
} else
- sprintf(logg.what, "%s", whydead[x - 256]);
+ snprintf(logg.what, sizeof(logg.what),
+ "%s", whydead[x - 256]);
logg.cavelev = level;
time(&zzz); /* get cpu time -- write out score info */
logg.diedtime = zzz;
@@ -797,7 +799,7 @@ getplid(nam)
if (havepid != -1)
return (havepid); /* already did it */
lflush(); /* flush any pending I/O */
- sprintf(name, "%s\n", nam); /* append a \n to name */
+ snprintf(name, sizeof(name), "%s\n", nam);/* append a \n to name */
if (lopen(playerids) < 0) { /* no file, make it */
if ((fd7 = creat(playerids, 0666)) < 0)
return (-1); /* can't make it */