From: dholland Date: Sat, 29 Mar 2014 22:11:19 +0000 (+0000) Subject: handle compiled-in pathnames the customary way X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/commitdiff_plain/b8e5b1fd45eaa69e4942c4855a9d3c05fd14e554 handle compiled-in pathnames the customary way --- diff --git a/hunt/Makefile.inc b/hunt/Makefile.inc index 008fbae6..bcbded04 100644 --- a/hunt/Makefile.inc +++ b/hunt/Makefile.inc @@ -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 @@ -48,6 +48,11 @@ GAME_PARAM= -DRANDOM -DREFLECT -DMONITOR -DOOZE -DFLY -DVOLCANO -DBOOTS \ -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 @@ -82,6 +87,6 @@ SYSLIBS= # Generic definitions # DEFS= $(GAME_PARAM) $(DEFS_BSD44) -CPPFLAGS+= $(SYSCFLAGS) $(DEFS) -DHUNTD=\"/usr/games/huntd\" +CPPFLAGS+= $(SYSCFLAGS) $(DEFS) .include "../Makefile.inc" diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c index bfeac96b..696c2d58 100644 --- a/hunt/hunt/hunt.c +++ b/hunt/hunt/hunt.c @@ -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 #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 @@ -50,22 +50,23 @@ __RCSID("$NetBSD: hunt.c,v 1.45 2014/03/29 22:05:44 dholland Exp $"); #include #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 --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c index 1f37092b..88b497fb 100644 --- a/hunt/huntd/driver.c +++ b/hunt/huntd/driver.c @@ -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 #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 @@ -43,14 +43,16 @@ __RCSID("$NetBSD: driver.c,v 1.30 2014/03/29 21:55:59 dholland Exp $"); #include #include #include -#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 --git a/hunt/include/pathnames.h b/hunt/include/pathnames.h new file mode 100644 index 00000000..2595c9a0 --- /dev/null +++ b/hunt/include/pathnames.h @@ -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"