handle compiled-in pathnames the customary way

This commit is contained in:
dholland 2014-03-29 22:11:19 +00:00
parent af8c06ff02
commit 98db4e3267
4 changed files with 56 additions and 13 deletions

View File

@ -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"

View File

@ -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 @@ __RCSID("$NetBSD: hunt.c,v 1.45 2014/03/29 22:05:44 dholland Exp $");
#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

View File

@ -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 @@ __RCSID("$NetBSD: driver.c,v 1.30 2014/03/29 21:55:59 dholland Exp $");
#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;

View File

@ -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"