From 53bde7aa54dba785761adf2e07bce713745dca5c Mon Sep 17 00:00:00 2001 From: Thorsten Lockert Date: Sun, 2 Jun 1996 19:47:13 +0000 Subject: Update for modern curses implementation --- games/hangman/getguess.c | 2 +- games/mille/end.c | 12 ++++++------ games/mille/init.c | 12 ++++++------ games/mille/mille.c | 6 +++--- games/mille/mille.h | 5 ----- games/mille/misc.c | 16 ++++++---------- games/mille/move.c | 37 +++++++++++++++++-------------------- games/mille/print.c | 14 +++++++------- games/mille/roll.c | 4 ++-- games/mille/save.c | 16 ++++++---------- games/mille/table.c | 2 +- games/mille/types.c | 4 ++-- games/mille/unctrl.h | 44 -------------------------------------------- games/mille/varpush.c | 4 ++-- games/robots/init_field.c | 2 ++ games/robots/move.c | 2 ++ 16 files changed, 63 insertions(+), 119 deletions(-) delete mode 100644 games/mille/unctrl.h diff --git a/games/hangman/getguess.c b/games/hangman/getguess.c index e7a31acda7e..cc5d7de84e2 100644 --- a/games/hangman/getguess.c +++ b/games/hangman/getguess.c @@ -106,7 +106,7 @@ readch() } else if (ch == CTRL('L')) { wrefresh(curscr); - mvcur(0, 0, curscr->cury, curscr->curx); + mvcur(0, 0, curscr->_cury, curscr->_curx); } else return ch; diff --git a/games/mille/end.c b/games/mille/end.c index a8fb8aa6fa7..5b391b564a2 100644 --- a/games/mille/end.c +++ b/games/mille/end.c @@ -52,9 +52,9 @@ static char rcsid[] = "$NetBSD: end.c,v 1.4 1995/03/24 05:01:30 cgd Exp $"; * the end-of-games points to the user who deserves it (if any). */ finalscore(pp) -reg PLAY *pp; { +register PLAY *pp; { - reg int temp, tot, num; + register int temp, tot, num; if (pp->was_finished == Finished) return; @@ -96,9 +96,9 @@ static int Last_tot[2]; /* last tot used for extrapolate */ * the end-of-games points to the user who deserves it (if any). */ extrapolate(pp) -reg PLAY *pp; { +register PLAY *pp; { - reg int x, num, tot, count; + register int x, num, tot, count; num = pp - Player; tot += SC_TRIP + SC_DELAY + SC_EXT; @@ -141,8 +141,8 @@ reg PLAY *pp; { undoex() { - reg PLAY *pp; - reg int i; + register PLAY *pp; + register int i; i = 0; for (pp = Player; pp < &Player[2]; pp++) { diff --git a/games/mille/init.c b/games/mille/init.c index 368862ad8e4..4dce19f2cd6 100644 --- a/games/mille/init.c +++ b/games/mille/init.c @@ -49,9 +49,9 @@ static char rcsid[] = "$NetBSD: init.c,v 1.5 1995/03/24 05:01:40 cgd Exp $"; init() { - reg PLAY *pp; - reg int i, j; - reg CARD card; + register PLAY *pp; + register int i, j; + register CARD card; bzero(Numseen, sizeof Numseen); Numgos = 0; @@ -92,8 +92,8 @@ init() { shuffle() { - reg int i, r; - reg CARD temp; + register int i, r; + register CARD temp; for (i = 0; i < DECK_SZ; i++) { r = roll(1, DECK_SZ) - 1; @@ -168,7 +168,7 @@ newboard() { newscore() { - reg int i, new; + register int i, new; register PLAY *pp; static int was_full = -1; static int last_win = -1; diff --git a/games/mille/mille.c b/games/mille/mille.c index cc4a6ac8c26..66ccd3a95bf 100644 --- a/games/mille/mille.c +++ b/games/mille/mille.c @@ -60,10 +60,10 @@ static char rcsid[] = "$NetBSD: mille.c,v 1.4 1995/03/24 05:01:48 cgd Exp $"; void rub(); main(ac, av) -reg int ac; -reg char *av[]; { +register int ac; +register char *av[]; { - reg bool restore; + register bool restore; /* run as the user */ setuid(getuid()); diff --git a/games/mille/mille.h b/games/mille/mille.h index 1d82942c19e..6c9d9712b50 100644 --- a/games/mille/mille.h +++ b/games/mille/mille.h @@ -158,11 +158,6 @@ # define erasechar() _tty.c_cc[VERASE] # define killchar() _tty.c_cc[VKILL] # endif -# else -# ifndef erasechar -# define erasechar() _tty.sg_erase -# define killchar() _tty.sg_kill -# endif # endif SYSV typedef struct { diff --git a/games/mille/misc.c b/games/mille/misc.c index 8dafc778b66..35c94b23044 100644 --- a/games/mille/misc.c +++ b/games/mille/misc.c @@ -45,10 +45,6 @@ static char rcsid[] = "$NetBSD: misc.c,v 1.4 1995/03/24 05:01:54 cgd Exp $"; #include #include "mille.h" -#ifndef unctrl -#include "unctrl.h" -#endif - # ifdef attron # include @@ -77,7 +73,7 @@ char *str; CARD getcard() { - reg int c, c1; + register int c, c1; for (;;) { while ((c = readch()) == '\n' || c == '\r' || c == ' ') @@ -124,7 +120,7 @@ cont: ; } check_ext(forcomp) -reg bool forcomp; { +register bool forcomp; { if (End == 700) @@ -143,8 +139,8 @@ done: } } else { - reg PLAY *pp, *op; - reg int i, safe, miles; + register PLAY *pp, *op; + register int i, safe, miles; pp = &Player[COMP]; op = &Player[PLAYER]; @@ -180,7 +176,7 @@ done: getyn(promptno) register int promptno; { - reg char c; + register char c; Saved = FALSE; for (;;) { @@ -249,7 +245,7 @@ check_more() { readch() { - reg int cnt; + register int cnt; static char c; for (cnt = 0; read(0, &c, 1) <= 0; cnt++) diff --git a/games/mille/move.c b/games/mille/move.c index 422e8db72df..c7c1a007a83 100644 --- a/games/mille/move.c +++ b/games/mille/move.c @@ -44,9 +44,6 @@ static char rcsid[] = "$NetBSD: move.c,v 1.4 1995/03/24 05:01:57 cgd Exp $"; #include #include "mille.h" -#ifndef unctrl -#include "unctrl.h" -#endif # ifdef attron # include @@ -66,9 +63,9 @@ char *Movenames[] = { domove() { - reg PLAY *pp; - reg int i, j; - reg bool goodplay; + register PLAY *pp; + register int i, j; + register bool goodplay; pp = &Player[Play]; if (Play == PLAYER) @@ -169,9 +166,9 @@ acc: */ check_go() { - reg CARD card; - reg PLAY *pp, *op; - reg int i; + register CARD card; + register PLAY *pp, *op; + register int i; for (pp = Player; pp < &Player[2]; pp++) { op = (pp == &Player[COMP] ? &Player[PLAYER] : &Player[COMP]); @@ -198,10 +195,10 @@ check_go() { } playcard(pp) -reg PLAY *pp; +register PLAY *pp; { - reg int v; - reg CARD card; + register int v; + register CARD card; /* * check and see if player has picked @@ -348,7 +345,7 @@ protected: getmove() { - reg char c, *sp; + register char c, *sp; #ifdef EXTRAP static bool last_ex = FALSE; /* set if last command was E */ @@ -477,9 +474,9 @@ ret: * return whether or not the player has picked */ haspicked(pp) -reg PLAY *pp; { +register PLAY *pp; { - reg int card; + register int card; if (Topcard <= Deck) return TRUE; @@ -496,9 +493,9 @@ reg PLAY *pp; { } account(card) -reg CARD card; { +register CARD card; { - reg CARD oppos; + register CARD oppos; if (card == C_INIT) return; @@ -552,10 +549,10 @@ int promptno; } sort(hand) -reg CARD *hand; +register CARD *hand; { - reg CARD *cp, *tp; - reg CARD temp; + register CARD *cp, *tp; + register CARD temp; cp = hand; hand += HAND_SZ; diff --git a/games/mille/print.c b/games/mille/print.c index 5c2427c6d20..1c4f9442f08 100644 --- a/games/mille/print.c +++ b/games/mille/print.c @@ -52,8 +52,8 @@ static char rcsid[] = "$NetBSD: print.c,v 1.4 1995/03/24 05:02:02 cgd Exp $"; prboard() { - reg PLAY *pp; - reg int i, j, k, temp; + register PLAY *pp; + register int i, j, k, temp; for (k = 0; k < 2; k++) { pp = &Player[k]; @@ -68,8 +68,8 @@ prboard() { show_card(14, temp, pp->battle, &pp->sh_battle); show_card(16, temp, pp->speed, &pp->sh_speed); for (i = C_25; i <= C_200; i++) { - reg char *name; - reg int end; + register char *name; + register int end; if (pp->nummiles[i] == pp->sh_nummiles[i]) continue; @@ -118,10 +118,10 @@ register CARD c, *lc; static char Score_fmt[] = "%4d"; prscore(for_real) -reg bool for_real; { +register bool for_real; { - reg PLAY *pp; - reg int x; + register PLAY *pp; + register int x; stdscr = Score; for (pp = Player; pp < &Player[2]; pp++) { diff --git a/games/mille/roll.c b/games/mille/roll.c index fa589ba95b6..73fd29f99e9 100644 --- a/games/mille/roll.c +++ b/games/mille/roll.c @@ -51,9 +51,9 @@ static char rcsid[] = "$NetBSD: roll.c,v 1.4 1995/03/24 05:02:07 cgd Exp $"; */ roll(ndie, nsides) -reg int ndie, nsides; { +register int ndie, nsides; { - reg int tot; + register int tot; extern unsigned int random(); tot = 0; diff --git a/games/mille/save.c b/games/mille/save.c index 1e0ad47e5b6..c339fedd231 100644 --- a/games/mille/save.c +++ b/games/mille/save.c @@ -47,10 +47,6 @@ static char rcsid[] = "$NetBSD: save.c,v 1.4 1995/03/24 05:02:13 cgd Exp $"; #include #include "mille.h" -#ifndef unctrl -#include "unctrl.h" -#endif - # ifdef attron # include # define _tty cur_term->Nttyb @@ -73,9 +69,9 @@ int read(), write(); save() { extern int errno; - reg char *sp; - reg int outf; - reg time_t *tp; + register char *sp; + register int outf; + register time_t *tp; char buf[80]; time_t tme; STAT junk; @@ -149,10 +145,10 @@ over: * be cleaned up before the game starts. */ rest_f(file) -reg char *file; { +register char *file; { - reg char *sp; - reg int inf; + register char *sp; + register int inf; char buf[80]; STAT sbuf; diff --git a/games/mille/table.c b/games/mille/table.c index 7b0f9cd2cf4..9b7235c7af1 100644 --- a/games/mille/table.c +++ b/games/mille/table.c @@ -57,7 +57,7 @@ static char rcsid[] = "$NetBSD: table.c,v 1.4 1995/03/24 05:02:18 cgd Exp $"; main() { - reg int i, j, count; + register int i, j, count; printf(" %16s -> %5s %5s %4s %s\n", "Card", "cards", "count", "need", "opposite"); for (i = 0; i < NUM_CARDS - 1; i++) { diff --git a/games/mille/types.c b/games/mille/types.c index cbe8d6ed30b..08124737d6f 100644 --- a/games/mille/types.c +++ b/games/mille/types.c @@ -48,13 +48,13 @@ static char rcsid[] = "$NetBSD: types.c,v 1.4 1995/03/24 05:02:22 cgd Exp $"; */ isrepair(card) -reg CARD card; { +register CARD card; { return card == C_GAS || card == C_SPARE || card == C_REPAIRS || card == C_INIT; } safety(card) -reg CARD card; { +register CARD card; { switch (card) { case C_EMPTY: diff --git a/games/mille/unctrl.h b/games/mille/unctrl.h deleted file mode 100644 index e75d0f0bece..00000000000 --- a/games/mille/unctrl.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: unctrl.h,v 1.4 1995/03/24 05:02:28 cgd Exp $ */ - -/* - * Copyright (c) 1982, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)unctrl.h 8.1 (Berkeley) 5/31/93 - */ - -/* - * unctrl.h - */ - -extern char *_unctrl[]; - -# define unctrl(ch) (_unctrl[ch & 0177]) diff --git a/games/mille/varpush.c b/games/mille/varpush.c index 1fac4cf0d5b..5a39b7facd9 100644 --- a/games/mille/varpush.c +++ b/games/mille/varpush.c @@ -55,8 +55,8 @@ int read(), write(); * channel file. func() is either read or write. */ varpush(file, func) -reg int file; -reg int (*func)(); { +register int file; +register int (*func)(); { int temp; diff --git a/games/robots/init_field.c b/games/robots/init_field.c index 33993d98ad0..2db36857b67 100644 --- a/games/robots/init_field.c +++ b/games/robots/init_field.c @@ -82,7 +82,9 @@ init_field() Dead = FALSE; Waiting = FALSE; +#ifndef NCURSES_VERSION flushok(stdscr, TRUE); +#endif Score = 0; erase(); diff --git a/games/robots/move.c b/games/robots/move.c index 1396cd06ed2..787a23fc630 100644 --- a/games/robots/move.c +++ b/games/robots/move.c @@ -163,7 +163,9 @@ over: case 'W': Waiting = TRUE; leaveok(stdscr, TRUE); +#ifndef NCURSES_VERSION flushok(stdscr, FALSE); +#endif goto ret; case 't': case 'T': -- cgit v1.2.3