diff options
| author | lukem <lukem@NetBSD.org> | 1997-10-10 16:32:15 +0000 |
|---|---|---|
| committer | lukem <lukem@NetBSD.org> | 1997-10-10 16:32:15 +0000 |
| commit | 50f99331097302f77db413ba7ad7299d928163eb (patch) | |
| tree | 376410fecfef0c2ac47f5b4f0643e6a84a373cdc /hunt/huntd/terminal.c | |
| parent | a25e10613cc56cac1b954b119f757a272dee9bc8 (diff) | |
| download | bsdgames-darwin-50f99331097302f77db413ba7ad7299d928163eb.tar.gz bsdgames-darwin-50f99331097302f77db413ba7ad7299d928163eb.zip | |
Yet Another Monster Commit:
- WARNSify
- getopt returns -1 not EOF
- select() uses an fd_set, not int/long; modify code to use FD_* et al
instead of direct bitwise operations
- in otto.c::look (renamed to ottolook() to prevent name clash), the
case WEST section had a 'goto cont_east', instead of 'goto cont_west'.
(picked up by WARNS=1, because cont_west was an unused label because
of this typo). probably meant that otto got lost in the maze :-/
- deprecate register, convert bcmp() -> memcmp()
Diffstat (limited to 'hunt/huntd/terminal.c')
| -rw-r--r-- | hunt/huntd/terminal.c | 71 |
1 files changed, 53 insertions, 18 deletions
diff --git a/hunt/huntd/terminal.c b/hunt/huntd/terminal.c index 13d34850..94493531 100644 --- a/hunt/huntd/terminal.c +++ b/hunt/huntd/terminal.c @@ -1,9 +1,20 @@ +/* $NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $ */ /* * Hunt * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold * San Francisco, California */ +#include <sys/cdefs.h> +#ifndef lint +__RCSID("$NetBSD: terminal.c,v 1.2 1997/10/10 16:34:05 lukem Exp $"); +#endif /* not lint */ + +#if __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif # include "hunt.h" # define TERM_WIDTH 80 /* Assume terminals are 80-char wide */ @@ -12,9 +23,10 @@ * Move the cursor to the given position on the given player's * terminal. */ +void cgoto(pp, y, x) -register PLAYER *pp; -register int y, x; + PLAYER *pp; + int y, x; { if (x == pp->p_curx && y == pp->p_cury) return; @@ -27,9 +39,10 @@ register int y, x; * outch: * Put out a single character. */ +void outch(pp, ch) -register PLAYER *pp; -char ch; + PLAYER *pp; + char ch; { if (++pp->p_curx >= TERM_WIDTH) { pp->p_curx = 0; @@ -42,10 +55,11 @@ char ch; * outstr: * Put out a string of the given length. */ +void outstr(pp, str, len) -register PLAYER *pp; -register char *str; -register int len; + PLAYER *pp; + char *str; + int len; { pp->p_curx += len; pp->p_cury += (pp->p_curx / TERM_WIDTH); @@ -58,8 +72,9 @@ register int len; * clrscr: * Clear the screen, and reset the current position on the screen. */ +void clrscr(pp) -register PLAYER *pp; + PLAYER *pp; { sendcom(pp, CLEAR); pp->p_cury = 0; @@ -70,41 +85,61 @@ register PLAYER *pp; * ce: * Clear to the end of the line */ +void ce(pp) -PLAYER *pp; + PLAYER *pp; { sendcom(pp, CLRTOEOL); } +#if 0 /* XXX lukem*/ /* * ref; * Refresh the screen */ +void ref(pp) -register PLAYER *pp; + PLAYER *pp; { sendcom(pp, REFRESH); } +#endif /* * sendcom: * Send a command to the given user */ -/* VARARGS2 */ -sendcom(pp, command, arg1, arg2) -register PLAYER *pp; -register int command; -int arg1, arg2; +void +#if __STDC__ +sendcom(PLAYER *pp, int command, ...) +#else +sendcom(pp, command, va_alist) + PLAYER *pp; + int command; + va_dcl +#endif { + va_list ap; + int arg1, arg2; +#if __STDC__ + va_start(ap, command); +#else + va_start(ap); +#endif (void) putc(command, pp->p_output); switch (command & 0377) { - case MOVE: + case MOVE: + arg1 = va_arg(ap, int); + arg2 = va_arg(ap, int); (void) putc(arg1, pp->p_output); (void) putc(arg2, pp->p_output); break; - case ADDCH: - case READY: + case ADDCH: + case READY: + arg1 = va_arg(ap, int); (void) putc(arg1, pp->p_output); break; } + + va_end(ap); /* No return needed for void functions. */ } |
