-/* $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
* 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.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 */
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:
msgcrd(c, brfrank, mid, brfsuit)
CARD c;
BOOLEAN brfrank, brfsuit;
- char *mid;
+ const char *mid;
{
if (c.rank == EMPTY || c.suit == EMPTY)
return (FALSE);
*/
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++)
*/
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) {
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++)
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);
incard(crd)
CARD *crd;
{
- register int i;
+ int i;
int rnk, sut;
char *line, *p, *p1;
BOOLEAN retval;
int
getuchar()
{
- register int c;
+ int c;
c = readchar();
if (islower(c))
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);
va_start(ap);
#endif
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
+ Newpos = strlen(Msgbuf);
va_end(ap);
endmsg();
}
va_start(ap);
#endif
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
+ Newpos = strlen(Msgbuf);
va_end(ap);
}
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, ' ');
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, ' ');
*/
void
wait_for(ch)
- register int ch;
+ int ch;
{
- register char c;
+ char c;
if (ch == '\n')
while ((c = readchar()) != '\n')
int
readchar()
{
- register int cnt;
+ int cnt;
char c;
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;
else
if (c == erasechar()) { /* process erase character */
if (sp > linebuf) {
- register int i;
+ int i;
sp--;
for (i = strlen(unctrl(*sp)); i; i--)
void
rint(signo)
- int signo;
+ int signo __attribute__((__unused__));
{
bye();
exit(1);