summaryrefslogtreecommitdiffstats
path: root/boggle
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
committerjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
commit04f4d7044367099914cf1906ae27ac20c24e44cf (patch)
treec17cb5c2f270bbb70eeba18cbe2bcfa43cfd8e10 /boggle
parentf9706028dd6e2afabb6bd63d02d7bc90f78e4aab (diff)
downloadbsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.gz
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.zst
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.zip
Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the NetBSD games, except in hunt (where substantial changes from OpenBSD need to be looked at). Some such changes were previously covered in PRs bin/6041, bin/6146, bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994, bin/8039, bin/8057 and bin/8093.
Diffstat (limited to 'boggle')
-rw-r--r--boggle/boggle/bog.c30
-rw-r--r--boggle/boggle/extern.h26
-rw-r--r--boggle/boggle/mach.c29
-rw-r--r--boggle/boggle/prtable.c16
-rw-r--r--boggle/boggle/word.c8
5 files changed, 56 insertions, 53 deletions
diff --git a/boggle/boggle/bog.c b/boggle/boggle/bog.c
index 4e6c4c79..6c3b92e2 100644
--- a/boggle/boggle/bog.c
+++ b/boggle/boggle/bog.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bog.c,v 1.11 1999/07/21 04:02:29 hubertf Exp $ */
+/* $NetBSD: bog.c,v 1.12 1999/09/08 21:17:44 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
#if 0
static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: bog.c,v 1.11 1999/07/21 04:02:29 hubertf Exp $");
+__RCSID("$NetBSD: bog.c,v 1.12 1999/09/08 21:17:44 jsm Exp $");
#endif
#endif /* not lint */
@@ -101,10 +101,12 @@ int wordpath[MAXWORDLEN + 1];
int wordlen; /* Length of last word returned by nextword() */
int usedbits;
-char *pword[MAXPWORDS], pwords[MAXPSPACE], *pwordsp;
+const char *pword[MAXPWORDS];
+char pwords[MAXPSPACE], *pwordsp;
int npwords;
-char *mword[MAXMWORDS], mwords[MAXMSPACE], *mwordsp;
+const char *mword[MAXMWORDS];
+char mwords[MAXMSPACE], *mwordsp;
int nmwords;
int ngames = 0;
@@ -415,10 +417,11 @@ timesup: ;
*/
int
checkword(word, prev, path)
- char *word;
+ const char *word;
int prev, *path;
{
- char *p, *q;
+ const char *p;
+ char *q;
int i, *lm;
if (debug) {
@@ -498,10 +501,10 @@ checkword(word, prev, path)
*/
int
validword(word)
- char *word;
+ const char *word;
{
int j;
- char *q, *w;
+ const char *q, *w;
j = word[0] - 'a';
if (dictseek(dictfp, dictindex[j].start, SEEK_SET) < 0) {
@@ -534,7 +537,8 @@ validword(word)
void
checkdict()
{
- char *p, **pw, *w;
+ char *p, *w;
+ const char **pw;
int i;
int prevch, previndex, *pi, *qi, st;
@@ -612,12 +616,12 @@ checkdict()
*/
void
newgame(b)
- char *b;
+ const char *b;
{
int i, p, q;
- char *tmp;
+ const char *tmp;
int *lm[26];
- static char *cubes[16] = {
+ static const char *cubes[16] = {
"ednosw", "aaciot", "acelrs", "ehinps",
"eefhiy", "elpstu", "acdemp", "gilruw",
"egkluy", "ahmors", "abilty", "adenvz",
@@ -684,7 +688,7 @@ int
compar(p, q)
const void *p, *q;
{
- return (strcmp(*(char **)p, *(char **)q));
+ return (strcmp(*(const char *const *)p, *(const char *const *)q));
}
void
diff --git a/boggle/boggle/extern.h b/boggle/boggle/extern.h
index ea27172c..7e9d942a 100644
--- a/boggle/boggle/extern.h
+++ b/boggle/boggle/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.4 1998/09/13 15:27:26 hubertf Exp $ */
+/* $NetBSD: extern.h,v 1.5 1999/09/08 21:17:44 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -35,11 +35,11 @@
* @(#)extern.h 8.1 (Berkeley) 6/11/93
*/
-void addword __P((char *));
+void addword __P((const char *));
void badword __P((void));
char *batchword __P((FILE *));
void checkdict __P((void));
-int checkword __P((char *, int, int *));
+int checkword __P((const char *, int, int *));
void cleanup __P((void));
void delay __P((int));
long dictseek __P((FILE *, long, int));
@@ -50,24 +50,24 @@ void getword __P((char *));
int help __P((void));
int inputch __P((void));
int loaddict __P((FILE *));
-int loadindex __P((char *));
-void newgame __P((char *));
+int loadindex __P((const char *));
+void newgame __P((const char *));
char *nextword __P((FILE *));
-FILE *opendict __P((char *));
+FILE *opendict __P((const char *));
void playgame __P((void));
-void prompt __P((char *));
-void prtable __P((char *[],
- int, int, int, void (*)(char *[], int), int (*)(char *[], int)));
-void putstr __P((char *));
+void prompt __P((const char *));
+void prtable __P((const char *const [],
+ int, int, int, void (*)(const char *const [], int), int (*)(const char *const [], int)));
+void putstr __P((const char *));
void redraw __P((void));
void results __P((void));
int setup __P((int, time_t));
-void showboard __P((char *));
-void showstr __P((char *, int));
+void showboard __P((const char *));
+void showstr __P((const char *, int));
void showword __P((int));
void starttime __P((void));
void startwords __P((void));
void stoptime __P((void));
int timerch __P((void));
void usage __P((void)) __attribute__((__noreturn__));
-int validword __P((char *));
+int validword __P((const char *));
diff --git a/boggle/boggle/mach.c b/boggle/boggle/mach.c
index e2b3abde..4aa4ce32 100644
--- a/boggle/boggle/mach.c
+++ b/boggle/boggle/mach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mach.c,v 1.8 1997/10/13 21:09:59 cjs Exp $ */
+/* $NetBSD: mach.c,v 1.9 1999/09/08 21:17:44 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93";
#else
-__RCSID("$NetBSD: mach.c,v 1.8 1997/10/13 21:09:59 cjs Exp $");
+__RCSID("$NetBSD: mach.c,v 1.9 1999/09/08 21:17:44 jsm Exp $");
#endif
#endif /* not lint */
@@ -70,16 +70,16 @@ static int colstarts[MAXCOLS], ncolstarts;
static int lastline;
int ncols, nlines;
-extern char *pword[], *mword[];
+extern const char *pword[], *mword[];
extern int ngames, nmwords, npwords, tnmwords, tnpwords;
static void cont_catcher __P((int));
-static int prwidth __P((char *[], int));
-static void prword __P((char *[], int));
+static int prwidth __P((const char *const [], int));
+static void prword __P((const char *const [], int));
static void stop_catcher __P((int));
static void tty_cleanup __P((void));
static int tty_setup __P((void));
-static void tty_showboard __P((char *));
+static void tty_showboard __P((const char *));
static void winch_catcher __P((int));
/*
@@ -150,7 +150,7 @@ results()
static void
prword(base, indx)
- char *base[];
+ const char *const base[];
int indx;
{
printw("%s", base[indx]);
@@ -158,7 +158,7 @@ prword(base, indx)
static int
prwidth(base, indx)
- char *base[];
+ const char *const base[];
int indx;
{
return (strlen(base[indx]));
@@ -339,7 +339,7 @@ startwords()
*/
void
addword(w)
- char *w;
+ const char *w;
{
int n;
@@ -410,7 +410,6 @@ findword()
char buf[MAXWORDLEN + 1];
extern char board[];
extern int usedbits, wordpath[];
- extern char *mword[], *pword[];
extern int nmwords, npwords;
getyx(stdscr, r, c);
@@ -480,7 +479,7 @@ findword()
*/
void
showstr(str, delaysecs)
- char *str;
+ const char *str;
int delaysecs;
{
addstr(str);
@@ -493,7 +492,7 @@ showstr(str, delaysecs)
void
putstr(s)
- char *s;
+ const char *s;
{
addstr(s);
}
@@ -561,14 +560,14 @@ getword(q)
void
showboard(b)
- char *b;
+ const char *b;
{
tty_showboard(b);
}
void
prompt(mesg)
- char *mesg;
+ const char *mesg;
{
move(PROMPT_LINE, PROMPT_COL);
printw("%s", mesg);
@@ -660,7 +659,7 @@ tty_cleanup()
static void
tty_showboard(b)
- char *b;
+ const char *b;
{
int i;
int line;
diff --git a/boggle/boggle/prtable.c b/boggle/boggle/prtable.c
index 2555444a..063d51a0 100644
--- a/boggle/boggle/prtable.c
+++ b/boggle/boggle/prtable.c
@@ -1,4 +1,4 @@
-/* $NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $ */
+/* $NetBSD: prtable.c,v 1.5 1999/09/08 21:17:45 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $");
+__RCSID("$NetBSD: prtable.c,v 1.5 1999/09/08 21:17:45 jsm Exp $");
#endif /* not lint */
#include <curses.h>
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $");
#define NCOLS 5
-static int get_maxlen __P((char *[], int, int (*)(char **, int)));
+static int get_maxlen __P((const char *const [], int, int (*)(const char *const *, int)));
/*
* Routine to print a table
@@ -68,10 +68,10 @@ static int get_maxlen __P((char *[], int, int (*)(char **, int)));
*/
void
prtable(base, num, d_cols, width, prentry, length)
- char *base[];
+ const char *const base[];
int num, d_cols, width;
- void (*prentry) __P((char *[], int));
- int (*length) __P((char *[], int));
+ void (*prentry) __P((const char *const [], int));
+ int (*length) __P((const char *const [], int));
{
int c, j;
int a, b, cols, loc, maxlen, nrows, z;
@@ -119,9 +119,9 @@ prtable(base, num, d_cols, width, prentry, length)
static int
get_maxlen(base, num, length)
- char *base[];
+ const char *const base[];
int num;
- int (*length) __P((char **, int));
+ int (*length) __P((const char *const *, int));
{
int i, len, max;
diff --git a/boggle/boggle/word.c b/boggle/boggle/word.c
index dd5fa812..b91f3a7b 100644
--- a/boggle/boggle/word.c
+++ b/boggle/boggle/word.c
@@ -1,4 +1,4 @@
-/* $NetBSD: word.c,v 1.4 1997/10/11 02:12:18 lukem Exp $ */
+/* $NetBSD: word.c,v 1.5 1999/09/08 21:17:45 jsm Exp $ */
/*-
* Copyright (c) 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)word.c 8.1 (Berkeley) 6/11/93";
#else
-__RCSID("$NetBSD: word.c,v 1.4 1997/10/11 02:12:18 lukem Exp $");
+__RCSID("$NetBSD: word.c,v 1.5 1999/09/08 21:17:45 jsm Exp $");
#endif
#endif /* not lint */
@@ -127,7 +127,7 @@ dictseek(fp, offset, ptrname)
FILE *
opendict(dict)
- char *dict;
+ const char *dict;
{
FILE *fp;
@@ -188,7 +188,7 @@ loaddict(fp)
*/
int
loadindex(indexfile)
- char *indexfile;
+ const char *indexfile;
{
int i, j;
char buf[BUFSIZ];