summaryrefslogtreecommitdiff
path: root/games/snake/snake.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-06 21:48:53 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-06 21:48:53 +0000
commit99f7d832e358aafae4a20e767b7ff31210c4887d (patch)
tree0d21178d992de6b4ae212bcdf5ad9cef92f9ee18 /games/snake/snake.c
parent9e9e683c581c45c1caca670660c0bb9d1906a95d (diff)
Replace things like srandom(time(NULL)) with srandomdev(3). random(3)
good enough for games but we should at least use a decent seed. pjanzen@ OK
Diffstat (limited to 'games/snake/snake.c')
-rw-r--r--games/snake/snake.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/games/snake/snake.c b/games/snake/snake.c
index 8f2bce01393..07fbdb90c31 100644
--- a/games/snake/snake.c
+++ b/games/snake/snake.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snake.c,v 1.6 2002/06/23 03:01:13 deraadt Exp $ */
+/* $OpenBSD: snake.c,v 1.7 2002/12/06 21:48:51 millert Exp $ */
/* $NetBSD: snake.c,v 1.8 1995/04/29 00:06:41 mycroft Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94";
#else
-static char rcsid[] = "$OpenBSD: snake.c,v 1.6 2002/06/23 03:01:13 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: snake.c,v 1.7 2002/12/06 21:48:51 millert Exp $";
#endif
#endif /* not lint */
@@ -155,7 +155,6 @@ main(argc, argv)
{
int ch, i;
char *p, **av;
- time_t tv;
struct sigaction sa;
/* don't create the score file if it doesn't exist. */
@@ -168,8 +167,6 @@ main(argc, argv)
setegid(getgid());
setgid(getgid());
- (void)time(&tv);
-
/* check to see if we were called as snscore */
av = argv;
p = strrchr(*av, '/');
@@ -182,11 +179,6 @@ main(argc, argv)
while ((ch = getopt(argc, argv, "hl:stw:")) != -1)
switch ((char)ch) {
-#if 0
- case 'd':
- tv = atol(optarg); /* set seed */
- break;
-#endif
case 'w': /* width */
ccnt = atoi(optarg);
break;
@@ -208,7 +200,7 @@ main(argc, argv)
exit(1);
}
- srandom((int)tv);
+ srandomdev();
penalty = loot = 0;
initscr();
#ifdef KEY_LEFT