Module Name: src
Committed By: dholland
Date: Wed Aug 12 05:29:40 UTC 2009
Modified Files:
src/games/boggle/boggle: bog.c extern.h mach.c
src/games/boggle/mkindex: mkindex.c
Log Message:
sprinkle static and prune some dead code
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/games/boggle/boggle/bog.c
cvs rdiff -u -r1.10 -r1.11 src/games/boggle/boggle/extern.h
cvs rdiff -u -r1.19 -r1.20 src/games/boggle/boggle/mach.c
cvs rdiff -u -r1.10 -r1.11 src/games/boggle/mkindex/mkindex.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/games/boggle/boggle/bog.c
diff -u src/games/boggle/boggle/bog.c:1.23 src/games/boggle/boggle/bog.c:1.24
--- src/games/boggle/boggle/bog.c:1.23 Mon Jul 13 19:05:39 2009
+++ src/games/boggle/boggle/bog.c Wed Aug 12 05:29:40 2009
@@ -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 @@
#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 @@
#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 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 @@
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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
}
-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,
Index: src/games/boggle/boggle/extern.h
diff -u src/games/boggle/boggle/extern.h:1.10 src/games/boggle/boggle/extern.h:1.11
--- src/games/boggle/boggle/extern.h:1.10 Mon Jul 13 19:05:39 2009
+++ src/games/boggle/boggle/extern.h Wed Aug 12 05:29:40 2009
@@ -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 @@
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 *);
Index: src/games/boggle/boggle/mach.c
diff -u src/games/boggle/boggle/mach.c:1.19 src/games/boggle/boggle/mach.c:1.20
--- src/games/boggle/boggle/mach.c:1.19 Mon Jul 13 19:05:39 2009
+++ src/games/boggle/boggle/mach.c Wed Aug 12 05:29:40 2009
@@ -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 @@
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 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 @@
/*
* Stop the game timer
*/
-void
+static void
stoptime(void)
{
time_t t;
@@ -293,7 +298,7 @@
/*
* Restart the game timer
*/
-void
+static void
starttime(void)
{
time_t t;
@@ -474,16 +479,10 @@
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;
Index: src/games/boggle/mkindex/mkindex.c
diff -u src/games/boggle/mkindex/mkindex.c:1.10 src/games/boggle/mkindex/mkindex.c:1.11
--- src/games/boggle/mkindex/mkindex.c:1.10 Fri Jul 1 16:38:24 2005
+++ src/games/boggle/mkindex/mkindex.c Wed Aug 12 05:29:40 2009
@@ -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 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 @@
#include "bog.h"
-char *nextword(FILE *, char *, int *, int *);
+static char *nextword(FILE *, char *, int *, int *);
int
main(void)
@@ -94,7 +94,7 @@
* 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;