Module Name: src
Committed By: dholland
Date: Sat Apr 24 00:56:14 UTC 2010
Modified Files:
src/games/larn: scores.c
Log Message:
Handle the "diedtime" field of the player log (which is not the high
scores file, the append-only log of all games) as int32_t instead of
time_t. Log files from before the 64-bit time_t change can now be read
again; however, log files from the last year of -current are hosed.
All none of you who play larn, take note...
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/games/larn/scores.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/games/larn/scores.c
diff -u src/games/larn/scores.c:1.19 src/games/larn/scores.c:1.20
--- src/games/larn/scores.c:1.19 Fri Apr 2 21:40:00 2010
+++ src/games/larn/scores.c Sat Apr 24 00:56:14 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: scores.c,v 1.19 2010/04/02 21:40:00 christos Exp $ */
+/* $NetBSD: scores.c,v 1.20 2010/04/24 00:56:14 dholland 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.19 2010/04/02 21:40:00 christos Exp $");
+__RCSID("$NetBSD: scores.c,v 1.20 2010/04/24 00:56:14 dholland Exp $");
#endif /* not lint */
#include <sys/types.h>
#include <sys/times.h>
@@ -64,7 +64,7 @@
struct log_fmt { /* 102 bytes struct for the log file */
long score; /* the players score */
- time_t diedtime; /* time when game was over */
+ int32_t diedtime; /* time when game was over */
short cavelev;/* level in caves */
short diff; /* difficulty player played at */
#ifdef EXTRA
@@ -774,6 +774,8 @@
char *p;
static char q[] = "?";
struct stat stbuf;
+ time_t t;
+
lcreat((char *) 0);
if (lopen(logfile) < 0) {
lprintf("Can't locate log file <%s>\n", logfile);
@@ -785,7 +787,8 @@
}
for (n = stbuf.st_size / sizeof(struct log_fmt); n > 0; --n) {
lrfill((char *) &logg, sizeof(struct log_fmt));
- if ((p = ctime(&logg.diedtime)) == NULL)
+ t = logg.diedtime;
+ if ((p = ctime(&t)) == NULL)
p = q;
else {
p[16] = '\n';