Module Name:    src
Committed By:   dholland
Date:           Wed Aug 12 05:48:05 UTC 2009

Modified Files:
        src/games/cribbage: cards.c crib.c cribbage.h io.c score.c support.c

Log Message:
sprinkle static


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/games/cribbage/cards.c
cvs rdiff -u -r1.23 -r1.24 src/games/cribbage/crib.c src/games/cribbage/io.c
cvs rdiff -u -r1.14 -r1.15 src/games/cribbage/cribbage.h \
    src/games/cribbage/score.c
cvs rdiff -u -r1.13 -r1.14 src/games/cribbage/support.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/cribbage/cards.c
diff -u src/games/cribbage/cards.c:1.8 src/games/cribbage/cards.c:1.9
--- src/games/cribbage/cards.c:1.8	Sat Jul  2 08:32:32 2005
+++ src/games/cribbage/cards.c	Wed Aug 12 05:48:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cards.c,v 1.8 2005/07/02 08:32:32 jmc Exp $	*/
+/*	$NetBSD: cards.c,v 1.9 2009/08/12 05:48:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)cards.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: cards.c,v 1.8 2005/07/02 08:32:32 jmc Exp $");
+__RCSID("$NetBSD: cards.c,v 1.9 2009/08/12 05:48:04 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -87,7 +87,7 @@
 /*
  * return true if the two cards are equal...
  */
