X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/b218620de93fbebcfba8ec74b22d33986ba70b3f..941e288b49e2f4ff7a20f9a33c3767def7f3b029:/cribbage/io.c diff --git a/cribbage/io.c b/cribbage/io.c index a1ebe3dc..dc61c253 100644 --- a/cribbage/io.c +++ b/cribbage/io.c @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.8 1997/05/17 19:26:18 pk Exp $ */ +/* $NetBSD: io.c,v 1.14 1999/09/30 18:01:32 jsm Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include #ifndef lint #if 0 static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: io.c,v 1.8 1997/05/17 19:26:18 pk Exp $"; +__RCSID("$NetBSD: io.c,v 1.14 1999/09/30 18:01:32 jsm Exp $"); #endif #endif /* not lint */ @@ -68,18 +69,18 @@ static char rcsid[] = "$NetBSD: io.c,v 1.8 1997/05/17 19:26:18 pk 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: @@ -104,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); @@ -168,12 +169,12 @@ prcard(win, y, x, c, blank) */ void prhand(h, n, win, blank) - CARD h[]; + const CARD h[]; int n; WINDOW *win; BOOLEAN blank; { - register int i; + int i; werase(win); for (i = 0; i < n; i++) @@ -188,11 +189,11 @@ prhand(h, n, win, blank) */ int infrom(hand, n, prompt) - CARD hand[]; + const CARD hand[]; int n; - char *prompt; + const char *prompt; { - register int i, j; + int i, j; CARD crd; if (n < 1) { @@ -202,7 +203,7 @@ infrom(hand, n, prompt) for (;;) { msg(prompt); if (incard(&crd)) { /* if card is full card */ - if (!isone(crd, hand, n)) + if (!is_one(crd, hand, n)) msg("That's not in your hand"); else { for (i = 0; i < n; i++) @@ -210,7 +211,7 @@ infrom(hand, n, prompt) hand[i].suit == crd.suit) break; if (i >= n) { - printf("\nINFROM: isone or something messed up\n"); + printf("\nINFROM: is_one or something messed up\n"); exit(77); } return (i); @@ -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)) @@ -347,10 +348,10 @@ getuchar() int number(lo, hi, prompt) int lo, hi; - char *prompt; + const char *prompt; { - register char *p; - register int sum; + char *p; + int sum; for (sum = 0;;) { msg(prompt); @@ -407,6 +408,7 @@ msg(fmt, va_alist) va_start(ap); #endif (void)vsprintf(&Msgbuf[Newpos], fmt, ap); + Newpos = strlen(Msgbuf); va_end(ap); endmsg(); } @@ -432,6 +434,7 @@ addmsg(fmt, va_alist) va_start(ap); #endif (void)vsprintf(&Msgbuf[Newpos], fmt, ap); + Newpos = strlen(Msgbuf); va_end(ap); } @@ -445,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, ' '); @@ -493,9 +496,9 @@ 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) + if ((int)(Mpos + sizeof prompt) < MSG_X) wmove(Msgwin, Lineno > 0 ? Lineno - 1 : MSG_Y - 1, Mpos); else { mvwaddch(Msgwin, Lineno, 0, ' '); @@ -514,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') @@ -533,7 +536,7 @@ wait_for(ch) int readchar() { - register int cnt; + int cnt; char c; over: @@ -561,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; @@ -576,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--) @@ -609,7 +612,7 @@ getline() void rint(signo) - int signo; + int signo __attribute__((__unused__)); { bye(); exit(1);