aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1997-09-24 22:50:24 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1997-09-24 22:50:24 +0000
commita768c2696789412f801c01cb1c56edb02d76d1e7 (patch)
tree71b2216b9e0c3ecf3c85564ee38aa19e943ee8ef
parent6e429392aca88a6b755e793374c69ab00a7a3f84 (diff)
downloadsrc-a768c2696789412f801c01cb1c56edb02d76d1e7.tar.gz
src-a768c2696789412f801c01cb1c56edb02d76d1e7.zip
Move under HIDEGAME, add revoke
Cleanup Convert to random()
Notes
Notes: svn path=/head/; revision=29830
-rw-r--r--games/bs/Makefile3
-rw-r--r--games/bs/bs.c30
2 files changed, 11 insertions, 22 deletions
diff --git a/games/bs/Makefile b/games/bs/Makefile
index 31498f4b9c88..876e50272e80 100644
--- a/games/bs/Makefile
+++ b/games/bs/Makefile
@@ -1,8 +1,9 @@
-# $Id$
+# $Id: Makefile,v 1.3 1997/02/22 14:46:48 peter Exp $
PROG= bs
MAN6= bs.6
DPADD= ${LIBNCURSES} ${LIBMYTINFO}
LDADD= -lncurses -lmytinfo
+HIDEGAME=hidegame
.include <bsd.prog.mk>
diff --git a/games/bs/bs.c b/games/bs/bs.c
index f28d4c7119fc..c6d9c4ebdf45 100644
--- a/games/bs/bs.c
+++ b/games/bs/bs.c
@@ -11,6 +11,10 @@
#include <signal.h>
#include <ctype.h>
#include <assert.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+#include <string.h>
#ifndef A_UNDERLINE /* BSD curses */
#define beep() write(1,"\007",1);
@@ -21,25 +25,6 @@
#define strchr index
#endif /* !A_UNDERLINE */
-#ifdef isxdigit /* aha, must be an AT&T system... */
-#define srand(n) srand48(n)
-#define rand() lrand48()
-extern long lrand48();
-extern void srand48();
-#define bzero(s, n) (void)memset((char *)(s), '\0', n)
-extern char *memset();
-/*
- * Try this if ungetch() fails to resolve.
- *
- * #define ungetch ungetc
- */
-#endif /* isxdigit */
-
-extern unsigned sleep();
-extern char *strchr(), *strcpy();
-extern long time();
-extern void exit();
-
static bool checkplace();
/*
@@ -203,7 +188,7 @@ static void intro()
extern char *getlogin();
char *tmpname;
- srand(time(0L)+getpid()); /* Kick the random number generator */
+ srandomdev();
(void) signal(SIGINT,uninitgame);
(void) signal(SIGINT,uninitgame);
@@ -311,7 +296,7 @@ int vis;
static int rnd(n)
int n;
{
- return(((rand() & 0x7FFF) % n));
+ return(random() % n);
}
static void randomplace(b, ss)
@@ -1202,6 +1187,9 @@ main(argc, argv)
int argc;
char *argv[];
{
+ /* revoke */
+ setgid(getgid());
+
do_options(argc, argv);
intro();