summaryrefslogtreecommitdiffstats
path: root/larn
diff options
context:
space:
mode:
authorperry <perry@NetBSD.org>2005-02-03 02:23:02 +0000
committerperry <perry@NetBSD.org>2005-02-03 02:23:02 +0000
commit6390e770b812f3df9943b72dff360a36cfd20cba (patch)
treefea52994275a802b70e02430eff27c4f5fa12493 /larn
parent8c726f9d6c66bda0d4eadf3b4bf8fb3d24c7c7fc (diff)
downloadbsdgames-darwin-6390e770b812f3df9943b72dff360a36cfd20cba.tar.gz
bsdgames-darwin-6390e770b812f3df9943b72dff360a36cfd20cba.tar.zst
bsdgames-darwin-6390e770b812f3df9943b72dff360a36cfd20cba.zip
A preprocessor macro named "srand" was defined which seeded the random
number generator. Unfortunately, it conflicted with a function of the same defined in stdlib.h. This was masked by the __P hack, which is now being purged. I've renamed "srand" to "seedrand" to eliminate the conflict.
Diffstat (limited to 'larn')
-rw-r--r--larn/header.h4
-rw-r--r--larn/io.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/larn/header.h b/larn/header.h
index 08bc6265..f2a4cf70 100644
--- a/larn/header.h
+++ b/larn/header.h
@@ -1,4 +1,4 @@
-/* $NetBSD: header.h,v 1.14 2003/10/21 07:26:39 agc Exp $ */
+/* $NetBSD: header.h,v 1.15 2005/02/03 02:23:02 perry Exp $ */
/* header.h Larn is copyrighted 1986 by Noah Morgan. */
@@ -429,7 +429,7 @@ extern int rmst, maxitm, lasttime;
#define lprc(ch) ((lpnt>=lpend)?(*lpnt++ =(ch), lflush()):(*lpnt++ =(ch)))
/* macro to seed the random number generator */
-#define srand(x) (randx=x)
+#define seedrand(x) (randx=x)
#ifdef MACRORND
/* macros to generate random numbers 1<=rnd(N)<=N 0<=rund(N)<=N-1 */
#define rnd(x) ((((randx=randx*1103515245+12345)>>7)%(x))+1)
diff --git a/larn/io.c b/larn/io.c
index f60711e2..3f2d34b4 100644
--- a/larn/io.c
+++ b/larn/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.14 2002/05/26 00:12:13 wiz Exp $ */
+/* $NetBSD: io.c,v 1.15 2005/02/03 02:23:02 perry Exp $ */
/*
* io.c Larn is copyrighted 1986 by Noah Morgan.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: io.c,v 1.14 2002/05/26 00:12:13 wiz Exp $");
+__RCSID("$NetBSD: io.c,v 1.15 2005/02/03 02:23:02 perry Exp $");
#endif /* not lint */
#include "header.h"
@@ -209,7 +209,7 @@ newgame()
long *p, *pe;
for (p = c, pe = c + 100; p < pe; *p++ = 0);
time(&initialtime);
- srand(initialtime);
+ seedrand(initialtime);
lcreat((char *) 0); /* open buffering for output to terminal */
}