Date: Wed, 10 Nov 1999 02:35:58 +0900 From: Issei Numata <issei@guru.gr.jp> To: freebsd-bugs@freeBSD.org Subject: Y2K for nethack, nethack-qt and japanese/nethack Message-ID: <19991110023558X.issei@heart.ne.jp>
index | next in thread | raw e-mail
These NetHacks( nethack, nethack-qt and japanese/nethack)
has Y2K problem
Look at function yymmdd() which is in 'hacklib.c'. This function
generate 'datestr' with 6 degits format, But 'datestr' has only 7
bytes so the NetHack cannot write 7 degits.
yymmdd()
{
...
Static char datestr[7];
...
...
Sprintf(datestr, "%02d%02d%02d",
lt->tm_year, lt->tm_mon + 1, lt->tm_mday);
...
...
}
Above function is used at generating log and record. Unfortunately
when reading, the NetHack uses fscanf as bellow(see src/topten.c)
static char *fmt = "%d %d %d %ld %d %d %d %d %d %d %6s %6s %d%*c%c%c %s %s%*c";
~~~ ~~~(created by yymmdd)
So, NetHack cannot read 7 degits record file and cause dumping core.
The easy way to fix this problem, fix yymmdd() in src/hacklib.c as bellow.
Sprintf(datestr, "%02d%02d%02d",
lt->tm_year % 100, lt->tm_mon + 1, lt->tm_mday);
It seems 'yymmdd' function has no effect for playing game. It used
only writing log and record. So I think above fixing will work
correctly.(and easy)
--
Issei Numata
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991110023558X.issei>
