From 7a606e3ec496a601b985c876de18f4f807a53a61 Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 30 Mar 2014 05:44:55 +0000 Subject: [PATCH] don't use the preprocessor to rename curses functions, just call them --- games/hunt/hunt/hunt.c | 23 ++++++++++----------- games/hunt/hunt/playit.c | 43 +++++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/games/hunt/hunt/hunt.c b/games/hunt/hunt/hunt.c index 9396d3f44dde..174c1d5ed782 100644 --- a/games/hunt/hunt/hunt.c +++ b/games/hunt/hunt/hunt.c @@ -1,4 +1,4 @@ -/* $NetBSD: hunt.c,v 1.55 2014/03/30 05:30:28 dholland Exp $ */ +/* $NetBSD: hunt.c,v 1.56 2014/03/30 05:44:55 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hunt.c,v 1.55 2014/03/30 05:30:28 dholland Exp $"); +__RCSID("$NetBSD: hunt.c,v 1.56 2014/03/30 05:44:55 dholland Exp $"); #endif /* not lint */ #include @@ -53,9 +53,6 @@ __RCSID("$NetBSD: hunt.c,v 1.55 2014/03/30 05:30:28 dholland Exp $"); #include "pathnames.h" #include "hunt_private.h" -#define clear_eol() clrtoeol() -#define put_ch addch -#define put_str addstr #ifdef OVERRIDE_PATH_HUNTD static const char Driver[] = OVERRIDE_PATH_HUNTD; @@ -407,17 +404,17 @@ find_driver(void) } else { clear_the_screen(); move(1, 0); - put_str("Pick one:"); + addstr("Pick one:"); for (i = 0; i < HEIGHT - 4 && i < (int)num; i++) { move(3 + i, 0); host = serverlist_gethost(i, &hostlen); (void) snprintf(buf, sizeof(buf), "%8c %.64s", 'a' + i, lookuphost(host, hostlen)); - put_str(buf); + addstr(buf); } move(4 + i, 0); - put_str("Enter letter: "); + addstr("Enter letter: "); refresh(); while (1) { c = getchar(); @@ -481,7 +478,7 @@ start_driver(void) #endif move(HEIGHT, 0); - put_str("Starting..."); + addstr("Starting..."); refresh(); procid = fork(); if (procid == -1) { @@ -505,7 +502,7 @@ start_driver(void) _exit(1); } move(HEIGHT, 0); - put_str("Connecting..."); + addstr("Connecting..."); refresh(); } @@ -583,8 +580,8 @@ intr(int dummy __unused) (void) signal(SIGINT, SIG_IGN); getyx(stdscr, y, x); move(HEIGHT, 0); - put_str("Really quit? "); - clear_eol(); + addstr("Really quit? "); + clrtoeol(); refresh(); explained = false; for (;;) { @@ -605,7 +602,7 @@ intr(int dummy __unused) return; } if (!explained) { - put_str("(Yes or No) "); + addstr("(Yes or No) "); refresh(); explained = true; } diff --git a/games/hunt/hunt/playit.c b/games/hunt/hunt/playit.c index 1f26ae83dec6..0b364e019b48 100644 --- a/games/hunt/hunt/playit.c +++ b/games/hunt/hunt/playit.c @@ -1,4 +1,4 @@ -/* $NetBSD: playit.c,v 1.23 2014/03/30 05:41:50 dholland Exp $ */ +/* $NetBSD: playit.c,v 1.24 2014/03/30 05:44:55 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: playit.c,v 1.23 2014/03/30 05:41:50 dholland Exp $"); +__RCSID("$NetBSD: playit.c,v 1.24 2014/03/30 05:44:55 dholland Exp $"); #endif /* not lint */ #include @@ -53,9 +53,6 @@ __RCSID("$NetBSD: playit.c,v 1.23 2014/03/30 05:41:50 dholland Exp $"); #define FREAD 1 #endif -#define clear_eol() clrtoeol() -#define put_ch addch -#define put_str addstr static int nchar_send; #ifdef OTTO @@ -132,10 +129,10 @@ playit(void) break; } #endif - put_ch(ch); + addch(ch); break; case CLRTOEOL: - clear_eol(); + clrtoeol(); break; case CLEAR: clear_the_screen(); @@ -187,7 +184,7 @@ playit(void) break; } #endif - put_ch(ch); + addch(ch); break; } } @@ -295,8 +292,8 @@ quit(int old_status) return Q_CLOAK; #endif move(HEIGHT, 0); - put_str("Re-enter game [ynwo]? "); - clear_eol(); + addstr("Re-enter game [ynwo]? "); + clrtoeol(); explain = false; for (;;) { refresh(); @@ -311,8 +308,8 @@ quit(int old_status) return Q_QUIT; #else move(HEIGHT, 0); - put_str("Write a parting message [yn]? "); - clear_eol(); + addstr("Write a parting message [yn]? "); + clrtoeol(); refresh(); for (;;) { if (isupper(ch = getchar())) @@ -332,8 +329,8 @@ quit(int old_status) get_message: c = ch; /* save how we got here */ move(HEIGHT, 0); - put_str("Message: "); - clear_eol(); + addstr("Message: "); + clrtoeol(); refresh(); cp = buf; for (;;) { @@ -346,7 +343,7 @@ get_message: getyx(stdscr, y, x); move(y, x - 1); cp -= 1; - clear_eol(); + clrtoeol(); } continue; } @@ -355,13 +352,13 @@ get_message: getyx(stdscr, y, x); move(y, x - (cp - buf)); cp = buf; - clear_eol(); + clrtoeol(); continue; } else if (!isprint(ch)) { beep(); continue; } - put_ch(ch); + addch(ch); *cp++ = ch; if (cp + 1 >= buf + sizeof buf) break; @@ -373,18 +370,18 @@ get_message: #endif beep(); if (!explain) { - put_str("(Yes, No, Write message, or Options) "); + addstr("(Yes, No, Write message, or Options) "); explain = true; } } move(HEIGHT, 0); #ifdef FLY - put_str("Scan, Cloak, Flying, or Quit? "); + addstr("Scan, Cloak, Flying, or Quit? "); #else - put_str("Scan, Cloak, or Quit? "); + addstr("Scan, Cloak, or Quit? "); #endif - clear_eol(); + clrtoeol(); refresh(); explain = false; for (;;) { @@ -403,9 +400,9 @@ get_message: beep(); if (!explain) { #ifdef FLY - put_str("[SCFQ] "); + addstr("[SCFQ] "); #else - put_str("[SCQ] "); + addstr("[SCQ] "); #endif explain = true; }