Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/hunt/hunt don't use the preprocessor to rename curses ...



details:   https://anonhg.NetBSD.org/src/rev/4a22505603cd
branches:  trunk
changeset: 328289:4a22505603cd
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Mar 30 05:44:55 2014 +0000

description:
don't use the preprocessor to rename curses functions, just call them

diffstat:

 games/hunt/hunt/hunt.c   |  23 ++++++++++-------------
 games/hunt/hunt/playit.c |  43 ++++++++++++++++++++-----------------------
 2 files changed, 30 insertions(+), 36 deletions(-)

diffs (230 lines):

diff -r a5508f430bad -r 4a22505603cd games/hunt/hunt/hunt.c
--- a/games/hunt/hunt/hunt.c    Sun Mar 30 05:41:50 2014 +0000
+++ b/games/hunt/hunt/hunt.c    Sun Mar 30 05:44:55 2014 +0000
@@ -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 <sys/cdefs.h>
 #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 <sys/param.h>
@@ -53,9 +53,6 @@
 #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 @@
        } 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 @@
 #endif
 
        move(HEIGHT, 0);
-       put_str("Starting...");
+       addstr("Starting...");
        refresh();
        procid = fork();
        if (procid == -1) {
@@ -505,7 +502,7 @@
                _exit(1);
        }
        move(HEIGHT, 0);
-       put_str("Connecting...");
+       addstr("Connecting...");
        refresh();
 }
 
@@ -583,8 +580,8 @@
        (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 @@
                        return;
                }
                if (!explained) {
-                       put_str("(Yes or No) ");
+                       addstr("(Yes or No) ");
                        refresh();
                        explained = true;
                }
diff -r a5508f430bad -r 4a22505603cd games/hunt/hunt/playit.c
--- a/games/hunt/hunt/playit.c  Sun Mar 30 05:41:50 2014 +0000
+++ b/games/hunt/hunt/playit.c  Sun Mar 30 05:44:55 2014 +0000
@@ -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 <sys/cdefs.h>
 #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 <sys/file.h>
@@ -53,9 +53,6 @@
 #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 @@
                                break;
                        }
 #endif
-                       put_ch(ch);
+                       addch(ch);
                        break;
                  case CLRTOEOL:
-                       clear_eol();
+                       clrtoeol();
                        break;
                  case CLEAR:
                        clear_the_screen();
@@ -187,7 +184,7 @@
                                break;
                        }
 #endif
-                       put_ch(ch);
+                       addch(ch);
                        break;
                }
        }
@@ -295,8 +292,8 @@
                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 @@
                        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 @@
 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 @@
                                                getyx(stdscr, y, x);
                                                move(y, x - 1);
                                                cp -= 1;
-                                               clear_eol();
+                                               clrtoeol();
                                        }
                                        continue;
                                }
@@ -355,13 +352,13 @@
                                        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 @@
 #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 @@
                beep();
                if (!explain) {
 #ifdef FLY
-                       put_str("[SCFQ] ");
+                       addstr("[SCFQ] ");
 #else
-                       put_str("[SCQ] ");
+                       addstr("[SCQ] ");
 #endif
                        explain = true;
                }



Home | Main Index | Thread Index | Old Index