From 77db8b9323c1e0b90e3f21299eda85c75245d46b Mon Sep 17 00:00:00 2001 From: mycroft Date: Wed, 8 Dec 1993 07:50:47 +0000 Subject: Eliminate two compiler warnings. --- cribbage/io.c | 170 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 85 insertions(+), 85 deletions(-) (limited to 'cribbage/io.c') diff --git a/cribbage/io.c b/cribbage/io.c index 2cef04b0..ab1c538d 100644 --- a/cribbage/io.c +++ b/cribbage/io.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)io.c 5.8 (Berkeley) 2/28/91";*/ -static char rcsid[] = "$Id: io.c,v 1.5 1993/08/10 03:41:48 mycroft Exp $"; +static char rcsid[] = "$Id: io.c,v 1.6 1993/12/08 07:50:47 mycroft Exp $"; #endif /* not lint */ # include @@ -74,6 +74,90 @@ char *suitchar[ SUITS ] = { "S", "H", "D", "C" }; +/* + * msg: + * Display a message at the top of the screen. + */ +char Msgbuf[BUFSIZ] = { '\0' }; + +int Mpos = 0; + +static int Newpos = 0; + +msg(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + (void)vsprintf(&Msgbuf[Newpos], fmt, ap); + endmsg(); +} + +/* + * addmsg: + * Add things to the current message + */ +addmsg(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + (void)vsprintf(&Msgbuf[Newpos], fmt, ap); +} + +/* + * endmsg: + * Display a new msg. + */ + +int Lineno = 0; + +endmsg() +{ + register int len; + register char *mp, *omp; + static int lastline = 0; + + /* + * All messages should start with uppercase + */ + mvaddch(lastline + Y_MSG_START, SCORE_X, ' '); + if (islower(Msgbuf[0]) && Msgbuf[1] != ')') + Msgbuf[0] = toupper(Msgbuf[0]); + mp = Msgbuf; + len = strlen(mp); + if (len / MSG_X + Lineno >= MSG_Y) { + while (Lineno < MSG_Y) { + wmove(Msgwin, Lineno++, 0); + wclrtoeol(Msgwin); + } + Lineno = 0; + } + mvaddch(Lineno + Y_MSG_START, SCORE_X, '*'); + lastline = Lineno; + do { + mvwaddstr(Msgwin, Lineno, 0, mp); + if ((len = strlen(mp)) > MSG_X) { + omp = mp; + for (mp = &mp[MSG_X-1]; *mp != ' '; mp--) + continue; + while (*mp == ' ') + mp--; + mp++; + wmove(Msgwin, Lineno, mp - omp); + wclrtoeol(Msgwin); + } + if (++Lineno >= MSG_Y) + Lineno = 0; + } while (len > MSG_X); + wclrtoeol(Msgwin); + Mpos = len; + Newpos = 0; + wrefresh(Msgwin); + refresh(); + wrefresh(Msgwin); +} + /* * msgcard: * Call msgcrd in one of two forms @@ -365,90 +449,6 @@ char *prompt; } } -/* - * msg: - * Display a message at the top of the screen. - */ -char Msgbuf[BUFSIZ] = { '\0' }; - -int Mpos = 0; - -static int Newpos = 0; - -/* VARARGS1 */ -msg(fmt,ap) - char *fmt; - va_list ap; -{ - (void)vsprintf(&Msgbuf[Newpos], fmt, &ap); - endmsg(); -} - -/* - * addmsg: - * Add things to the current message - */ -/* VARARGS1 */ -addmsg(fmt,ap) - char *fmt; - va_list ap; -{ - (void)vsprintf(&Msgbuf[Newpos], fmt, &ap); -} - -/* - * endmsg: - * Display a new msg. - */ - -int Lineno = 0; - -endmsg() -{ - register int len; - register char *mp, *omp; - static int lastline = 0; - - /* - * All messages should start with uppercase - */ - mvaddch(lastline + Y_MSG_START, SCORE_X, ' '); - if (islower(Msgbuf[0]) && Msgbuf[1] != ')') - Msgbuf[0] = toupper(Msgbuf[0]); - mp = Msgbuf; - len = strlen(mp); - if (len / MSG_X + Lineno >= MSG_Y) { - while (Lineno < MSG_Y) { - wmove(Msgwin, Lineno++, 0); - wclrtoeol(Msgwin); - } - Lineno = 0; - } - mvaddch(Lineno + Y_MSG_START, SCORE_X, '*'); - lastline = Lineno; - do { - mvwaddstr(Msgwin, Lineno, 0, mp); - if ((len = strlen(mp)) > MSG_X) { - omp = mp; - for (mp = &mp[MSG_X-1]; *mp != ' '; mp--) - continue; - while (*mp == ' ') - mp--; - mp++; - wmove(Msgwin, Lineno, mp - omp); - wclrtoeol(Msgwin); - } - if (++Lineno >= MSG_Y) - Lineno = 0; - } while (len > MSG_X); - wclrtoeol(Msgwin); - Mpos = len; - Newpos = 0; - wrefresh(Msgwin); - refresh(); - wrefresh(Msgwin); -} - #ifdef notdef /* * doadd: -- cgit v1.2.3-56-ge451