summaryrefslogtreecommitdiffstats
path: root/boggle
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-08-12 05:29:40 +0000
committerdholland <dholland@NetBSD.org>2009-08-12 05:29:40 +0000
commit662780f7f3ea41e118586facdd8dc87d8b739263 (patch)
tree4366118b1f022f9d8597f48fef6e758ebce26d9b /boggle
parente0b4b2e87c96803d2d4d74cad54f16eb1d15a8d9 (diff)
downloadbsdgames-darwin-662780f7f3ea41e118586facdd8dc87d8b739263.tar.gz
bsdgames-darwin-662780f7f3ea41e118586facdd8dc87d8b739263.tar.zst
bsdgames-darwin-662780f7f3ea41e118586facdd8dc87d8b739263.zip
sprinkle static and prune some dead code
Diffstat (limited to 'boggle')
-rw-r--r--boggle/boggle/bog.c42
-rw-r--r--boggle/boggle/extern.h12
-rw-r--r--boggle/boggle/mach.c23
-rw-r--r--boggle/mkindex/mkindex.c8
4 files changed, 39 insertions, 46 deletions
diff --git a/boggle/boggle/bog.c b/boggle/boggle/bog.c
index edb0a93c..d8bfdda5 100644
--- a/boggle/boggle/bog.c
+++ b/boggle/boggle/bog.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bog.c,v 1.23 2009/07/13 19:05:39 roy Exp $ */
+/* $NetBSD: bog.c,v 1.24 2009/08/12 05:29:40 dholland Exp $ */
/*-
* Copyright (c) 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
#if 0
static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: bog.c,v 1.23 2009/07/13 19:05:39 roy Exp $");
+__RCSID("$NetBSD: bog.c,v 1.24 2009/08/12 05:29:40 dholland Exp $");
#endif
#endif /* not lint */
@@ -58,8 +58,13 @@ __RCSID("$NetBSD: bog.c,v 1.23 2009/07/13 19:05:39 roy Exp $");
#include "bog.h"
#include "extern.h"
-static int compar(const void *, const void *);
- int main(int, char *[]);
+static char *batchword(FILE *);
+static void playgame(void);
+static int validword(const char *);
+static void checkdict(void);
+static void newgame(const char *);
+static int compar(const void *, const void *);
+static void usage(void) __attribute__((__noreturn__));
struct dictindex dictindex[26];
@@ -99,11 +104,11 @@ int wordlen; /* Length of last word returned by nextword() */
int usedbits;
const char *pword[MAXPWORDS];
-char pwords[MAXPSPACE], *pwordsp;
+static char pwords[MAXPSPACE], *pwordsp;
int npwords;
const char *mword[MAXMWORDS];
-char mwords[MAXMSPACE], *mwordsp;
+static char mwords[MAXMSPACE], *mwordsp;
int nmwords;
int ngames = 0;
@@ -113,15 +118,14 @@ int tnmwords = 0, tnpwords = 0;
jmp_buf env;
time_t start_t;
-
-static FILE *dictfp;
-
-int batch;
int debug;
-int minlength;
-int reuse;
int tlimit;
+static FILE *dictfp;
+static int batch;
+static int minlength;
+static int reuse;
+
int
main(int argc, char *argv[])
{
@@ -279,7 +283,7 @@ main(int argc, char *argv[])
* Read a line from the given stream and check if it is legal
* Return a pointer to a legal word or a null pointer when EOF is reached
*/
-char *
+static char *
batchword(FILE *fp)
{
int *p, *q;
@@ -307,7 +311,7 @@ batchword(FILE *fp)
* Reset the word lists from last game
* Keep track of the running stats
*/
-void
+static void
playgame(void)
{
int i, *p, *q;
@@ -510,7 +514,7 @@ checkword(const char *word, int prev, int *path)
* At this point it is already known that the word can be formed from
* the current board
*/
-int
+static int
validword(const char *word)
{
int j;
@@ -544,7 +548,7 @@ validword(const char *word)
* Delete words from the machine list that the player has found
* Assume both the dictionary and the player's words are already sorted
*/
-void
+static void
checkdict(void)
{
char *p, *w;
@@ -624,7 +628,7 @@ checkdict(void)
* If the argument is non-null then it is assumed to be a legal board spec
* in ascending cube order, oth. make a random board
*/
-void
+static void
newgame(const char *b)
{
int i, p, q;
@@ -693,13 +697,13 @@ newgame(const char *b)
}
-int
+static int
compar(const void *p, const void *q)
{
return (strcmp(*(const char *const *)p, *(const char *const *)q));
}
-void
+static void
usage(void)
{
(void) fprintf(stderr,
diff --git a/boggle/boggle/extern.h b/boggle/boggle/extern.h
index 7c06ea75..ee9a3407 100644
--- a/boggle/boggle/extern.h
+++ b/boggle/boggle/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.10 2009/07/13 19:05:39 roy Exp $ */
+/* $NetBSD: extern.h,v 1.11 2009/08/12 05:29:40 dholland Exp $ */
/*-
* Copyright (c) 1993
@@ -35,8 +35,6 @@
void addword(const char *);
void badword(void);
-char *batchword(FILE *);
-void checkdict(void);
int checkword(const char *, int, int *);
void cleanup(void);
void delay(int);
@@ -44,29 +42,21 @@ long dictseek(FILE *, long, int);
void findword(void);
void flushin(FILE *);
char *get_line(char *);
-void getword(char *);
int help(void);
int inputch(void);
int loaddict(FILE *);
int loadindex(const char *);
-void newgame(const char *);
char *nextword(FILE *);
FILE *opendict(const char *);
-void playgame(void);
void prompt(const char *);
void prtable(const char *const [],
int, int, int, void (*)(const char *const [], int),
int (*)(const char *const [], int));
-void putstr(const char *);
void redraw(void);
void results(void);
int setup(int, time_t);
void showboard(const char *);
void showstr(const char *, int);
void showword(int);
-void starttime(void);
void startwords(void);
-void stoptime(void);
int timerch(void);
-void usage(void) __attribute__((__noreturn__));
-int validword(const char *);
diff --git a/boggle/boggle/mach.c b/boggle/boggle/mach.c
index ba68287c..823c738d 100644
--- a/boggle/boggle/mach.c
+++ b/boggle/boggle/mach.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mach.c,v 1.19 2009/07/13 19:05:39 roy Exp $ */
+/* $NetBSD: mach.c,v 1.20 2009/08/12 05:29:40 dholland Exp $ */
/*-
* Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93";
#else
-__RCSID("$NetBSD: mach.c,v 1.19 2009/07/13 19:05:39 roy Exp $");
+__RCSID("$NetBSD: mach.c,v 1.20 2009/08/12 05:29:40 dholland Exp $");
#endif
#endif /* not lint */
@@ -64,7 +64,8 @@ __RCSID("$NetBSD: mach.c,v 1.19 2009/07/13 19:05:39 roy Exp $");
static int ccol, crow, maxw;
static int colstarts[MAXCOLS], ncolstarts;
static int lastline;
-int ncols, nlines;
+static int ncols;
+int nlines;
extern const char *pword[], *mword[];
extern int ngames, nmwords, npwords, tnmwords, tnpwords;
@@ -81,6 +82,10 @@ static void tty_cleanup(void);
static int tty_setup(void);
static void tty_showboard(const char *);
static void winch_catcher(int);
+static void getword(char *);
+static void starttime(void);
+static void stoptime(void);
+
/*
* Do system dependent initialization
@@ -281,7 +286,7 @@ static int gone;
/*
* Stop the game timer
*/
-void
+static void
stoptime(void)
{
time_t t;
@@ -293,7 +298,7 @@ stoptime(void)
/*
* Restart the game timer
*/
-void
+static void
starttime(void)
{
time_t t;
@@ -474,16 +479,10 @@ showstr(const char *str, int delaysecs)
refresh();
}
-void
-putstr(const char *s)
-{
- addstr(s);
-}
-
/*
* Get a valid word and put it in the buffer
*/
-void
+static void
getword(char *q)
{
int ch, col, done, i, row;
diff --git a/boggle/mkindex/mkindex.c b/boggle/mkindex/mkindex.c
index e572000a..ddda2bd9 100644
--- a/boggle/mkindex/mkindex.c
+++ b/boggle/mkindex/mkindex.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mkindex.c,v 1.10 2005/07/01 16:38:24 jmc Exp $ */
+/* $NetBSD: mkindex.c,v 1.11 2009/08/12 05:29:40 dholland Exp $ */
/*-
* Copyright (c) 1993
@@ -40,7 +40,7 @@ static char copyright[] = "@(#) Copyright (c) 1993\n\
static char sccsid[] = "@(#)mkindex.c 8.1 (Berkeley) 6/11/93";
#else
static char rcsid[] =
- "$NetBSD: mkindex.c,v 1.10 2005/07/01 16:38:24 jmc Exp $";
+ "$NetBSD: mkindex.c,v 1.11 2009/08/12 05:29:40 dholland Exp $";
#endif
#endif /* not lint */
@@ -49,7 +49,7 @@ static char rcsid[] =
#include "bog.h"
-char *nextword(FILE *, char *, int *, int *);
+static char *nextword(FILE *, char *, int *, int *);
int
main(void)
@@ -94,7 +94,7 @@ main(void)
* Also set clen to the length of the compressed word (for mkindex) and
* rlen to the strlen() of the real word
*/
-char *
+static char *
nextword(FILE *fp, char *buffer, int *clen, int *rlen)
{
int ch, pcount;