-/* $NetBSD: fish.c,v 1.17 2005/07/02 08:38:24 jmc Exp $ */
+/* $NetBSD: fish.c,v 1.20 2009/08/12 05:55:53 dholland Exp $ */
/*-
* Copyright (c) 1990, 1993
#include <sys/cdefs.h>
#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\
- The Regents of the University of California. All rights reserved.\n");
+__COPYRIGHT("@(#) Copyright (c) 1990, 1993\
+ The Regents of the University of California. All rights reserved.");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: fish.c,v 1.17 2005/07/02 08:38:24 jmc Exp $");
+__RCSID("$NetBSD: fish.c,v 1.20 2009/08/12 05:55:53 dholland Exp $");
#endif
#endif /* not lint */
#define COMPUTER 0
#define OTHER(a) (1 - (a))
-const char *const cards[] = {
+static const char *const cards[] = {
"A", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "J", "Q", "K", NULL,
};
#define PRC(card) (void)printf(" %s", cards[card])
-int promode;
-int asked[RANKS], comphand[RANKS], deck[TOTCARDS];
-int userasked[RANKS], userhand[RANKS];
-int curcard = TOTCARDS;
-
-void chkwinner(int, const int *);
-int compmove(void);
-int countbooks(const int *);
-int countcards(const int *);
-int drawcard(int, int *);
-int gofish(int, int, int *);
-void goodmove(int, int, int *, int *);
-void init(void);
-void instructions(void);
-int nrandom(int);
-void printhand(const int *);
-void printplayer(int);
-int promove(void);
-void usage(void) __attribute__((__noreturn__));
-int usermove(void);
+static int promode;
+static int asked[RANKS], comphand[RANKS], deck[TOTCARDS];
+static int userasked[RANKS], userhand[RANKS];
+static int curcard = TOTCARDS;
+
+static void chkwinner(int, const int *);
+static int compmove(void);
+static int countbooks(const int *);
+static int countcards(const int *);
+static int drawcard(int, int *);
+static int gofish(int, int, int *);
+static void goodmove(int, int, int *, int *);
+static void init(void);
+static void instructions(void);
+static int nrandom(int);
+static void printhand(const int *);
+static void printplayer(int);
+static int promove(void);
+static void usage(void) __dead;
+static int usermove(void);
int
main(int argc, char **argv)
/* NOTREACHED */
}
-int
+static int
usermove(void)
{
int n;
/* NOTREACHED */
}
-int
+static int
compmove(void)
{
static int lmove;
return(lmove);
}
-int
+static int
promove(void)
{
int i, max;
/* NOTREACHED */
}
-int
+static int
drawcard(int player, int *hand)
{
int card;
return(card);
}
-int
+static int
gofish(int askedfor, int player, int *hand)
{
printplayer(OTHER(player));
return(0);
}
-void
+static void
goodmove(int player, int move, int *hand, int *opphand)
{
printplayer(OTHER(player));
(void)printf("get another guess!\n");
}
-void
+static void
chkwinner(int player, const int *hand)
{
int cb, i, ub;
exit(0);
}
-void
+static void
printplayer(int player)
{
switch (player) {
}
}
-void
+static void
printhand(const int *hand)
{
int book, i, j;
(void)putchar('\n');
}
-int
+static int
countcards(const int *hand)
{
int i, count;
return(count);
}
-int
+static int
countbooks(const int *hand)
{
int i, count;
return(count);
}
-void
+static void
init(void)
{
int i, j, temp;
}
}
-int
+static int
nrandom(int n)
{
return((int)random() % n);
}
-void
+static void
instructions(void)
{
int input;
while ((input = getchar()) != EOF && input != '\n');
}
-void
+static void
usage(void)
{
(void)fprintf(stderr, "usage: fish [-p]\n");