-int
+static int
 eq(CARD a, CARD b)
 {
 	return ((a.rank == b.rank) && (a.suit == b.suit));

Index: src/games/cribbage/crib.c
diff -u src/games/cribbage/crib.c:1.23 src/games/cribbage/crib.c:1.24
--- src/games/cribbage/crib.c:1.23	Mon Jul 13 19:05:40 2009
+++ src/games/cribbage/crib.c	Wed Aug 12 05:48:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: crib.c,v 1.23 2009/07/13 19:05:40 roy Exp $	*/
+/*	$NetBSD: crib.c,v 1.24 2009/08/12 05:48:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)crib.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: crib.c,v 1.23 2009/07/13 19:05:40 roy Exp $");
+__RCSID("$NetBSD: crib.c,v 1.24 2009/08/12 05:48:04 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -56,6 +56,18 @@
 #include "cribcur.h"
 #include "pathnames.h"
 
+static void makeboard(void);
+static void gamescore(void);
+static void game(void);
+static int playhand(BOOLEAN);
+static int deal(BOOLEAN);
+static void discard(BOOLEAN);
+static int cut(BOOLEAN, int);
+static void prcrib(BOOLEAN, BOOLEAN);
+static int peg(BOOLEAN);
+static void prtable(int);
+static int score(BOOLEAN);
+
 int
 main(int argc, char *argv[])
 {
@@ -158,7 +170,7 @@
  * makeboard:
  *	Print out the initial board on the screen
  */
-void
+static void
 makeboard(void)
 {
 	mvaddstr(SCORE_Y + 0, SCORE_X,
@@ -186,7 +198,7 @@
  * gamescore:
  *	Print out the current game score
  */
-void
+static void
 gamescore(void)
 {
 	if (pgames || cgames) {
@@ -202,7 +214,7 @@
  *	Play one game up to glimit points.  Actually, we only ASK the
  *	player what card to turn.  We do a random one, anyway.
  */
-void
+static void
 game(void)
 {
 	int i, j;
@@ -296,7 +308,7 @@
  * playhand:
  *	Do up one hand of the game
  */
-int
+static int
 playhand(BOOLEAN mycrib)
 {
 	int deckpos;
@@ -327,7 +339,7 @@
 /*
  * deal cards to both players from deck
  */
-int
+static int
 deal(BOOLEAN mycrib)
 {
 	int i, j;
@@ -349,7 +361,7 @@
  *	Handle players discarding into the crib...
  * Note: we call cdiscard() after prining first message so player doesn't wait
  */
-void
+static void
 discard(BOOLEAN mycrib)
 {
 	const char *prompt;
@@ -378,7 +390,7 @@
  *	Cut the deck and set turnover.  Actually, we only ASK the
  *	player what card to turn.  We do a random one, anyway.
  */
-int
+static int
 cut(BOOLEAN mycrib, int  pos)
 {
 	int i;
@@ -420,7 +432,7 @@
  * prcrib:
  *	Print out the turnover card with crib indicator
  */
-void
+static void
 prcrib(BOOLEAN mycrib, BOOLEAN blank)
 {
 	int y, cardx;
@@ -450,7 +462,7 @@
 static CARD Table[14];
 static int Tcnt;
 
-int
+static int
 peg(BOOLEAN mycrib)
 {
 	static CARD ch[CINHAND], ph[CINHAND];
@@ -609,7 +621,7 @@
  * prtable:
  *	Print out the table with the current score
  */
-void
+static void
 prtable(int curscore)
 {
 	prhand(Table, Tcnt, Tablewin, FALSE);
@@ -621,7 +633,7 @@
  * score:
  *	Handle the scoring of the hands
  */
-int
+static int
 score(BOOLEAN mycrib)
 {
 	sorthand(crib, CINHAND);
Index: src/games/cribbage/io.c
diff -u src/games/cribbage/io.c:1.23 src/games/cribbage/io.c:1.24
--- src/games/cribbage/io.c:1.23	Mon Jul 13 19:05:40 2009
+++ src/games/cribbage/io.c	Wed Aug 12 05:48:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.23 2009/07/13 19:05:40 roy Exp $	*/
+/*	$NetBSD: io.c,v 1.24 2009/08/12 05:48:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)io.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: io.c,v 1.23 2009/07/13 19:05:40 roy Exp $");
+__RCSID("$NetBSD: io.c,v 1.24 2009/08/12 05:48:04 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -58,20 +58,28 @@
 #endif
 #define	CTRL(X)			(X - 'A' + 1)
 
-char    linebuf[LINESIZE];
+static int msgcrd(CARD, BOOLEAN, const char *, BOOLEAN);
+static void printcard(WINDOW *, int, CARD, BOOLEAN);
+static int incard(CARD *);
+static void wait_for(int);
+static int readchar(void);
 
-const char   *const rankname[RANKS] = {
+static char linebuf[LINESIZE];
+
+static const char *const rankname[RANKS] = {
 	"ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN",
 	"EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING"
 };
 
-const char   *const rankchar[RANKS] = {
+static const char *const rankchar[RANKS] = {
 	"A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"
 };
 
-const char *const suitname[SUITS] = {"SPADES", "HEARTS", "DIAMONDS", "CLUBS"};
+static const char *const suitname[SUITS] = {
+	"SPADES", "HEARTS", "DIAMONDS", "CLUBS"
+};
 
-const char   *const suitchar[SUITS] = {"S", "H", "D", "C"};
+static const char *const suitchar[SUITS] = {"S", "H", "D", "C"};
 
 /*
  * msgcard:
@@ -92,7 +100,7 @@
  * msgcrd:
  *	Print the value of a card in ascii
  */
-int
+static int
 msgcrd(CARD c, BOOLEAN brfrank, const char *mid, BOOLEAN brfsuit)
 {
 	if (c.rank == EMPTY || c.suit == EMPTY)
@@ -114,7 +122,7 @@
  * printcard:
  *	Print out a card.
  */
-void
+static void
 printcard(WINDOW *win, int cardno, CARD c, BOOLEAN blank)
 {
 	prcard(win, cardno * 2, cardno, c, blank);
@@ -216,7 +224,7 @@
  *	Inputs a card in any format.  It reads a line ending with a CR
  *	and then parses it.
  */
-int
+static int
 incard(CARD *crd)
 {
 	int i;
@@ -357,8 +365,8 @@
  * msg:
  *	Display a message at the top of the screen.
  */
-char    Msgbuf[BUFSIZ] = {'\0'};
-int     Mpos = 0;
+static char Msgbuf[BUFSIZ] = {'\0'};
+static int Mpos = 0;
 static int Newpos = 0;
 
 void
@@ -392,7 +400,7 @@
  * endmsg:
  *	Display a new msg.
  */
-int     Lineno = 0;
+static int Lineno = 0;
 
 void
 endmsg(void)
@@ -465,7 +473,7 @@
  * wait_for
  *	Sit around until the guy types the right key
  */
-void
+static void
 wait_for(int ch)
 {
 	int c;
@@ -482,7 +490,7 @@
  * readchar:
  *	Reads and returns a character, checking for gross input errors
  */
-int
+static int
 readchar(void)
 {
 	int cnt;

Index: src/games/cribbage/cribbage.h
diff -u src/games/cribbage/cribbage.h:1.14 src/games/cribbage/cribbage.h:1.15
--- src/games/cribbage/cribbage.h:1.14	Mon Jul 13 19:05:40 2009
+++ src/games/cribbage/cribbage.h	Wed Aug 12 05:48:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cribbage.h,v 1.14 2009/07/13 19:05:40 roy Exp $	*/
+/*	$NetBSD: cribbage.h,v 1.15 2009/08/12 05:48:04 dholland Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -60,52 +60,30 @@
     __attribute__((__format__(__printf__, 1, 2)));
 int	 adjust(const CARD [], CARD);
 int	 anymove(const CARD [], int, int);
-int	 anysumto(const CARD [], int, int, int);
 void	 bye(void);
 int	 cchose(const CARD [], int, int);
 void	 cdiscard(BOOLEAN);
 int	 chkscr(int *, int);
 int	 comphand(const CARD [], const char *);
 void	 cremove(CARD, CARD [], int);
-int	 cut(BOOLEAN, int);
-int	 deal(BOOLEAN);
-void	 discard(BOOLEAN);
 void	 do_wait(void);
 void	 endmsg(void);
-int	 eq(CARD, CARD);
-int	 fifteens(const CARD [], int);
-void	 game(void);
-void	 gamescore(void);
 char	*get_line(void);
 int	 getuchar(void);
-int	 incard(CARD *);
 int	 infrom(const CARD [], int, const char *);
 void	 instructions(void);
 int	 is_one(CARD, const CARD [], int);
-void	 makeboard(void);
 void	 makedeck(CARD []);
 void	 makeknown(const CARD [], int);
 void	 msg(const char *, ...)
     __attribute__((__format__(__printf__, 1, 2)));
 int	 msgcard(CARD, BOOLEAN);
-int	 msgcrd(CARD, BOOLEAN, const char *, BOOLEAN);
 int	 number(int, int, const char *);
-int	 numofval(const CARD [], int, int);
-int	 pairuns(const CARD [], int);
-int	 peg(BOOLEAN);
 int	 pegscore(CARD, const CARD [], int, int);
-int	 playhand(BOOLEAN);
 int	 plyrhand(const CARD [], const char *);
 void	 prcard(WINDOW *, int, int, CARD, BOOLEAN);
-void	 prcrib(BOOLEAN, BOOLEAN);
 void	 prhand(const CARD [], int, WINDOW *, BOOLEAN);
-void	 printcard(WINDOW *, int, CARD, BOOLEAN);
-void	 prpeg(int, int, BOOLEAN);
-void	 prtable(int);
-int	 readchar(void);
 void	 receive_intr(int) __attribute__((__noreturn__));
-int	 score(BOOLEAN);
 int	 scorehand(const CARD [], CARD, int, BOOLEAN, BOOLEAN);
 void	 shuffle(CARD []);
 void	 sorthand(CARD [], int);
-void	 wait_for(int);
Index: src/games/cribbage/score.c
diff -u src/games/cribbage/score.c:1.14 src/games/cribbage/score.c:1.15
--- src/games/cribbage/score.c:1.14	Thu Jun  4 04:48:04 2009
+++ src/games/cribbage/score.c	Wed Aug 12 05:48:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: score.c,v 1.14 2009/06/04 04:48:04 dholland Exp $	*/
+/*	$NetBSD: score.c,v 1.15 2009/08/12 05:48:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)score.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: score.c,v 1.14 2009/06/04 04:48:04 dholland Exp $");
+__RCSID("$NetBSD: score.c,v 1.15 2009/08/12 05:48:04 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -46,13 +46,16 @@
 #include "deck.h"
 #include "cribbage.h"
 
+static int fifteens(const CARD [], int);
+static int pairuns(const CARD [], int);
+
 /*
  * the following arrays give the sum of the scores of the (50 2)*48 = 58800
  * hands obtainable for the crib given the two cards whose ranks index the
  * array.  the two arrays are for the case where the suits are equal and
  * not equal respectively
  */
-const long crbescr[169] = {
+static const long crbescr[169] = {
     -10000, 271827, 278883, 332319, 347769, 261129, 250653, 253203, 248259,
     243435, 256275, 237435, 231051, -10000, -10000, 412815, 295707, 349497,
     267519, 262521, 259695, 254019, 250047, 262887, 244047, 237663, -10000,
@@ -74,7 +77,7 @@
     -10000, -10000, -10000, -10000, -10000, -10000, -10000
 };
 
-const long crbnescr[169] = {
+static const long crbnescr[169] = {
     325272, 260772, 267828, 321264, 336714, 250074, 239598, 242148, 237204,
     232380, 246348, 226380, 219996, -10000, 342528, 401760, 284652, 338442,
     256464, 251466, 248640, 242964, 238992, 252960, 232992, 226608, -10000,
@@ -177,7 +180,7 @@
  * fifteens:
  *	Return number of fifteens in hand of n cards
  */
-int
+static int
 fifteens(const CARD hand[], int n)
 {
 	int *sp, *np;
@@ -218,7 +221,7 @@
  * this routine only works if n is strictly less than 6
  * sets the globals pairpoints and runpoints appropriately
  */
-int
+static int
 pairuns(const CARD h[], int n)
 {
 	int i;

Index: src/games/cribbage/support.c
diff -u src/games/cribbage/support.c:1.13 src/games/cribbage/support.c:1.14
--- src/games/cribbage/support.c:1.13	Thu Jun  4 04:48:04 2009
+++ src/games/cribbage/support.c	Wed Aug 12 05:48:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: support.c,v 1.13 2009/06/04 04:48:04 dholland Exp $	*/
+/*	$NetBSD: support.c,v 1.14 2009/08/12 05:48:04 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)support.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: support.c,v 1.13 2009/06/04 04:48:04 dholland Exp $");
+__RCSID("$NetBSD: support.c,v 1.14 2009/08/12 05:48:04 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,7 +49,11 @@
 #define	NTV	10		/* number scores to test */
 
 /* score to test reachability of, and order to test them in */
-const int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
+static const int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
+
+static int anysumto(const CARD[], int, int, int);
+static void prpeg(int, int, BOOLEAN);
+static int numofval(const CARD[], int, int);
 
 /*
  * computer chooses what to play in pegging...
@@ -199,7 +203,7 @@
  *	Put out the peg character on the score board and put the
  *	score up on the board.
  */
-void
+static void
 prpeg(int curscore, int pegc, BOOLEAN myturn)
 {
 	int y, x;
@@ -306,7 +310,7 @@
  * anysumto returns the index (0 <= i < n) of the card in hand that brings
  * the s up to t, or -1 if there is none
  */
-int
+static int
 anysumto(const CARD hand[], int n, int s, int t)
 {
 	int i;
@@ -321,7 +325,7 @@
 /*
  * return the number of cards in h having the given rank value
  */
-int
+static int
 numofval(const CARD h[], int n, int v)
 {
 	int i, j;

Reply via email to