diff options
author | dholland <dholland@NetBSD.org> | 2010-04-24 00:56:14 +0000 |
---|---|---|
committer | dholland <dholland@NetBSD.org> | 2010-04-24 00:56:14 +0000 |
commit | 2fc94a2a6476f927aee489e40f3575a8e78955fe (patch) | |
tree | 4fb8a7b14359966ca03fee5e5f5b7a722fbe496c /larn | |
parent | d2ee870815c331fc0cb7424c35bd71012898df15 (diff) | |
download | bsdgames-darwin-2fc94a2a6476f927aee489e40f3575a8e78955fe.tar.gz bsdgames-darwin-2fc94a2a6476f927aee489e40f3575a8e78955fe.tar.zst bsdgames-darwin-2fc94a2a6476f927aee489e40f3575a8e78955fe.zip |
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...
Diffstat (limited to 'larn')
-rw-r--r-- | larn/scores.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/larn/scores.c b/larn/scores.c index b33150c5..c17a770f 100644 --- a/larn/scores.c +++ b/larn/scores.c @@ -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 wscofmt { /* This is the structure for the winning 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 @@ diedlog() 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 @@ diedlog() } 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'; |