summaryrefslogtreecommitdiff
path: root/games/boggle
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1998-09-24 06:45:09 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1998-09-24 06:45:09 +0000
commitfb3a8a316c1960990044b83faf0ffc188d6400a6 (patch)
treeb08b99465fcec7e8f0b763c33e5ac4934ec528f6 /games/boggle
parent640b3036645f71b02ac49818156f6f974ac5834b (diff)
NetBSD changes and a few obvious fixes
Diffstat (limited to 'games/boggle')
-rw-r--r--games/boggle/README2
-rw-r--r--games/boggle/boggle/bog.c17
-rw-r--r--games/boggle/boggle/bog.h1
-rw-r--r--games/boggle/boggle/boggle.64
-rw-r--r--games/boggle/boggle/extern.h1
-rw-r--r--games/boggle/boggle/help.c8
-rw-r--r--games/boggle/boggle/helpfile15
-rw-r--r--games/boggle/boggle/mach.c7
-rw-r--r--games/boggle/boggle/prtable.c1
-rw-r--r--games/boggle/boggle/timer.c3
-rw-r--r--games/boggle/boggle/word.c17
-rw-r--r--games/boggle/mkdict/Makefile1
-rw-r--r--games/boggle/mkdict/mkdict.c11
-rw-r--r--games/boggle/mkindex/Makefile1
-rw-r--r--games/boggle/mkindex/mkindex.c3
15 files changed, 49 insertions, 43 deletions
diff --git a/games/boggle/README b/games/boggle/README
index 47c0938205e..b67c66c702d 100644
--- a/games/boggle/README
+++ b/games/boggle/README
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.2 1995/03/21 12:14:21 cgd Exp $
+$OpenBSD: README,v 1.3 1998/09/24 06:45:05 pjanzen Exp $
Bog is a fairly portable simulation of Parker Brother's game of Boggle and
is similar to the 4.[23] BSD "boggle" and Sun's "boggletool".
diff --git a/games/boggle/boggle/bog.c b/games/boggle/boggle/bog.c
index 9c2213bab1b..d545e609216 100644
--- a/games/boggle/boggle/bog.c
+++ b/games/boggle/boggle/bog.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: bog.c,v 1.5 1998/09/24 06:45:05 pjanzen Exp $ */
/* $NetBSD: bog.c,v 1.5 1995/04/24 12:22:32 cgd Exp $ */
/*-
@@ -46,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)bog.c 8.1 (Berkeley) 6/11/93";
#else
-static char rcsid[] = "$NetBSD: bog.c,v 1.5 1995/04/24 12:22:32 cgd Exp $";
+static char rcsid[] = "$OpenBSD: bog.c,v 1.5 1998/09/24 06:45:05 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -56,6 +57,7 @@ static char rcsid[] = "$NetBSD: bog.c,v 1.5 1995/04/24 12:22:32 cgd Exp $";
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <unistd.h>
#include "bog.h"
#include "extern.h"
@@ -126,12 +128,15 @@ main(argc, argv)
int argc;
char *argv[];
{
- long seed;
+ time_t seed;
int ch, done, i, selfuse, sflag;
char *bspec, *p;
+ /* revoke */
+ setegid(getgid());
setgid(getgid());
+ seed = 0;
batch = debug = reuse = selfuse = sflag = 0;
bspec = NULL;
minlength = 3;
@@ -165,18 +170,19 @@ main(argc, argv)
argv += optind;
/* process final arguments */
- if (argc > 0)
+ if (argc > 0) {
if (strcmp(argv[0], "+") == 0)
reuse = 1;
else if (strcmp(argv[0], "++") == 0)
selfuse = 1;
+ }
if (reuse || selfuse) {
argc -= 1;
argv += 1;
}
- if (argc > 0)
+ if (argc > 0) {
if (islower(argv[0][0])) {
if (strlen(argv[0]) != 16) {
usage();
@@ -187,6 +193,7 @@ main(argc, argv)
} else {
usage();
}
+ }
if (batch && bspec == NULL)
errx(1, "must give both -b and a board setup");
@@ -595,7 +602,7 @@ checkdict()
}
mword[nmwords++] = mwordsp;
p = w;
- while (*mwordsp++ = *p++);
+ while ((*mwordsp++ = *p++));
}
}
diff --git a/games/boggle/boggle/bog.h b/games/boggle/boggle/bog.h
index ae6654ebabc..4d92a0f77db 100644
--- a/games/boggle/boggle/bog.h
+++ b/games/boggle/boggle/bog.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: bog.h,v 1.2 1998/09/24 06:45:05 pjanzen Exp $ */
/* $NetBSD: bog.h,v 1.2 1995/03/21 12:14:32 cgd Exp $ */
/*-
diff --git a/games/boggle/boggle/boggle.6 b/games/boggle/boggle/boggle.6
index 9133cecb49f..ddade009b58 100644
--- a/games/boggle/boggle/boggle.6
+++ b/games/boggle/boggle/boggle.6
@@ -1,4 +1,4 @@
-.\" $OpenBSD: boggle.6,v 1.2 1997/08/04 11:51:29 downsj Exp $
+.\" $OpenBSD: boggle.6,v 1.3 1998/09/24 06:45:05 pjanzen Exp $
.\" $NetBSD: boggle.6,v 1.2 1995/03/21 12:14:35 cgd Exp $
.\"
.\" Copyright (c) 1997, Jason Downs. All rights reserved.
@@ -138,7 +138,7 @@ Help is available during play by typing
More detailed information on the game is given there.
.Sh BUGS
If there are a great many words in the cube the final display of the words
-may scroll off of the screen. (On a 25 line screen about 130 words can be
+may scroll off the screen. (On a 25 line screen about 130 words can be
displayed.)
.Pp
No word can contain a
diff --git a/games/boggle/boggle/extern.h b/games/boggle/boggle/extern.h
index fb0614ec538..0149a49f10c 100644
--- a/games/boggle/boggle/extern.h
+++ b/games/boggle/boggle/extern.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: extern.h,v 1.2 1998/09/24 06:45:05 pjanzen Exp $ */
/* $NetBSD: extern.h,v 1.3 1995/04/24 12:22:37 cgd Exp $ */
/*-
diff --git a/games/boggle/boggle/help.c b/games/boggle/boggle/help.c
index b7de8a2e084..a17cea01ac3 100644
--- a/games/boggle/boggle/help.c
+++ b/games/boggle/boggle/help.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: help.c,v 1.2 1998/09/24 06:45:06 pjanzen Exp $ */
/* $NetBSD: help.c,v 1.2 1995/03/21 12:14:38 cgd Exp $ */
/*-
@@ -40,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 6/11/93";
#else
-static char rcsid[] = "$NetBSD: help.c,v 1.2 1995/03/21 12:14:38 cgd Exp $";
+static char rcsid[] = "$OpenBSD: help.c,v 1.2 1998/09/24 06:45:06 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -62,7 +63,7 @@ help()
if ((fp = fopen(HELPFILE, "r")) == NULL)
return(-1);
win = newwin(0, 0, 0, 0);
- clearok(win, 1);
+ clearok(win, TRUE);
eof = 0;
if (ungetc(getc(fp), fp) == EOF) {
@@ -101,7 +102,8 @@ help()
inputch();
}
delwin(win);
- clearok(stdscr, 1);
+ clearok(stdscr, TRUE);
+ touchwin(stdscr);
refresh();
return(0);
}
diff --git a/games/boggle/boggle/helpfile b/games/boggle/boggle/helpfile
index 39fcd7b949f..7144e514a72 100644
--- a/games/boggle/boggle/helpfile
+++ b/games/boggle/boggle/helpfile
@@ -56,21 +56,6 @@ The time limit can be changed from the default 3 minutes by using the flag
The minimum word length can be changed from 3 letters by specifying 'w#',
where # is the minimum number of letters to use.
.
- Bugs and Limitations
-
-The following bugs and problems are known to exist:
-
-- If there are a great many words in the cube the final display of the words
- may scroll off of the screen. (On a 25 line screen about 130 words can be
- displayed.)
-
-- Computing the complete word list can be too slow on small machines.
-
-- No word can contain a 'q' that is not immediately followed by a 'u'.
-
-- When using the '+' or '++' options the display of words found in the board
- doesn't indicate reused cubes.
-.
Copyright (c) 1988
Barry Brachman | UUCP: {alberta,uw-beaver,uunet}!
Dept. of Computer Science| ubc-vision!ubc-csgrads!brachman
diff --git a/games/boggle/boggle/mach.c b/games/boggle/boggle/mach.c
index 74e0ecaa3d9..9e2a86349ba 100644
--- a/games/boggle/boggle/mach.c
+++ b/games/boggle/boggle/mach.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: mach.c,v 1.3 1998/09/24 06:45:06 pjanzen Exp $ */
/* $NetBSD: mach.c,v 1.5 1995/04/28 22:28:48 mycroft Exp $ */
/*-
@@ -40,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93";
#else
-static char rcsid[] = "$NetBSD: mach.c,v 1.5 1995/04/28 22:28:48 mycroft Exp $";
+static char rcsid[] = "$OpenBSD: mach.c,v 1.3 1998/09/24 06:45:06 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -49,6 +50,8 @@ static char rcsid[] = "$NetBSD: mach.c,v 1.5 1995/04/28 22:28:48 mycroft Exp $";
*
* Input is raw and unechoed
*/
+#include <sys/ioctl.h>
+
#include <ctype.h>
#include <curses.h>
#include <fcntl.h>
@@ -97,7 +100,7 @@ setup(sflag, seed)
time(&seed);
srandom(seed);
if (debug)
- (void) printf("seed = %ld\n", seed);
+ (void) printf("seed = %ld\n", (long) seed);
return(0);
}
diff --git a/games/boggle/boggle/prtable.c b/games/boggle/boggle/prtable.c
index 9017b9decc3..5d83448c968 100644
--- a/games/boggle/boggle/prtable.c
+++ b/games/boggle/boggle/prtable.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: prtable.c,v 1.4 1998/09/24 06:45:06 pjanzen Exp $ */
/* $NetBSD: prtable.c,v 1.2 1995/03/21 12:14:42 cgd Exp $ */
/*-
diff --git a/games/boggle/boggle/timer.c b/games/boggle/boggle/timer.c
index 6f9a0430734..8160eda534b 100644
--- a/games/boggle/boggle/timer.c
+++ b/games/boggle/boggle/timer.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: timer.c,v 1.2 1998/09/24 06:45:06 pjanzen Exp $ */
/* $NetBSD: timer.c,v 1.3 1995/04/24 12:22:45 cgd Exp $ */
/*-
@@ -40,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)timer.c 8.2 (Berkeley) 2/22/94";
#else
-static char rcsid[] = "$NetBSD: timer.c,v 1.3 1995/04/24 12:22:45 cgd Exp $";
+static char rcsid[] = "$OpenBSD: timer.c,v 1.2 1998/09/24 06:45:06 pjanzen Exp $";
#endif
#endif /* not lint */
diff --git a/games/boggle/boggle/word.c b/games/boggle/boggle/word.c
index 9ad16f199e4..62d0d16aafb 100644
--- a/games/boggle/boggle/word.c
+++ b/games/boggle/boggle/word.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: word.c,v 1.2 1998/09/24 06:45:06 pjanzen Exp $ */
/* $NetBSD: word.c,v 1.2 1995/03/21 12:14:45 cgd Exp $ */
/*-
@@ -40,13 +41,14 @@
#if 0
static char sccsid[] = "@(#)word.c 8.1 (Berkeley) 6/11/93";
#else
-static char rcsid[] = "$NetBSD: word.c,v 1.2 1995/03/21 12:14:45 cgd Exp $";
+static char rcsid[] = "$OpenBSD: word.c,v 1.2 1998/09/24 06:45:06 pjanzen Exp $";
#endif
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -171,7 +173,7 @@ loaddict(fp)
}
if (st < 0) {
(void)fclose(fp);
- (void)fprintf(stderr, "Error reading dictionary\n");
+ warnx("Error reading dictionary");
return (-1);
}
*p = '\0';
@@ -194,27 +196,26 @@ loadindex(indexfile)
extern struct dictindex dictindex[];
if ((fp = fopen(indexfile, "r")) == NULL) {
- (void) fprintf(stderr, "Can't open '%s'\n", indexfile);
+ warnx("Can't open '%s'", indexfile);
return (-1);
}
i = 0;
while (fgets(buf, sizeof(buf), fp) != NULL) {
if (strchr(buf, '\n') == NULL) {
- (void)fprintf(stderr,
- "A line in the index file is too long\n");
+ warnx("A line in the index file is too long");
return(-1);
}
j = *buf - 'a';
if (i != j) {
- (void) fprintf(stderr, "Bad index order\n");
- return(-1);
+ warnx("Bad index order");
+ return(-1);
}
dictindex[j].start = atol(buf + 1);
dictindex[j].length = atol(buf + 9) - dictindex[j].start;
i++;
}
if (i != 26) {
- (void) fprintf(stderr, "Bad index length\n");
+ warnx("Bad index length");
return(-1);
}
(void) fclose(fp);
diff --git a/games/boggle/mkdict/Makefile b/games/boggle/mkdict/Makefile
index 825cbe81c3a..f6d23d27efa 100644
--- a/games/boggle/mkdict/Makefile
+++ b/games/boggle/mkdict/Makefile
@@ -1,3 +1,4 @@
+# $OpenBSD: Makefile,v 1.3 1998/09/24 06:45:06 pjanzen Exp $
# $NetBSD: Makefile,v 1.2 1995/03/21 12:14:47 cgd Exp $
# @(#)Makefile 8.1 (Berkeley) 6/11/93
diff --git a/games/boggle/mkdict/mkdict.c b/games/boggle/mkdict/mkdict.c
index c0f3948a3db..561f0da39e9 100644
--- a/games/boggle/mkdict/mkdict.c
+++ b/games/boggle/mkdict/mkdict.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: mkdict.c,v 1.3 1998/09/24 06:45:06 pjanzen Exp $ */
/* $NetBSD: mkdict.c,v 1.2 1995/03/21 12:14:49 cgd Exp $ */
/*-
@@ -46,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mkdict.c 8.1 (Berkeley) 6/11/93";
#else
-static char rcsid[] = "$NetBSD: mkdict.c,v 1.2 1995/03/21 12:14:49 cgd Exp $";
+static char rcsid[] = "$OpenBSD: mkdict.c,v 1.3 1998/09/24 06:45:06 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -59,6 +60,7 @@ static char rcsid[] = "$NetBSD: mkdict.c,v 1.2 1995/03/21 12:14:49 cgd Exp $";
*/
#include <ctype.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -84,8 +86,7 @@ main(argc, argv)
for (nwords = 1;
fgets(buf[current], MAXWORDLEN + 1, stdin) != NULL; ++nwords) {
if ((p = strchr(buf[current], '\n')) == NULL) {
- fprintf(stderr,
- "mkdict: word too long: %s\n", buf[current]);
+ warnx("word too long: %s", buf[current]);
while ((ch = getc(stdin)) != EOF && ch != '\n')
;
if (ch == EOF)
@@ -101,7 +102,7 @@ main(argc, argv)
if (*q != 'u')
break;
else {
- while (*q = *(q + 1))
+ while ((*q = *(q + 1)))
q++;
}
len++;
@@ -125,6 +126,6 @@ main(argc, argv)
prev = !prev;
current = !current;
}
- fprintf(stderr, "%d words\n", nwords);
+ warnx("%d words", nwords);
exit(0);
}
diff --git a/games/boggle/mkindex/Makefile b/games/boggle/mkindex/Makefile
index 90903fe1b79..68eedb21581 100644
--- a/games/boggle/mkindex/Makefile
+++ b/games/boggle/mkindex/Makefile
@@ -1,3 +1,4 @@
+# $OpenBSD: Makefile,v 1.3 1998/09/24 06:45:06 pjanzen Exp $
# $NetBSD: Makefile,v 1.2 1995/03/21 12:14:51 cgd Exp $
# @(#)Makefile 8.1 (Berkeley) 6/11/93
diff --git a/games/boggle/mkindex/mkindex.c b/games/boggle/mkindex/mkindex.c
index 4d29da49cd4..4efaf57c7f3 100644
--- a/games/boggle/mkindex/mkindex.c
+++ b/games/boggle/mkindex/mkindex.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: mkindex.c,v 1.2 1998/09/24 06:45:07 pjanzen Exp $ */
/* $NetBSD: mkindex.c,v 1.2 1995/03/21 12:14:52 cgd Exp $ */
/*-
@@ -46,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)mkindex.c 8.1 (Berkeley) 6/11/93";
#else
-static char rcsid[] = "$NetBSD: mkindex.c,v 1.2 1995/03/21 12:14:52 cgd Exp $";
+static char rcsid[] = "$OpenBSD: mkindex.c,v 1.2 1998/09/24 06:45:07 pjanzen Exp $";
#endif
#endif /* not lint */