summaryrefslogtreecommitdiffstats
path: root/cribbage
diff options
context:
space:
mode:
Diffstat (limited to 'cribbage')
-rw-r--r--cribbage/cards.c7
-rw-r--r--cribbage/crib.c6
-rw-r--r--cribbage/cribbage.h36
-rw-r--r--cribbage/io.c24
-rw-r--r--cribbage/score.c24
-rw-r--r--cribbage/support.c24
6 files changed, 62 insertions, 59 deletions
diff --git a/cribbage/cards.c b/cribbage/cards.c
index e6c52628..c4d2610f 100644
--- a/cribbage/cards.c
+++ b/cribbage/cards.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cards.c,v 1.4 1997/10/10 12:32:22 lukem Exp $ */
+/* $NetBSD: cards.c,v 1.5 1999/09/08 21:17:47 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: cards.c,v 1.4 1997/10/10 12:32:22 lukem Exp $");
+__RCSID("$NetBSD: cards.c,v 1.5 1999/09/08 21:17:47 jsm Exp $");
#endif
#endif /* not lint */
@@ -105,7 +105,8 @@ eq(a, b)
*/
int
isone(a, b, n)
- CARD a, b[];
+ CARD a;
+ const CARD b[];
int n;
{
int i;
diff --git a/cribbage/crib.c b/cribbage/crib.c
index e7d9ce3d..83a9e422 100644
--- a/cribbage/crib.c
+++ b/cribbage/crib.c
@@ -1,4 +1,4 @@
-/* $NetBSD: crib.c,v 1.10 1998/08/30 09:19:37 veego Exp $ */
+/* $NetBSD: crib.c,v 1.11 1999/09/08 21:17:47 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: crib.c,v 1.10 1998/08/30 09:19:37 veego Exp $");
+__RCSID("$NetBSD: crib.c,v 1.11 1999/09/08 21:17:47 jsm Exp $");
#endif
#endif /* not lint */
@@ -343,7 +343,7 @@ void
discard(mycrib)
BOOLEAN mycrib;
{
- char *prompt;
+ const char *prompt;
CARD crd;
prcrib(mycrib, TRUE);
diff --git a/cribbage/cribbage.h b/cribbage/cribbage.h
index a28b4b06..51dd3764 100644
--- a/cribbage/cribbage.h
+++ b/cribbage/cribbage.h
@@ -1,4 +1,4 @@
-/* $NetBSD: cribbage.h,v 1.4 1998/09/13 15:27:27 hubertf Exp $ */
+/* $NetBSD: cribbage.h,v 1.5 1999/09/08 21:17:47 jsm Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -62,14 +62,14 @@ extern BOOLEAN playing; /* currently playing game */
extern char expl[]; /* string for explanation */
void addmsg __P((const char *, ...));
-int adjust __P((CARD [], CARD));
-int anymove __P((CARD [], int, int));
-int anysumto __P((CARD [], int, int, int));
+int adjust __P((const CARD [], CARD));
+int anymove __P((const CARD [], int, int));
+int anysumto __P((const CARD [], int, int, int));
void bye __P((void));
-int cchose __P((CARD [], int, int));
+int cchose __P((const CARD [], int, int));
void cdiscard __P((BOOLEAN));
int chkscr __P((int *, int));
-int comphand __P((CARD [], char *));
+int comphand __P((const CARD [], const char *));
void cremove __P((CARD, CARD [], int));
int cut __P((BOOLEAN, int));
int deal __P((int));
@@ -77,38 +77,38 @@ void discard __P((BOOLEAN));
void do_wait __P((void));
void endmsg __P((void));
int eq __P((CARD, CARD));
-int fifteens __P((CARD [], int));
+int fifteens __P((const CARD [], int));
void game __P((void));
void gamescore __P((void));
char *getline __P((void));
int getuchar __P((void));
int incard __P((CARD *));
-int infrom __P((CARD [], int, char *));
+int infrom __P((const CARD [], int, const char *));
void instructions __P((void));
-int isone __P((CARD, CARD [], int));
+int is_one __P((CARD, const CARD [], int));
void makeboard __P((void));
void makedeck __P((CARD []));
-void makeknown __P((CARD [], int));
+void makeknown __P((const CARD [], int));
void msg __P((const char *, ...));
int msgcard __P((CARD, BOOLEAN));
-int msgcrd __P((CARD, BOOLEAN, char *, BOOLEAN));
-int number __P((int, int, char *));
-int numofval __P((CARD [], int, int));
-int pairuns __P((CARD [], int));
+int msgcrd __P((CARD, BOOLEAN, const char *, BOOLEAN));
+int number __P((int, int, const char *));
+int numofval __P((const CARD [], int, int));
+int pairuns __P((const CARD [], int));
int peg __P((BOOLEAN));
-int pegscore __P((CARD, CARD [], int, int));
+int pegscore __P((CARD, const CARD [], int, int));
int playhand __P((BOOLEAN));
-int plyrhand __P((CARD [], char *));
+int plyrhand __P((const CARD [], const char *));
void prcard __P((WINDOW *, int, int, CARD, BOOLEAN));
void prcrib __P((BOOLEAN, BOOLEAN));
-void prhand __P((CARD [], int, WINDOW *, BOOLEAN));
+void prhand __P((const CARD [], int, WINDOW *, BOOLEAN));
void printcard __P((WINDOW *, int, CARD, BOOLEAN));
void prpeg __P((int, int, BOOLEAN));
void prtable __P((int));
int readchar __P((void));
void rint __P((int)) __attribute__((__noreturn__));
int score __P((BOOLEAN));
-int scorehand __P((CARD [], CARD, int, BOOLEAN, BOOLEAN));
+int scorehand __P((const CARD [], CARD, int, BOOLEAN, BOOLEAN));
void shuffle __P((CARD []));
void sorthand __P((CARD [], int));
void wait_for __P((int));
diff --git a/cribbage/io.c b/cribbage/io.c
index f73fc097..56278b77 100644
--- a/cribbage/io.c
+++ b/cribbage/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.10 1997/10/10 12:32:32 lukem Exp $ */
+/* $NetBSD: io.c,v 1.11 1999/09/08 21:17:47 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: io.c,v 1.10 1997/10/10 12:32:32 lukem Exp $");
+__RCSID("$NetBSD: io.c,v 1.11 1999/09/08 21:17:47 jsm Exp $");
#endif
#endif /* not lint */
@@ -69,18 +69,18 @@ __RCSID("$NetBSD: io.c,v 1.10 1997/10/10 12:32:32 lukem Exp $");
char linebuf[LINESIZE];
-char *rankname[RANKS] = {
+const char *const rankname[RANKS] = {
"ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN",
"EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING"
};
-char *rankchar[RANKS] = {
+const char *const rankchar[RANKS] = {
"A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"
};
-char *suitname[SUITS] = {"SPADES", "HEARTS", "DIAMONDS", "CLUBS"};
+const char *const suitname[SUITS] = {"SPADES", "HEARTS", "DIAMONDS", "CLUBS"};
-char *suitchar[SUITS] = {"S", "H", "D", "C"};
+const char *const suitchar[SUITS] = {"S", "H", "D", "C"};
/*
* msgcard:
@@ -105,7 +105,7 @@ int
msgcrd(c, brfrank, mid, brfsuit)
CARD c;
BOOLEAN brfrank, brfsuit;
- char *mid;
+ const char *mid;
{
if (c.rank == EMPTY || c.suit == EMPTY)
return (FALSE);
@@ -169,7 +169,7 @@ prcard(win, y, x, c, blank)
*/
void
prhand(h, n, win, blank)
- CARD h[];
+ const CARD h[];
int n;
WINDOW *win;
BOOLEAN blank;
@@ -189,9 +189,9 @@ prhand(h, n, win, blank)
*/
int
infrom(hand, n, prompt)
- CARD hand[];
+ const CARD hand[];
int n;
- char *prompt;
+ const char *prompt;
{
int i, j;
CARD crd;
@@ -348,7 +348,7 @@ getuchar()
int
number(lo, hi, prompt)
int lo, hi;
- char *prompt;
+ const char *prompt;
{
char *p;
int sum;
@@ -496,7 +496,7 @@ endmsg()
void
do_wait()
{
- static char prompt[] = {'-', '-', 'M', 'o', 'r', 'e', '-', '-', '\0'};
+ static const char prompt[] = {'-', '-', 'M', 'o', 'r', 'e', '-', '-', '\0'};
if (Mpos + sizeof prompt < MSG_X)
wmove(Msgwin, Lineno > 0 ? Lineno - 1 : MSG_Y - 1, Mpos);
diff --git a/cribbage/score.c b/cribbage/score.c
index 69c38a7f..00c8bb49 100644
--- a/cribbage/score.c
+++ b/cribbage/score.c
@@ -1,4 +1,4 @@
-/* $NetBSD: score.c,v 1.6 1998/08/30 09:19:37 veego Exp $ */
+/* $NetBSD: score.c,v 1.7 1999/09/08 21:17:47 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: score.c,v 1.6 1998/08/30 09:19:37 veego Exp $");
+__RCSID("$NetBSD: score.c,v 1.7 1999/09/08 21:17:47 jsm Exp $");
#endif
#endif /* not lint */
@@ -56,7 +56,7 @@ __RCSID("$NetBSD: score.c,v 1.6 1998/08/30 09:19:37 veego Exp $");
* array. the two arrays are for the case where the suits are equal and
* not equal respectively
*/
-long crbescr[169] = {
+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,
@@ -78,7 +78,7 @@ long crbescr[169] = {
-10000, -10000, -10000, -10000, -10000, -10000, -10000
};
-long crbnescr[169] = {
+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,
@@ -100,7 +100,7 @@ long crbnescr[169] = {
-10000, -10000, -10000, -10000, -10000, -10000, 295896
};
-static int ichoose2[5] = { 0, 0, 2, 6, 12 };
+static const int ichoose2[5] = { 0, 0, 2, 6, 12 };
static int pairpoints, runpoints; /* Globals from pairuns. */
/*
@@ -110,7 +110,7 @@ static int pairpoints, runpoints; /* Globals from pairuns. */
*/
int
scorehand(hand, starter, n, crb, do_explain)
- CARD hand[];
+ const CARD hand[];
CARD starter;
int n;
BOOLEAN crb; /* true if scoring crib */
@@ -185,12 +185,12 @@ scorehand(hand, starter, n, crb, do_explain)
*/
int
fifteens(hand, n)
- CARD hand[];
+ const CARD hand[];
int n;
{
int *sp, *np;
int i;
- CARD *endp;
+ const CARD *endp;
static int sums[15], nsums[15];
np = nsums;
@@ -228,7 +228,7 @@ fifteens(hand, n)
*/
int
pairuns(h, n)
- CARD h[];
+ const CARD h[];
int n;
{
int i;
@@ -297,7 +297,8 @@ pairuns(h, n)
*/
int
pegscore(crd, tbl, n, sum)
- CARD crd, tbl[];
+ CARD crd;
+ const CARD tbl[];
int n, sum;
{
BOOLEAN got[RANKS];
@@ -352,7 +353,8 @@ pegscore(crd, tbl, n, sum)
*/
int
adjust(cb, tnv)
- CARD cb[], tnv;
+ const CARD cb[];
+ CARD tnv;
{
long scr;
int i, c0, c1;
diff --git a/cribbage/support.c b/cribbage/support.c
index 96ea67ad..2f3c076a 100644
--- a/cribbage/support.c
+++ b/cribbage/support.c
@@ -1,4 +1,4 @@
-/* $NetBSD: support.c,v 1.4 1997/10/10 12:32:36 lukem Exp $ */
+/* $NetBSD: support.c,v 1.5 1999/09/08 21:17:47 jsm Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: support.c,v 1.4 1997/10/10 12:32:36 lukem Exp $");
+__RCSID("$NetBSD: support.c,v 1.5 1999/09/08 21:17:47 jsm Exp $");
#endif
#endif /* not lint */
@@ -52,7 +52,7 @@ __RCSID("$NetBSD: support.c,v 1.4 1997/10/10 12:32:36 lukem Exp $");
#define NTV 10 /* number scores to test */
/* score to test reachability of, and order to test them in */
-int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
+const int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
/*
* computer chooses what to play in pegging...
@@ -60,7 +60,7 @@ int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
*/
int
cchose(h, n, s)
- CARD h[];
+ const CARD h[];
int n, s;
{
int i, j, l;
@@ -129,8 +129,8 @@ cchose(h, n, s)
*/
int
plyrhand(hand, s)
- CARD hand[];
- char *s;
+ const CARD hand[];
+ const char *s;
{
static char prompt[BUFSIZ];
int i, j;
@@ -165,8 +165,8 @@ plyrhand(hand, s)
*/
int
comphand(h, s)
- CARD h[];
- char *s;
+ const CARD h[];
+ const char *s;
{
int j;
@@ -299,7 +299,7 @@ cdiscard(mycrib)
*/
int
anymove(hand, n, sum)
- CARD hand[];
+ const CARD hand[];
int n, sum;
{
int i, j;
@@ -320,7 +320,7 @@ anymove(hand, n, sum)
*/
int
anysumto(hand, n, s, t)
- CARD hand[];
+ const CARD hand[];
int n, s, t;
{
int i;
@@ -337,7 +337,7 @@ anysumto(hand, n, s, t)
*/
int
numofval(h, n, v)
- CARD h[];
+ const CARD h[];
int n, v;
{
int i, j;
@@ -355,7 +355,7 @@ numofval(h, n, v)
*/
void
makeknown(h, n)
- CARD h[];
+ const CARD h[];
int n;
{
int i;