summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--canfield/canfield/canfield.66
-rw-r--r--canfield/canfield/canfield.c145
-rw-r--r--canfield/cfscores/cfscores.c40
-rw-r--r--cribbage/cards.c19
-rw-r--r--cribbage/crib.c36
-rw-r--r--cribbage/cribbage.610
-rw-r--r--cribbage/extern.c5
-rw-r--r--cribbage/instr.c5
-rw-r--r--cribbage/io.c35
-rw-r--r--cribbage/score.c25
-rw-r--r--cribbage/support.c31
11 files changed, 242 insertions, 115 deletions
diff --git a/canfield/canfield/canfield.6 b/canfield/canfield/canfield.6
index 17b34ae3..f1d6bc45 100644
--- a/canfield/canfield/canfield.6
+++ b/canfield/canfield/canfield.6
@@ -1,4 +1,4 @@
-.\" $NetBSD: canfield.6,v 1.4 1995/03/21 15:08:30 cgd Exp $
+.\" $NetBSD: canfield.6,v 1.5 1997/10/10 12:26:34 lukem Exp $
.\"
.\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -41,7 +41,7 @@
.Nm cfscores
.Nd the solitaire card game canfield
.Sh SYNOPSIS
-.Nm canfield
+.Nm
.Nm cfscores
.Op Fl a
.Op Ar user
@@ -71,7 +71,7 @@ available.
The command
.Sq Ic c
causes
-.Nm canfield
+.Nm
to maintain card counting statistics
on the bottom of the screen.
When properly used this can greatly increase one's chances of
diff --git a/canfield/canfield/canfield.c b/canfield/canfield/canfield.c
index 406b698d..0f684d39 100644
--- a/canfield/canfield/canfield.c
+++ b/canfield/canfield/canfield.c
@@ -1,4 +1,4 @@
-/* $NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $ */
+/* $NetBSD: canfield.c,v 1.8 1997/10/10 12:26:39 lukem Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $";
+__RCSID("$NetBSD: canfield.c,v 1.8 1997/10/10 12:26:39 lukem Exp $");
#endif
#endif /* not lint */
@@ -60,12 +60,15 @@ static char rcsid[] = "$NetBSD: canfield.c,v 1.7 1995/05/13 07:28:35 jtc Exp $";
#include <sys/types.h>
-#include <curses.h>
-#include <termios.h>
#include <ctype.h>
+#include <curses.h>
+#include <fcntl.h>
#include <signal.h>
+#include <stdlib.h>
#include <string.h>
#include <termios.h>
+#include <termios.h>
+#include <unistd.h>
#include "pathnames.h"
@@ -199,6 +202,54 @@ bool startedgame = FALSE, infullgame = FALSE;
time_t acctstart;
int dbfd = -1;
+void askquit __P((int));
+void cleanup __P((int));
+void cleanupboard __P((void));
+void clearabovemovebox __P((void));
+void clearbelowmovebox __P((void));
+void clearmsg __P((void));
+void clearstat __P((void));
+void destinerror __P((void));
+bool diffcolor __P((struct cardtype *, struct cardtype *));
+void dumberror __P((void));
+bool finish __P((void));
+void fndbase __P((struct cardtype **, int, int));
+void getcmd __P((int, int, char *));
+void initall __P((void));
+void initdeck __P((struct cardtype *[]));
+void initgame __P((void));
+void instruct __P((void));
+int main __P((int, char *[]));
+void makeboard __P((void));
+void movebox __P((void));
+void movecard __P((void));
+void movetofound __P((struct cardtype **, int));
+void movetotalon __P((void));
+bool notempty __P((struct cardtype *));
+void printbottombettingbox __P((void));
+void printbottominstructions __P((void));
+void printcard __P((int, int, struct cardtype *));
+void printrank __P((int, int, struct cardtype *, bool));
+void printtopbettingbox __P((void));
+void printtopinstructions __P((void));
+bool rankhigher __P((struct cardtype *, int));
+bool ranklower __P((struct cardtype *, struct cardtype *));
+void removecard __P((int, int));
+int samesuit __P((struct cardtype *, int));
+void showcards __P((void));
+void showstat __P((void));
+void shuffle __P((struct cardtype *[]));
+void simpletableau __P((struct cardtype **, int));
+void startgame __P((void));
+void suspend __P((void));
+bool tabok __P((struct cardtype *, int));
+void tabprint __P((int, int));
+void tabtotab __P((int, int));
+void transit __P((struct cardtype **, struct cardtype **));
+void updatebettinginfo __P((void));
+void usedstock __P((void));
+void usedtalon __P((void));
+
/*
* The following procedures print the board onto the screen using the
* addressible cursor. The end of these procedures will also be
@@ -206,6 +257,7 @@ int dbfd = -1;
*
* procedure to set the move command box
*/
+void
movebox()
{
switch (status) {
@@ -240,6 +292,7 @@ movebox()
/*
* print directions above move box
*/
+void
printtopinstructions()
{
move(tboxrow, boxcol);
@@ -273,6 +326,7 @@ printtopinstructions()
/*
* Print the betting box.
*/
+void
printtopbettingbox()
{
@@ -307,6 +361,7 @@ printtopbettingbox()
/*
* clear info above move box
*/
+void
clearabovemovebox()
{
int i;
@@ -322,6 +377,7 @@ clearabovemovebox()
/*
* print instructions below move box
*/
+void
printbottominstructions()
{
move(bboxrow, boxcol);
@@ -335,6 +391,7 @@ printbottominstructions()
/*
* print betting information below move box
*/
+void
printbottombettingbox()
{
move(bboxrow, boxcol);
@@ -348,6 +405,7 @@ printbottombettingbox()
/*
* clear info below move box
*/
+void
clearbelowmovebox()
{
int i;
@@ -363,6 +421,7 @@ clearbelowmovebox()
/*
* procedure to put the board on the screen using addressable cursor
*/
+void
makeboard()
{
clear();
@@ -401,11 +460,13 @@ makeboard()
/*
* clean up the board for another game
*/
+void
cleanupboard()
{
int cnt, row, col;
struct cardtype *ptr;
+ col = 0;
if (Cflag) {
clearstat();
for(ptr = stock, row = stockrow;
@@ -456,6 +517,7 @@ cleanupboard()
/*
* procedure to create a deck of cards
*/
+void
initdeck(deck)
struct cardtype *deck[];
{
@@ -481,6 +543,7 @@ initdeck(deck)
/*
* procedure to shuffle the deck
*/
+void
shuffle(deck)
struct cardtype *deck[];
{
@@ -504,7 +567,9 @@ shuffle(deck)
/*
* procedure to remove the card from the board
*/
+void
removecard(a, b)
+ int a, b;
{
move(b, a);
printw(" ");
@@ -513,7 +578,9 @@ removecard(a, b)
/*
* procedure to print the cards on the board
*/
+void
printrank(a, b, cp, inverse)
+ int a, b;
struct cardtype *cp;
bool inverse;
{
@@ -546,6 +613,7 @@ printrank(a, b, cp, inverse)
/*
* procedure to print out a card
*/
+void
printcard(a, b, cp)
int a,b;
struct cardtype *cp;
@@ -572,6 +640,7 @@ printcard(a, b, cp)
* of another location. The pointers always point to the top
* of the piles.
*/
+void
transit(source, dest)
struct cardtype **source, **dest;
{
@@ -588,8 +657,10 @@ transit(source, 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
fndbase(cp, column, row)
struct cardtype **cp;
+ int column, row;
{
bool nomore;
@@ -632,9 +703,10 @@ fndbase(cp, column, row)
/*
* procedure to initialize the things necessary for the game
*/
+void
initgame()
{
- register i;
+ int i;
for (i=0; i<18; i++) {
deck[i]->visible = TRUE;
@@ -677,9 +749,10 @@ initgame()
/*
* procedure to print the beginning cards and to start each game
*/
+void
startgame()
{
- register int j;
+ int j;
shuffle(deck);
initgame();
@@ -717,6 +790,7 @@ startgame()
/*
* procedure to clear the message printed from an error
*/
+void
clearmsg()
{
int i;
@@ -733,6 +807,7 @@ clearmsg()
/*
* procedure to print an error message if the move is not listed
*/
+void
dumberror()
{
errmsg = TRUE;
@@ -743,6 +818,7 @@ dumberror()
/*
* procedure to print an error message if the move is not possible
*/
+void
destinerror()
{
errmsg = TRUE;
@@ -755,7 +831,7 @@ destinerror()
*/
bool
notempty(cp)
-struct cardtype *cp;
+ struct cardtype *cp;
{
if (cp == NIL) {
errmsg = TRUE;
@@ -803,6 +879,7 @@ diffcolor(cp1, cp2)
bool
tabok(cp, des)
struct cardtype *cp;
+ int des;
{
if ((cp == stock) && (tableau[des] == NIL))
return (TRUE);
@@ -822,6 +899,7 @@ tabok(cp, des)
/*
* procedure to turn the cards onto the talon from the deck
*/
+void
movetotalon()
{
int i, fin;
@@ -906,10 +984,12 @@ movetotalon()
/*
* procedure to print card counting info on screen
*/
+
+void
showstat()
{
int row, col;
- register struct cardtype *ptr;
+ struct cardtype *ptr;
if (!Cflag)
return;
@@ -948,6 +1028,7 @@ showstat()
/*
* procedure to clear card counting info from screen
*/
+void
clearstat()
{
int row;
@@ -967,6 +1048,7 @@ clearstat()
/*
* procedure to update card counting base
*/
+void
usedtalon()
{
removecard(coldcol, coldrow);
@@ -991,6 +1073,7 @@ usedtalon()
/*
* procedure to update stock card counting base
*/
+void
usedstock()
{
stockcnt--;
@@ -1003,9 +1086,10 @@ usedstock()
/*
* let 'em know how they lost!
*/
+void
showcards()
{
- register struct cardtype *ptr;
+ struct cardtype *ptr;
int row;
if (!Cflag || cardsoff == 52)
@@ -1050,12 +1134,13 @@ showcards()
/*
* procedure to update the betting values
*/
+void
updatebettinginfo()
{
long thiscosts, gamecosts, totalcosts;
double thisreturn, gamereturn, totalreturn;
time_t now;
- register long dollars;
+ long dollars;
time(&now);
dollars = (now - acctstart) / secondsperdollar;
@@ -1107,8 +1192,10 @@ updatebettinginfo()
/*
* procedure to move a card from the stock or talon to the tableau
*/
+void
simpletableau(cp, des)
-struct cardtype **cp;
+ struct cardtype **cp;
+ int des;
{
int origin;
@@ -1139,7 +1226,9 @@ struct cardtype **cp;
/*
* print the tableau
*/
+void
tabprint(sour, des)
+ int sour, des;
{
int dlength, slength, i;
struct cardtype *tempcard;
@@ -1164,8 +1253,9 @@ tabprint(sour, des)
/*
* procedure to move from the tableau to the tableau
*/
+void
tabtotab(sour, des)
- register int sour, des;
+ int sour, des;
{
struct cardtype *temp;
@@ -1193,6 +1283,7 @@ tabtotab(sour, des)
bool
rankhigher(cp, let)
struct cardtype *cp;
+ int let;
{
if (found[let]->rank == King)
if (cp->rank == Ace)
@@ -1208,8 +1299,10 @@ rankhigher(cp, let)
/*
* function to determine if two cards are the same suit
*/
+int
samesuit(cp, let)
struct cardtype *cp;
+ int let;
{
if (cp->suit == found[let]->suit)
return (TRUE);
@@ -1220,8 +1313,10 @@ samesuit(cp, let)
/*
* procedure to move a card to the correct foundation pile
*/
+void
movetofound(cp, source)
struct cardtype **cp;
+ int source;
{
tempbase = 0;
mtfdone = FALSE;
@@ -1270,6 +1365,7 @@ movetofound(cp, source)
/*
* procedure to get a command
*/
+void
getcmd(row, col, cp)
int row, col;
char *cp;
@@ -1320,6 +1416,7 @@ getcmd(row, col, cp)
/*
* Suspend the game (shell escape if no process control on system)
*/
+void
suspend()
{
#ifndef SIGTSTP
@@ -1341,11 +1438,13 @@ suspend()
/*
* procedure to evaluate and make the specific moves
*/
+void
movecard()
{
int source, dest;
char osrcpile, odestpile;
+ source = dest = 0;
done = FALSE;
errmsg = FALSE;
do {
@@ -1536,9 +1635,10 @@ char *bettinginstructions[] = {
/*
* procedure to printout instructions
*/
+void
instruct()
{
- register char **cp;
+ char **cp;
move(originrow, origincol);
printw("This is the game of solitaire called Canfield. Do\n");
@@ -1571,6 +1671,7 @@ instruct()
/*
* procedure to initialize the game
*/
+void
initall()
{
int i;
@@ -1640,7 +1741,8 @@ finish()
* procedure to clean up and exit
*/
void
-cleanup()
+cleanup(dummy)
+ int dummy;
{
total.thinktime += 1;
@@ -1663,7 +1765,8 @@ cleanup()
* Field an interrupt.
*/
void
-askquit()
+askquit(dummy)
+ int dummy;
{
move(msgrow, msgcol);
printw("Really wish to quit? ");
@@ -1672,13 +1775,14 @@ askquit()
} while (srcpile != 'y' && srcpile != 'n');
clearmsg();
if (srcpile == 'y')
- cleanup();
+ cleanup(0);
signal(SIGINT, askquit);
}
/*
* Can you tell that this used to be a Pascal program?
*/
+int
main(argc, argv)
int argc;
char *argv[];
@@ -1711,6 +1815,7 @@ main(argc, argv)
else
cleanupboard();
}
- cleanup();
+ cleanup(0);
/* NOTREACHED */
+ return(0);
}
diff --git a/canfield/cfscores/cfscores.c b/canfield/cfscores/cfscores.c
index 4a3a0e8f..90988cdb 100644
--- a/canfield/cfscores/cfscores.c
+++ b/canfield/cfscores/cfscores.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cfscores.c,v 1.3 1995/03/21 15:08:37 cgd Exp $ */
+/* $NetBSD: cfscores.c,v 1.4 1997/10/10 12:26:44 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -33,22 +33,25 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: cfscores.c,v 1.3 1995/03/21 15:08:37 cgd Exp $";
+__RCSID("$NetBSD: cfscores.c,v 1.4 1997/10/10 12:26:44 lukem Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
+#include <fcntl.h>
#include <pwd.h>
+#include <stdio.h>
+#include <unistd.h>
#include "pathnames.h"
struct betinfo {
@@ -64,11 +67,15 @@ struct betinfo {
int dbfd;
+int main __P((int, char *[]));
+void printuser __P((struct passwd *, int));
+
+int
main(argc, argv)
int argc;
char *argv[];
{
- register struct passwd *pw;
+ struct passwd *pw;
int uid;
if (argc > 2) {
@@ -108,8 +115,9 @@ main(argc, argv)
/*
* print out info for specified password entry
*/
+void
printuser(pw, printfail)
- register struct passwd *pw;
+ struct passwd *pw;
int printfail;
{
struct betinfo total;
@@ -141,14 +149,14 @@ printuser(pw, printfail)
printf("* Losses for %-10s*\n", pw->pw_name);
printf("*======================*\n");
printf("|Costs Total |\n");
- printf("| Hands %8d |\n", total.hand);
- printf("| Inspections %8d |\n", total.inspection);
- printf("| Games %8d |\n", total.game);
- printf("| Runs %8d |\n", total.runs);
- printf("| Information %8d |\n", total.information);
- printf("| Think time %8d |\n", total.thinktime);
- printf("|Total Costs %8d |\n", total.wins - total.worth);
- printf("|Winnings %8d |\n", total.wins);
- printf("|Net Worth %8d |\n", total.worth);
+ printf("| Hands %8ld |\n", total.hand);
+ printf("| Inspections %8ld |\n", total.inspection);
+ printf("| Games %8ld |\n", total.game);
+ printf("| Runs %8ld |\n", total.runs);
+ printf("| Information %8ld |\n", total.information);
+ printf("| Think time %8ld |\n", total.thinktime);
+ printf("|Total Costs %8ld |\n", total.wins - total.worth);
+ printf("|Winnings %8ld |\n", total.wins);
+ printf("|Net Worth %8ld |\n", total.worth);
printf("*----------------------*\n\n");
}
diff --git a/cribbage/cards.c b/cribbage/cards.c
index a81bdf65..e6c52628 100644
--- a/cribbage/cards.c
+++ b/cribbage/cards.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cards.c,v 1.3 1995/03/21 15:08:41 cgd Exp $ */
+/* $NetBSD: cards.c,v 1.4 1997/10/10 12:32:22 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -33,8 +33,13 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
+#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 $");
+#endif
#endif /* not lint */
#include <curses.h>
@@ -53,7 +58,7 @@ void
makedeck(d)
CARD d[];
{
- register int i, j, k;
+ int i, j, k;
i = time(NULL);
i = ((i & 0xff) << 8) | ((i >> 8) & 0xff) | 1;
@@ -74,7 +79,7 @@ void
shuffle(d)
CARD d[];
{
- register int j, k;
+ int j, k;
CARD c;
for (j = CARDS; j > 0; --j) {
@@ -103,7 +108,7 @@ isone(a, b, n)
CARD a, b[];
int n;
{
- register int i;
+ int i;
for (i = 0; i < n; i++)
if (eq(a, b[i]))
@@ -119,7 +124,7 @@ cremove(a, d, n)
CARD a, d[];
int n;
{
- register int i, j;
+ int i, j;
for (i = j = 0; i < n; i++)
if (!eq(a, d[i]))
@@ -134,10 +139,10 @@ cremove(a, d, n)
*/
void
sorthand(h, n)
- register CARD h[];
+ CARD h[];
int n;
{
- register CARD *cp, *endp;
+ CARD *cp, *endp;
CARD c;
for (endp = &h[n]; h < endp - 1; h++)
diff --git a/cribbage/crib.c b/cribbage/crib.c
index cf59d5aa..696c86b2 100644
--- a/cribbage/crib.c
+++ b/cribbage/crib.c
@@ -1,4 +1,4 @@
-/* $NetBSD: crib.c,v 1.7 1997/07/10 06:47:29 mikel Exp $ */
+/* $NetBSD: crib.c,v 1.8 1997/10/10 12:32:24 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -33,17 +33,17 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
+__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: crib.c,v 1.7 1997/07/10 06:47:29 mikel Exp $";
+__RCSID("$NetBSD: crib.c,v 1.8 1997/10/10 12:32:24 lukem Exp $");
#endif
#endif /* not lint */
@@ -58,6 +58,8 @@ static char rcsid[] = "$NetBSD: crib.c,v 1.7 1997/07/10 06:47:29 mikel Exp $";
#include "cribcur.h"
#include "pathnames.h"
+int main __P((int, char *[]));
+
int
main(argc, argv)
int argc;
@@ -67,7 +69,7 @@ main(argc, argv)
FILE *f;
int ch;
- while ((ch = getopt(argc, argv, "eqr")) != EOF)
+ while ((ch = getopt(argc, argv, "eqr")) != -1)
switch (ch) {
case 'e':
explain = TRUE;
@@ -193,10 +195,11 @@ gamescore()
void
game()
{
- register int i, j;
+ int i, j;
BOOLEAN flag;
BOOLEAN compcrib;
+ compcrib = FALSE;
makedeck(deck);
shuffle(deck);
if (gamecount == 0) {
@@ -287,7 +290,7 @@ int
playhand(mycrib)
BOOLEAN mycrib;
{
- register int deckpos;
+ int deckpos;
werase(Compwin);
wrefresh(Compwin);
@@ -319,7 +322,7 @@ int
deal(mycrib)
BOOLEAN mycrib;
{
- register int i, j;
+ int i, j;
for (i = j = 0; i < FULLHAND; i++) {
if (mycrib) {
@@ -342,7 +345,7 @@ void
discard(mycrib)
BOOLEAN mycrib;
{
- register char *prompt;
+ char *prompt;
CARD crd;
prcrib(mycrib, TRUE);
@@ -373,7 +376,7 @@ cut(mycrib, pos)
BOOLEAN mycrib;
int pos;
{
- register int i;
+ int i;
BOOLEAN win;
win = FALSE;
@@ -416,7 +419,7 @@ void
prcrib(mycrib, blank)
BOOLEAN mycrib, blank;
{
- register int y, cardx;
+ int y, cardx;
if (mycrib)
cardx = CRIB_X;
@@ -448,12 +451,13 @@ peg(mycrib)
BOOLEAN mycrib;
{
static CARD ch[CINHAND], ph[CINHAND];
- register int i, j, k;
- register int l;
- register int cnum, pnum, sum;
- register BOOLEAN myturn, mego, ugo, last, played;
+ int i, j, k;
+ int l;
+ int cnum, pnum, sum;
+ BOOLEAN myturn, mego, ugo, last, played;
CARD crd;
+ played = FALSE;
cnum = pnum = CINHAND;
for (i = 0; i < CINHAND; i++) { /* make copies of hands */
ch[i] = chand[i];
diff --git a/cribbage/cribbage.6 b/cribbage/cribbage.6
index f7be11c1..e40e6c04 100644
--- a/cribbage/cribbage.6
+++ b/cribbage/cribbage.6
@@ -1,4 +1,4 @@
-.\" $NetBSD: cribbage.6,v 1.4 1995/03/21 15:08:45 cgd Exp $
+.\" $NetBSD: cribbage.6,v 1.5 1997/10/10 12:32:26 lukem Exp $
.\"
.\" Copyright (c) 1980, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -40,10 +40,10 @@
.Nm cribbage
.Nd the card game cribbage
.Sh SYNOPSIS
-.Nm /usr/games/cribbage
+.Nm
.Op Fl eqr
.Sh DESCRIPTION
-.Nm Cribbage
+.Nm
plays the card game cribbage, with the program playing one hand
and the user the other. The program will initially ask the user if
the rules of the game are needed \- if so, it will print out
@@ -52,7 +52,7 @@ the appropriate section from
with
.Xr more 1 .
.Pp
-.Nm Cribbage
+.Nm
options include:
.Bl -tag -width indent
.It Fl e
@@ -67,7 +67,7 @@ Instead of asking the player to cut the deck, the program will randomly
cut the deck.
.El
.Pp
-.Nm Cribbage
+.Nm
first asks the player whether he wishes to play a short game (
.Dq once around ,
to 61) or a long game (
diff --git a/cribbage/extern.c b/cribbage/extern.c
index 1b7c4125..4594e906 100644
--- a/cribbage/extern.c
+++ b/cribbage/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.3 1995/03/21 15:08:50 cgd Exp $ */
+/* $NetBSD: extern.c,v 1.4 1997/10/10 12:32:29 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: extern.c,v 1.3 1995/03/21 15:08:50 cgd Exp $";
+__RCSID("$NetBSD: extern.c,v 1.4 1997/10/10 12:32:29 lukem Exp $");
#endif
#endif /* not lint */
diff --git a/cribbage/instr.c b/cribbage/instr.c
index 936302e0..e4409bc2 100644
--- a/cribbage/instr.c
+++ b/cribbage/instr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: instr.c,v 1.5 1997/07/10 06:47:30 mikel Exp $ */
+/* $NetBSD: instr.c,v 1.6 1997/10/10 12:32:30 lukem Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)instr.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: instr.c,v 1.5 1997/07/10 06:47:30 mikel Exp $";
+__RCSID("$NetBSD: instr.c,v 1.6 1997/10/10 12:32:30 lukem Exp $");
#endif
#endif /* not lint */
diff --git a/cribbage/io.c b/cribbage/io.c
index 452a3ecf..f73fc097 100644
--- a/cribbage/io.c
+++ b/cribbage/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.9 1997/07/09 06:25:47 phil Exp $ */
+/* $NetBSD: io.c,v 1.10 1997/10/10 12:32:32 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: io.c,v 1.9 1997/07/09 06:25:47 phil Exp $";
+__RCSID("$NetBSD: io.c,v 1.10 1997/10/10 12:32:32 lukem Exp $");
#endif
#endif /* not lint */
@@ -173,7 +174,7 @@ prhand(h, n, win, blank)
WINDOW *win;
BOOLEAN blank;
{
- register int i;
+ int i;
werase(win);
for (i = 0; i < n; i++)
@@ -192,7 +193,7 @@ infrom(hand, n, prompt)
int n;
char *prompt;
{
- register int i, j;
+ int i, j;
CARD crd;
if (n < 1) {
@@ -246,7 +247,7 @@ int
incard(crd)
CARD *crd;
{
- register int i;
+ int i;
int rnk, sut;
char *line, *p, *p1;
BOOLEAN retval;
@@ -330,7 +331,7 @@ gotit:
int
getuchar()
{
- register int c;
+ int c;
c = readchar();
if (islower(c))
@@ -349,8 +350,8 @@ number(lo, hi, prompt)
int lo, hi;
char *prompt;
{
- register char *p;
- register int sum;
+ char *p;
+ int sum;
for (sum = 0;;) {
msg(prompt);
@@ -447,8 +448,8 @@ void
endmsg()
{
static int lastline = 0;
- register int len;
- register char *mp, *omp;
+ int len;
+ char *mp, *omp;
/* All messages should start with uppercase */
mvaddch(lastline + Y_MSG_START, SCORE_X, ' ');
@@ -516,9 +517,9 @@ do_wait()
*/
void
wait_for(ch)
- register int ch;
+ int ch;
{
- register char c;
+ char c;
if (ch == '\n')
while ((c = readchar()) != '\n')
@@ -535,7 +536,7 @@ wait_for(ch)
int
readchar()
{
- register int cnt;
+ int cnt;
char c;
over:
@@ -563,9 +564,9 @@ over:
char *
getline()
{
- register char *sp;
- register int c, oy, ox;
- register WINDOW *oscr;
+ char *sp;
+ int c, oy, ox;
+ WINDOW *oscr;
oscr = stdscr;
stdscr = Msgwin;
@@ -578,7 +579,7 @@ getline()
else
if (c == erasechar()) { /* process erase character */
if (sp > linebuf) {
- register int i;
+ int i;
sp--;
for (i = strlen(unctrl(*sp)); i; i--)
diff --git a/cribbage/score.c b/cribbage/score.c
index ac8c210d..d0ae050d 100644
--- a/cribbage/score.c
+++ b/cribbage/score.c
@@ -1,4 +1,4 @@
-/* $NetBSD: score.c,v 1.4 1997/05/17 19:26:19 pk Exp $ */
+/* $NetBSD: score.c,v 1.5 1997/10/10 12:32:34 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: score.c,v 1.4 1997/05/17 19:26:19 pk Exp $";
+__RCSID("$NetBSD: score.c,v 1.5 1997/10/10 12:32:34 lukem Exp $");
#endif
#endif /* not lint */
@@ -109,15 +110,15 @@ static int pairpoints, runpoints; /* Globals from pairuns. */
*/
int
scorehand(hand, starter, n, crb, do_explain)
- register CARD hand[];
+ CARD hand[];
CARD starter;
int n;
BOOLEAN crb; /* true if scoring crib */
BOOLEAN do_explain; /* true if must explain this hand */
{
- register int i, k;
- register int score;
- register BOOLEAN flag;
+ int i, k;
+ int score;
+ BOOLEAN flag;
CARD h[(CINHAND + 1)];
char buf[32];
@@ -182,12 +183,12 @@ scorehand(hand, starter, n, crb, do_explain)
*/
int
fifteens(hand, n)
- register CARD hand[];
+ CARD hand[];
int n;
{
- register int *sp, *np;
- register int i;
- register CARD *endp;
+ int *sp, *np;
+ int i;
+ CARD *endp;
static int sums[15], nsums[15];
np = nsums;
@@ -228,7 +229,7 @@ pairuns(h, n)
CARD h[];
int n;
{
- register int i;
+ int i;
int runlength, runmult, lastmult, curmult;
int mult1, mult2, pair1, pair2;
BOOLEAN run;
@@ -298,7 +299,7 @@ pegscore(crd, tbl, n, sum)
int n, sum;
{
BOOLEAN got[RANKS];
- register int i, j, scr;
+ int i, j, scr;
int k, lo, hi;
sum += VAL(crd.rank);
diff --git a/cribbage/support.c b/cribbage/support.c
index a2064a21..96ea67ad 100644
--- a/cribbage/support.c
+++ b/cribbage/support.c
@@ -1,4 +1,4 @@
-/* $NetBSD: support.c,v 1.3 1995/03/21 15:08:59 cgd Exp $ */
+/* $NetBSD: support.c,v 1.4 1997/10/10 12:32:36 lukem Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -33,11 +33,12 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: support.c,v 1.3 1995/03/21 15:08:59 cgd Exp $";
+__RCSID("$NetBSD: support.c,v 1.4 1997/10/10 12:32:36 lukem Exp $");
#endif
#endif /* not lint */
@@ -62,7 +63,7 @@ cchose(h, n, s)
CARD h[];
int n, s;
{
- register int i, j, l;
+ int i, j, l;
if (n <= 1)
return (0);
@@ -132,8 +133,8 @@ plyrhand(hand, s)
char *s;
{
static char prompt[BUFSIZ];
- register int i, j;
- register BOOLEAN win;
+ int i, j;
+ BOOLEAN win;
prhand(hand, CINHAND, Playwin, FALSE);
(void) sprintf(prompt, "Your %s scores ", s);
@@ -167,7 +168,7 @@ comphand(h, s)
CARD h[];
char *s;
{
- register int j;
+ int j;
j = scorehand(h, turnover, CINHAND, strcmp(s, "crib") == 0, FALSE);
prhand(h, CINHAND, Compwin, FALSE);
@@ -190,8 +191,8 @@ chkscr(scr, inc)
myturn = (scr == &cscore);
if (inc != 0) {
- prpeg(Lastscore[myturn], '.', myturn);
- Lastscore[myturn] = *scr;
+ prpeg(Lastscore[(int)myturn], '.', myturn);
+ Lastscore[(int)myturn] = *scr;
*scr += inc;
prpeg(*scr, PEG, myturn);
refresh();
@@ -206,11 +207,11 @@ chkscr(scr, inc)
*/
void
prpeg(score, peg, myturn)
- register int score;
+ int score;
int peg;
BOOLEAN myturn;
{
- register int y, x;
+ int y, x;
if (!myturn)
y = SCORE_Y + 2;
@@ -248,7 +249,7 @@ cdiscard(mycrib)
BOOLEAN mycrib;
{
CARD d[CARDS], h[FULLHAND], cb[2];
- register int i, j, k;
+ int i, j, k;
int nc, ns;
long sums[15];
static int undo1[15] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4};
@@ -301,7 +302,7 @@ anymove(hand, n, sum)
CARD hand[];
int n, sum;
{
- register int i, j;
+ int i, j;
if (n < 1)
return (FALSE);
@@ -322,7 +323,7 @@ anysumto(hand, n, s, t)
CARD hand[];
int n, s, t;
{
- register int i;
+ int i;
for (i = 0; i < n; i++) {
if (s + VAL(hand[i].rank) == t)
@@ -339,7 +340,7 @@ numofval(h, n, v)
CARD h[];
int n, v;
{
- register int i, j;
+ int i, j;
j = 0;
for (i = 0; i < n; i++) {
@@ -357,7 +358,7 @@ makeknown(h, n)
CARD h[];
int n;
{
- register int i;
+ int i;
for (i = 0; i < n; i++)
known[knownum++] = h[i];