diff options
Diffstat (limited to 'boggle/boggle/mach.c')
-rw-r--r-- | boggle/boggle/mach.c | 92 |
1 files changed, 37 insertions, 55 deletions
diff --git a/boggle/boggle/mach.c b/boggle/boggle/mach.c index c21ddbd4..7efc8de5 100644 --- a/boggle/boggle/mach.c +++ b/boggle/boggle/mach.c @@ -1,4 +1,4 @@ -/* $NetBSD: mach.c,v 1.14 2004/11/05 21:30:31 dsl Exp $ */ +/* $NetBSD: mach.c,v 1.15 2005/07/01 16:38:24 jmc Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93"; #else -__RCSID("$NetBSD: mach.c,v 1.14 2004/11/05 21:30:31 dsl Exp $"); +__RCSID("$NetBSD: mach.c,v 1.15 2005/07/01 16:38:24 jmc Exp $"); #endif #endif /* not lint */ @@ -87,9 +87,7 @@ static void winch_catcher(int); * This is called once, when the program starts */ int -setup(sflag, seed) - int sflag; - time_t seed; +setup(int sflag, time_t seed) { if (tty_setup() < 0) return(-1); @@ -107,7 +105,7 @@ setup(sflag, seed) * This is called once, just before the program terminates */ void -cleanup() +cleanup(void) { tty_cleanup(); } @@ -117,7 +115,7 @@ cleanup() * stats */ void -results() +results(void) { int col, row; int denom1, denom2; @@ -147,17 +145,13 @@ results() } static void -prword(base, indx) - const char *const base[]; - int indx; +prword(const char *const base[], int indx) { printw("%s", base[indx]); } static int -prwidth(base, indx) - const char *const base[]; - int indx; +prwidth(const char *const base[], int indx) { return (strlen(base[indx])); } @@ -168,8 +162,7 @@ prwidth(base, indx) * - doesn't accept words longer than MAXWORDLEN or containing caps */ char * -getline(q) - char *q; +getline(char *q) { int ch, done; char *p; @@ -263,21 +256,20 @@ getline(q) } int -inputch() +inputch(void) { return (getch() & 0177); } void -redraw() +redraw(void) { clearok(stdscr, 1); refresh(); } void -flushin(fp) - FILE *fp; +flushin(FILE *fp) { (void) tcflush(fileno(fp), TCIFLUSH); @@ -289,7 +281,7 @@ static int gone; * Stop the game timer */ void -stoptime() +stoptime(void) { time_t t; @@ -301,7 +293,7 @@ stoptime() * Restart the game timer */ void -starttime() +starttime(void) { time_t t; @@ -317,7 +309,7 @@ starttime() * There is no check for exceeding COLS */ void -startwords() +startwords(void) { crow = LIST_LINE; ccol = LIST_COL; @@ -334,8 +326,7 @@ startwords() * to start the next column */ void -addword(w) - const char *w; +addword(const char *w) { int n; @@ -358,7 +349,7 @@ addword(w) * The current word is unacceptable so erase it */ void -badword() +badword(void) { move(crow, ccol); @@ -371,8 +362,7 @@ badword() * No check for wild arg */ void -showword(n) - int n; +showword(int n) { int col, row; @@ -400,7 +390,7 @@ showword(n) * Note: this function knows about the format of the board */ void -findword() +findword(void) { int c, col, found, i, r, row; char buf[MAXWORDLEN + 1]; @@ -445,7 +435,8 @@ findword() if (board[wordpath[i]] == 'q') printw("Qu"); else - printw("%c", toupper((unsigned char)board[wordpath[i]])); + printw("%c", + toupper((unsigned char)board[wordpath[i]])); move(r, c); refresh(); delay(5); @@ -460,7 +451,8 @@ findword() if (board[wordpath[i]] == 'q') printw("Qu"); else - printw("%c", toupper((unsigned char)board[wordpath[i]])); + printw("%c", + toupper((unsigned char)board[wordpath[i]])); } move(r, c); clrtoeol(); @@ -471,9 +463,7 @@ findword() * Display a string at the current cursor position for the given number of secs */ void -showstr(str, delaysecs) - const char *str; - int delaysecs; +showstr(const char *str, int delaysecs) { addstr(str); refresh(); @@ -484,8 +474,7 @@ showstr(str, delaysecs) } void -putstr(s) - const char *s; +putstr(const char *s) { addstr(s); } @@ -494,8 +483,7 @@ putstr(s) * Get a valid word and put it in the buffer */ void -getword(q) - char *q; +getword(char *q) { int ch, col, done, i, row; char *p; @@ -552,15 +540,13 @@ getword(q) } void -showboard(b) - const char *b; +showboard(const char *b) { tty_showboard(b); } void -prompt(mesg) - const char *mesg; +prompt(const char *mesg) { move(PROMPT_LINE, PROMPT_COL); printw("%s", mesg); @@ -569,7 +555,7 @@ prompt(mesg) } static int -tty_setup() +tty_setup(void) { initscr(); raw(); @@ -590,10 +576,9 @@ tty_setup() } static void -stop_catcher(signo) - int signo __attribute__((__unused__)); +stop_catcher(int signo __attribute__((__unused__))) { - sigset_t sigset, osigset; + sigset_t isigset, osigset; stoptime(); noraw(); @@ -602,17 +587,16 @@ stop_catcher(signo) refresh(); signal(SIGTSTP, SIG_DFL); - sigemptyset(&sigset); - sigaddset(&sigset, SIGTSTP); - sigprocmask(SIG_UNBLOCK, &sigset, &osigset); + sigemptyset(&isigset); + sigaddset(&isigset, SIGTSTP); + sigprocmask(SIG_UNBLOCK, &isigset, &osigset); kill(0, SIGTSTP); sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0); signal(SIGTSTP, stop_catcher); } static void -cont_catcher(signo) - int signo __attribute__((__unused__)); +cont_catcher(int signo __attribute__((__unused__))) { noecho(); raw(); @@ -627,8 +611,7 @@ cont_catcher(signo) * It would mean reformatting the entire display */ static void -winch_catcher(signo) - int signo __attribute__((__unused__)); +winch_catcher(int signo __attribute__((__unused__))) { struct winsize win; @@ -641,7 +624,7 @@ winch_catcher(signo) } static void -tty_cleanup() +tty_cleanup(void) { move(nlines - 1, 0); refresh(); @@ -651,8 +634,7 @@ tty_cleanup() } static void -tty_showboard(b) - const char *b; +tty_showboard(const char *b) { int i; int line; |