]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - larn/scores.c
fix spelling of accidentally; from Zapher
[bsdgames-darwin.git] / larn / scores.c
index 2fbe635ed77a69245a966bb1d637647c9eb25cb7..71d399e198135cb1a2b71a155ab17aaa89b2288b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: scores.c,v 1.10 1997/10/18 20:03:48 christos Exp $     */
+/*     $NetBSD: scores.c,v 1.12 2004/02/13 11:36:08 wiz 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.12 2004/02/13 11:36:08 wiz Exp $");
 #endif                         /* not lint */
 #include <sys/types.h>
 #include <sys/times.h>
@@ -74,9 +74,9 @@ struct log_fmt {              /* 102 bytes struct for the log file                             */
        long            moves;  /* number of moves made by player                                        */
        short           ac;     /* armor class of player                                                         */
        short           hp, hpmax;      /* players hitpoints                                                             */
-       short           cputime;/* cpu time needed in seconds                                            */
+       short           cputime;/* CPU time needed in seconds                                            */
        short           killed, spused; /* monsters killed and spells cast                                       */
-       short           usage;  /* usage of the cpu in %                                                         */
+       short           usage;  /* usage of the CPU in %                                                         */
        short           lev;    /* player level                                                                          */
 #endif
        char            who[12];/* player name                                                                           */
@@ -668,14 +668,16 @@ 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 */
+               time(&zzz);     /* get CPU time -- write out score info */
                logg.diedtime = zzz;
 #ifdef EXTRA
-               times(&cputime);/* get cpu time -- write out score info */
+               times(&cputime);/* get CPU time -- write out score info */
                logg.cputime = i = (cputime.tms_utime + cputime.tms_stime) / 60 + c[CPUTIME];
                logg.lev = c[LEVEL];
                logg.ac = c[AC];
@@ -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 */