summaryrefslogtreecommitdiffstats
path: root/canfield
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-08-12 05:35:44 +0000
committerdholland <dholland@NetBSD.org>2009-08-12 05:35:44 +0000
commitae271365b029dbf18dbdc93763cb6fda6db7f559 (patch)
treec27d8ac78846a04a6d8f641a1a08104fc65e7e7d /canfield
parent662780f7f3ea41e118586facdd8dc87d8b739263 (diff)
downloadbsdgames-darwin-ae271365b029dbf18dbdc93763cb6fda6db7f559.tar.gz
bsdgames-darwin-ae271365b029dbf18dbdc93763cb6fda6db7f559.tar.zst
bsdgames-darwin-ae271365b029dbf18dbdc93763cb6fda6db7f559.zip
sprinkle static
Diffstat (limited to 'canfield')
-rw-r--r--canfield/canfield/canfield.c235
-rw-r--r--canfield/cfscores/cfscores.c10
2 files changed, 122 insertions, 123 deletions
diff --git a/canfield/canfield/canfield.c b/canfield/canfield/canfield.c
index be6f35b5..a717d059 100644
--- a/canfield/canfield/canfield.c
+++ b/canfield/canfield/canfield.c
@@ -1,4 +1,4 @@
-/* $NetBSD: canfield.c,v 1.25 2008/08/08 16:10:47 drochner Exp $ */
+/* $NetBSD: canfield.c,v 1.26 2009/08/12 05:35:44 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\
#if 0
static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: canfield.c,v 1.25 2008/08/08 16:10:47 drochner Exp $");
+__RCSID("$NetBSD: canfield.c,v 1.26 2009/08/12 05:35:44 dholland Exp $");
#endif
#endif /* not lint */
@@ -149,25 +149,25 @@ struct cardtype {
#define NIL ((struct cardtype *) -1)
-struct cardtype *deck[decksize];
-struct cardtype cards[decksize];
-struct cardtype *bottom[4], *found[4], *tableau[4];
-struct cardtype *talon, *hand, *stock, *basecard;
-int length[4];
-int cardsoff, base, cinhand, taloncnt, stockcnt, timesthru;
-char suitmap[4] = {spades, clubs, hearts, diamonds};
-char colormap[4] = {black, black, red, red};
-char pilemap[4] = {atabcol, btabcol, ctabcol, dtabcol};
-char srcpile, destpile;
-int mtforigin, tempbase;
-int coldcol, cnewcol, coldrow, cnewrow;
-bool errmsg, done;
-bool mtfdone, Cflag = FALSE;
+static struct cardtype *deck[decksize];
+static struct cardtype cards[decksize];
+static struct cardtype *bottom[4], *found[4], *tableau[4];
+static struct cardtype *talon, *hand, *stock, *basecard;
+static int length[4];
+static int cardsoff, base, cinhand, taloncnt, stockcnt, timesthru;
+static char suitmap[4] = {spades, clubs, hearts, diamonds};
+static char colormap[4] = {black, black, red, red};
+static char pilemap[4] = {atabcol, btabcol, ctabcol, dtabcol};
+static char srcpile, destpile;
+static int mtforigin, tempbase;
+static int coldcol, cnewcol, coldrow, cnewrow;
+static bool errmsg, done;
+static bool mtfdone, Cflag = FALSE;
#define INSTRUCTIONBOX 1
#define BETTINGBOX 2
#define NOBOX 3
-int status = INSTRUCTIONBOX;
-int uid;
+static int status = INSTRUCTIONBOX;
+static int uid;
/*
* Basic betting costs
@@ -193,58 +193,57 @@ struct betinfo {
long wins; /* total winnings */
long worth; /* net worth after costs */
};
-struct betinfo this, game, total;
-bool startedgame = FALSE, infullgame = FALSE;
-time_t acctstart;
-int dbfd = -1;
-
-void askquit(int);
-void cleanup(int) __dead;
-void cleanupboard(void);
-void clearabovemovebox(void);
-void clearbelowmovebox(void);
-void clearmsg(void);
-void clearstat(void);
-void destinerror(void);
-bool diffcolor(const struct cardtype *, const struct cardtype *);
-void dumberror(void);
-bool finish(void);
-void fndbase(struct cardtype **, int, int);
-void getcmd(int, int, const char *);
-void initall(void);
-void initdeck(struct cardtype *[]);
-void initgame(void);
-void instruct(void);
-int main(void);
-void makeboard(void);
-void movebox(void);
-void movecard(void);
-void movetofound(struct cardtype **, int);
-void movetotalon(void);
-bool notempty(const struct cardtype *);
-void printbottombettingbox(void);
-void printbottominstructions(void);
-void printcard(int, int, const struct cardtype *);
-void printrank(int, int, const struct cardtype *, bool);
-void printtopbettingbox(void);
-void printtopinstructions(void);
-bool rankhigher(const struct cardtype *, int);
-bool ranklower(const struct cardtype *, const struct cardtype *);
-void removecard(int, int);
-int samesuit(const struct cardtype *, int);
-void showcards(void);
-void showstat(void);
-void shuffle(struct cardtype *[]);
-void simpletableau(struct cardtype **, int);
-void startgame(void);
-void suspend(void);
-bool tabok(const struct cardtype *, int);
-void tabprint(int, int);
-void tabtotab(int, int);
-void transit(struct cardtype **, struct cardtype **);
-void updatebettinginfo(void);
-void usedstock(void);
-void usedtalon(void);
+static struct betinfo this, game, total;
+static bool startedgame = FALSE, infullgame = FALSE;
+static time_t acctstart;
+static int dbfd = -1;
+
+static void askquit(int);
+static void cleanup(int) __dead;
+static void cleanupboard(void);
+static void clearabovemovebox(void);
+static void clearbelowmovebox(void);
+static void clearmsg(void);
+static void clearstat(void);
+static void destinerror(void);
+static bool diffcolor(const struct cardtype *, const struct cardtype *);
+static void dumberror(void);
+static bool finish(void);
+static void fndbase(struct cardtype **, int, int);
+static void getcmd(int, int, const char *);
+static void initall(void);
+static void initdeck(struct cardtype *[]);
+static void initgame(void);
+static void instruct(void);
+static void makeboard(void);
+static void movebox(void);
+static void movecard(void);
+static void movetofound(struct cardtype **, int);
+static void movetotalon(void);
+static bool notempty(const struct cardtype *);
+static void printbottombettingbox(void);
+static void printbottominstructions(void);
+static void printcard(int, int, const struct cardtype *);
+static void printrank(int, int, const struct cardtype *, bool);
+static void printtopbettingbox(void);
+static void printtopinstructions(void);
+static bool rankhigher(const struct cardtype *, int);
+static bool ranklower(const struct cardtype *, const struct cardtype *);
+static void removecard(int, int);
+static int samesuit(const struct cardtype *, int);
+static void showcards(void);
+static void showstat(void);
+static void shuffle(struct cardtype *[]);
+static void simpletableau(struct cardtype **, int);
+static void startgame(void);
+static void suspend(void);
+static bool tabok(const struct cardtype *, int);
+static void tabprint(int, int);
+static void tabtotab(int, int);
+static void transit(struct cardtype **, struct cardtype **);
+static void updatebettinginfo(void);
+static void usedstock(void);
+static void usedtalon(void);
/*
* The following procedures print the board onto the screen using the
@@ -253,7 +252,7 @@ void usedtalon(void);
*
* procedure to set the move command box
*/
-void
+static void
movebox(void)
{
switch (status) {
@@ -288,7 +287,7 @@ movebox(void)
/*
* print directions above move box
*/
-void
+static void
printtopinstructions(void)
{
move(tboxrow, boxcol);
@@ -322,7 +321,7 @@ printtopinstructions(void)
/*
* Print the betting box.
*/
-void
+static void
printtopbettingbox(void)
{
@@ -357,7 +356,7 @@ printtopbettingbox(void)
/*
* clear info above move box
*/
-void
+static void
clearabovemovebox(void)
{
int i;
@@ -373,7 +372,7 @@ clearabovemovebox(void)
/*
* print instructions below move box
*/
-void
+static void
printbottominstructions(void)
{
move(bboxrow, boxcol);
@@ -387,7 +386,7 @@ printbottominstructions(void)
/*
* print betting information below move box
*/
-void
+static void
printbottombettingbox(void)
{
move(bboxrow, boxcol);
@@ -401,7 +400,7 @@ printbottombettingbox(void)
/*
* clear info below move box
*/
-void
+static void
clearbelowmovebox(void)
{
int i;
@@ -417,7 +416,7 @@ clearbelowmovebox(void)
/*
* procedure to put the board on the screen using addressable cursor
*/
-void
+static void
makeboard(void)
{
clear();
@@ -456,7 +455,7 @@ makeboard(void)
/*
* clean up the board for another game
*/
-void
+static void
cleanupboard(void)
{
int cnt, row, col;
@@ -513,7 +512,7 @@ cleanupboard(void)
/*
* procedure to create a deck of cards
*/
-void
+static void
initdeck(struct cardtype *ideck[])
{
int i;
@@ -538,7 +537,7 @@ initdeck(struct cardtype *ideck[])
/*
* procedure to shuffle the deck
*/
-void
+static void
shuffle(struct cardtype *ideck[])
{
int i,j;
@@ -561,7 +560,7 @@ shuffle(struct cardtype *ideck[])
/*
* procedure to remove the card from the board
*/
-void
+static void
removecard(int a, int b)
{
move(b, a);
@@ -571,7 +570,7 @@ removecard(int a, int b)
/*
* procedure to print the cards on the board
*/
-void
+static void
printrank(int a, int b, const struct cardtype *cp, bool inverse)
{
move(b, a);
@@ -603,7 +602,7 @@ printrank(int a, int b, const struct cardtype *cp, bool inverse)
/*
* procedure to print out a card
*/
-void
+static void
printcard(int a, int b, const struct cardtype *cp)
{
if (cp == NIL)
@@ -628,7 +627,7 @@ printcard(int a, int b, const struct cardtype *cp)
* of another location. The pointers always point to the top
* of the piles.
*/
-void
+static void
transit(struct cardtype **source, struct cardtype **dest)
{
struct cardtype *temp;
@@ -644,7 +643,7 @@ transit(struct cardtype **source, struct cardtype **dest)
* Note that it is only called on a foundation pile at the beginning of
* the game, so the pile will have exactly one card in it.
*/
-void
+static void
fndbase(struct cardtype **cp, int column, int row)
{
bool nomore;
@@ -688,7 +687,7 @@ fndbase(struct cardtype **cp, int column, int row)
/*
* procedure to initialize the things necessary for the game
*/
-void
+static void
initgame(void)
{
int i;
@@ -734,7 +733,7 @@ initgame(void)
/*
* procedure to print the beginning cards and to start each game
*/
-void
+static void
startgame(void)
{
int j;
@@ -775,7 +774,7 @@ startgame(void)
/*
* procedure to clear the message printed from an error
*/
-void
+static void
clearmsg(void)
{
int i;
@@ -792,7 +791,7 @@ clearmsg(void)
/*
* procedure to print an error message if the move is not listed
*/
-void
+static void
dumberror(void)
{
errmsg = TRUE;
@@ -803,7 +802,7 @@ dumberror(void)
/*
* procedure to print an error message if the move is not possible
*/
-void
+static void
destinerror(void)
{
errmsg = TRUE;
@@ -814,7 +813,7 @@ destinerror(void)
/*
* function to see if the source has cards in it
*/
-bool
+static bool
notempty(const struct cardtype *cp)
{
if (cp == NIL) {
@@ -829,7 +828,7 @@ notempty(const struct cardtype *cp)
/*
* function to see if the rank of one card is less than another
*/
-bool
+static bool
ranklower(const struct cardtype *cp1, const struct cardtype *cp2)
{
if (cp2->rank == Ace)
@@ -846,7 +845,7 @@ ranklower(const struct cardtype *cp1, const struct cardtype *cp2)
/*
* function to check the cardcolor for moving to a tableau
*/
-bool
+static bool
diffcolor(const struct cardtype *cp1, const struct cardtype *cp2)
{
if (cp1->color == cp2->color)
@@ -858,7 +857,7 @@ diffcolor(const struct cardtype *cp1, const struct cardtype *cp2)
/*
* function to see if the card can move to the tableau
*/
-bool
+static bool
tabok(const struct cardtype *cp, int des)
{
if ((cp == stock) && (tableau[des] == NIL))
@@ -879,7 +878,7 @@ tabok(const struct cardtype *cp, int des)
/*
* procedure to turn the cards onto the talon from the deck
*/
-void
+static void
movetotalon(void)
{
int i, fin;
@@ -965,7 +964,7 @@ movetotalon(void)
* procedure to print card counting info on screen
*/
-void
+static void
showstat(void)
{
int row, col;
@@ -1008,7 +1007,7 @@ showstat(void)
/*
* procedure to clear card counting info from screen
*/
-void
+static void
clearstat(void)
{
int row;
@@ -1028,7 +1027,7 @@ clearstat(void)
/*
* procedure to update card counting base
*/
-void
+static void
usedtalon(void)
{
removecard(coldcol, coldrow);
@@ -1053,7 +1052,7 @@ usedtalon(void)
/*
* procedure to update stock card counting base
*/
-void
+static void
usedstock(void)
{
stockcnt--;
@@ -1066,7 +1065,7 @@ usedstock(void)
/*
* let 'em know how they lost!
*/
-void
+static void
showcards(void)
{
struct cardtype *ptr;
@@ -1114,7 +1113,7 @@ showcards(void)
/*
* procedure to update the betting values
*/
-void
+static void
updatebettinginfo(void)
{
long thiscosts, gamecosts, totalcosts;
@@ -1173,7 +1172,7 @@ updatebettinginfo(void)
/*
* procedure to move a card from the stock or talon to the tableau
*/
-void
+static void
simpletableau(struct cardtype **cp, int des)
{
int origin;
@@ -1205,7 +1204,7 @@ simpletableau(struct cardtype **cp, int des)
/*
* print the tableau
*/
-void
+static void
tabprint(int sour, int des)
{
int dlength, slength, i;
@@ -1231,7 +1230,7 @@ tabprint(int sour, int des)
/*
* procedure to move from the tableau to the tableau
*/
-void
+static void
tabtotab(int sour, int des)
{
struct cardtype *temp;
@@ -1258,7 +1257,7 @@ tabtotab(int sour, int des)
/*
* functions to see if the card can go onto the foundation
*/
-bool
+static bool
rankhigher(const struct cardtype *cp, int let)
{
if (found[let]->rank == King)
@@ -1275,7 +1274,7 @@ rankhigher(const struct cardtype *cp, int let)
/*
* function to determine if two cards are the same suit
*/
-int
+static int
samesuit(const struct cardtype *cp, int let)
{
if (cp->suit == found[let]->suit)
@@ -1287,7 +1286,7 @@ samesuit(const struct cardtype *cp, int let)
/*
* procedure to move a card to the correct foundation pile
*/
-void
+static void
movetofound(struct cardtype **cp, int source)
{
tempbase = 0;
@@ -1340,7 +1339,7 @@ movetofound(struct cardtype **cp, int source)
/*
* procedure to get a command
*/
-void
+static void
getcmd(int row, int col, const char *cp)
{
char cmd[2] = { '\0', '\0'}, ch;
@@ -1389,7 +1388,7 @@ getcmd(int row, int col, const char *cp)
/*
* Suspend the game (shell escape if no process control on system)
*/
-void
+static void
suspend(void)
{
#ifndef SIGTSTP
@@ -1411,7 +1410,7 @@ suspend(void)
/*
* procedure to evaluate and make the specific moves
*/
-void
+static void
movecard(void)
{
int source, dest;
@@ -1561,7 +1560,7 @@ movecard(void)
} while (!done);
}
-const char *const basicinstructions[] = {
+static const char *const basicinstructions[] = {
"Here are brief instructions to the game of Canfield:\n\n",
" If you have never played solitaire before, it is recom-\n",
"mended that you consult a solitaire instruction book. In\n",
@@ -1583,7 +1582,7 @@ const char *const basicinstructions[] = {
"push any key when you are finished: ",
0 };
-const char *const bettinginstructions[] = {
+static const char *const bettinginstructions[] = {
" The rules for betting are somewhat less strict than\n",
"those used in the official version of the game. The initial\n",
"deal costs $13. You may quit at this point or inspect the\n",
@@ -1608,7 +1607,7 @@ const char *const bettinginstructions[] = {
/*
* procedure to printout instructions
*/
-void
+static void
instruct(void)
{
const char *const *cp;
@@ -1644,7 +1643,7 @@ instruct(void)
/*
* procedure to initialize the game
*/
-void
+static void
initall(void)
{
int i;
@@ -1681,7 +1680,7 @@ initall(void)
/*
* procedure to end the game
*/
-bool
+static bool
finish(void)
{
int row, col;
@@ -1719,7 +1718,7 @@ finish(void)
/*
* procedure to clean up and exit
*/
-void
+static void
cleanup(int dummy __unused)
{
@@ -1742,7 +1741,7 @@ cleanup(int dummy __unused)
/*
* Field an interrupt.
*/
-void
+static void
askquit(int dummy __unused)
{
move(msgrow, msgcol);
diff --git a/canfield/cfscores/cfscores.c b/canfield/cfscores/cfscores.c
index 14725bae..2fc41738 100644
--- a/canfield/cfscores/cfscores.c
+++ b/canfield/cfscores/cfscores.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cfscores.c,v 1.15 2008/07/20 01:03:21 lukem Exp $ */
+/* $NetBSD: cfscores.c,v 1.16 2009/08/12 05:35:44 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
#if 0
static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: cfscores.c,v 1.15 2008/07/20 01:03:21 lukem Exp $");
+__RCSID("$NetBSD: cfscores.c,v 1.16 2009/08/12 05:35:44 dholland Exp $");
#endif
#endif /* not lint */
@@ -64,9 +64,9 @@ struct betinfo {
long worth; /* net worth after costs */
};
-int dbfd;
+static int dbfd;
-void printuser(const struct passwd *, int);
+static void printuser(const struct passwd *, int);
int
main(int argc, char *argv[])
@@ -112,7 +112,7 @@ main(int argc, char *argv[])
/*
* print out info for specified password entry
*/
-void
+static void
printuser(const struct passwd *pw, int printfail)
{
struct betinfo total;