sprinkle static and prune some dead code
This commit is contained in:
parent
9795f61a5a
commit
43e0d095a0
@ -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,14 +118,13 @@ int tnmwords = 0, tnpwords = 0;
|
||||
jmp_buf env;
|
||||
|
||||
time_t start_t;
|
||||
int debug;
|
||||
int tlimit;
|
||||
|
||||
static FILE *dictfp;
|
||||
|
||||
int batch;
|
||||
int debug;
|
||||
int minlength;
|
||||
int reuse;
|
||||
int tlimit;
|
||||
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,
|
||||
|
@ -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 *);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user