diff options
author | ache <ache@FreeBSD.org> | 1997-09-24 22:50:24 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-09-24 22:50:24 +0000 |
commit | 6f55e9458460f79b421bc71379e641e7b31e3e78 (patch) | |
tree | e23f3de29696f9ecdadb04d1ae975b13510222d9 /games | |
parent | 3cf3c553568545613953707cc857ecf601c62166 (diff) | |
download | FreeBSD-src-6f55e9458460f79b421bc71379e641e7b31e3e78.zip FreeBSD-src-6f55e9458460f79b421bc71379e641e7b31e3e78.tar.gz |
Move under HIDEGAME, add revoke
Cleanup
Convert to random()
Diffstat (limited to 'games')
-rw-r--r-- | games/bs/Makefile | 3 | ||||
-rw-r--r-- | games/bs/bs.c | 30 |
2 files changed, 11 insertions, 22 deletions
diff --git a/games/bs/Makefile b/games/bs/Makefile index 31498f4..876e502 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 f28d4c7..c6d9c4e 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(); |