Source-Changes-HG archive

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

[src/trunk]: src/games/hunt handle compiled-in pathnames the customary way



details:   https://anonhg.NetBSD.org/src/rev/11dab0fccb3d
branches:  trunk
changeset: 794994:11dab0fccb3d
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 29 22:11:19 2014 +0000

description:
handle compiled-in pathnames the customary way

diffstat:

 games/hunt/Makefile.inc        |   9 +++++++--
 games/hunt/hunt/hunt.c         |  13 +++++++------
 games/hunt/huntd/driver.c      |  12 +++++++-----
 games/hunt/include/pathnames.h |  35 +++++++++++++++++++++++++++++++++++
 4 files changed, 56 insertions(+), 13 deletions(-)

diffs (152 lines):

diff -r 19750cfa3e16 -r 11dab0fccb3d games/hunt/Makefile.inc
--- a/games/hunt/Makefile.inc   Sat Mar 29 22:05:44 2014 +0000
+++ b/games/hunt/Makefile.inc   Sat Mar 29 22:11:19 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.11 2009/07/04 07:51:34 dholland Exp $
+#      $NetBSD: Makefile.inc,v 1.12 2014/03/29 22:11:19 dholland Exp $
 #
 #
 #  Hunt
@@ -49,6 +49,11 @@
                -DOTTO
 
 #
+# Perhaps, compile in a specific non-default huntd to run, for debugging:
+#CPPFLAGS+=    -DOVERRIDE_PATH_HUNTD=\"/home/socr/a/conrad/games/src/hunt/huntd.dbg\"
+
+
+#
 # System parameter flags are:
 #      DEBUG           Don't trust everything in the code
 #      INTERNET        Use the Internet domain IPC instead of UNIX domain
@@ -82,6 +87,6 @@
 # Generic definitions
 #
 DEFS=          $(GAME_PARAM) $(DEFS_BSD44)
-CPPFLAGS+=     $(SYSCFLAGS) $(DEFS) -DHUNTD=\"/usr/games/huntd\"
+CPPFLAGS+=     $(SYSCFLAGS) $(DEFS)
 
 .include "../Makefile.inc"
diff -r 19750cfa3e16 -r 11dab0fccb3d games/hunt/hunt/hunt.c
--- a/games/hunt/hunt/hunt.c    Sat Mar 29 22:05:44 2014 +0000
+++ b/games/hunt/hunt/hunt.c    Sat Mar 29 22:11:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hunt.c,v 1.45 2014/03/29 22:05:44 dholland Exp $       */
+/*     $NetBSD: hunt.c,v 1.46 2014/03/29 22:11:19 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.45 2014/03/29 22:05:44 dholland Exp $");
+__RCSID("$NetBSD: hunt.c,v 1.46 2014/03/29 22:11:19 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -50,22 +50,23 @@
 #include <ifaddrs.h>
 
 #include "hunt_common.h"
+#include "pathnames.h"
 #include "hunt_private.h"
 
 #define clear_eol()    clrtoeol()
 #define put_ch         addch
 #define put_str                addstr
 
-#ifdef DEBUG
-static const char Driver[] = "/home/socr/a/conrad/games/src/hunt/huntd.dbg";
+#ifdef OVERRIDE_PATH_HUNTD
+static const char Driver[] = OVERRIDE_PATH_HUNTD;
 #else
-static const char Driver[] = HUNTD;
+static const char Driver[] = PATH_HUNTD;
 #endif
 
 #ifdef INTERNET
 static uint16_t Test_port = TEST_PORT;
 #else
-static const char Sock_name[] = "/tmp/hunt";
+static const char Sock_name[] = PATH_HUNTSOCKET;
 #endif
 
 
diff -r 19750cfa3e16 -r 11dab0fccb3d games/hunt/huntd/driver.c
--- a/games/hunt/huntd/driver.c Sat Mar 29 22:05:44 2014 +0000
+++ b/games/hunt/huntd/driver.c Sat Mar 29 22:11:19 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: driver.c,v 1.30 2014/03/29 21:55:59 dholland Exp $     */
+/*     $NetBSD: driver.c,v 1.31 2014/03/29 22:11:19 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: driver.c,v 1.30 2014/03/29 21:55:59 dholland Exp $");
+__RCSID("$NetBSD: driver.c,v 1.31 2014/03/29 22:11:19 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/ioctl.h>
@@ -43,14 +43,16 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include"hunt.h"
+
+#include "hunt.h"
+#include "pathnames.h"
 
 
 #ifdef INTERNET
 static uint16_t Test_port = TEST_PORT;
 #else
-static const char Sock_name[] = "/tmp/hunt";
-static const char Stat_name[] = "/tmp/hunt.stats";
+static const char Sock_name[] = PATH_HUNTSOCKET;
+static const char Stat_name[] = PATH_STATSOCKET;
 #endif
 
 static SOCKET Daemon;
diff -r 19750cfa3e16 -r 11dab0fccb3d games/hunt/include/pathnames.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/games/hunt/include/pathnames.h    Sat Mar 29 22:11:19 2014 +0000
@@ -0,0 +1,35 @@
+/*     $NetBSD: pathnames.h,v 1.1 2014/03/29 22:11:19 dholland Exp $   */
+/*
+ * Copyright (c) 1983-2003, 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:
+ * 
+ * + Redistributions of source code must retain the above copyright 
+ *   notice, this list of conditions and the following disclaimer.
+ * + 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.
+ * + Neither the name of the University of California, San Francisco 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 COPYRIGHT HOLDERS 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 COPYRIGHT 
+ * OWNER 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.
+ */
+
+#define PATH_HUNTD     "/usr/games/huntd"
+#define PATH_HUNTSOCKET        "/tmp/hunt"
+#define PATH_STATSOCKET        "/tmp/hunt.stats"



Home | Main Index | Thread Index | Old Index