DEFCONFIG holds path to config file, hardcoded, edit Makefile for this

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@243 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-02-17 02:44:33 +00:00
parent 9e10c33d22
commit cb40c5ffc0
2 changed files with 48 additions and 35 deletions

View File

@ -1,4 +1,6 @@
VERSION = 1.4.1 VERSION = 1.4.1
# Hardcoded path to config file
DEFCONFIG = /etc/dgamelaunch.conf
NAME = dgamelaunch NAME = dgamelaunch
exclusions = CVS .svn .cvsignore tags exclusions = CVS .svn .cvsignore tags
PREFIX = /usr PREFIX = /usr
@ -38,7 +40,7 @@ CC = gcc
LDFLAGS = LDFLAGS =
CFLAGS = -g3 $(optimize) -Wall -Wno-unused $(DEFS) CFLAGS = -g3 $(optimize) -Wall -Wno-unused $(DEFS)
INSTALL = install -c INSTALL = install -c
DEFS = -DVERSION=\"$(VERSION)\" DEFS = -DVERSION=\"$(VERSION)\" -DDEFCONFIG=\"$(DEFCONFIG)\"
SRCS = $(EDITOR) ttyrec.c dgamelaunch.c io.c ttyplay.c mygetnstr.c stripgfx.c strlcpy.c strlcat.c y.tab.c lex.yy.c SRCS = $(EDITOR) ttyrec.c dgamelaunch.c io.c ttyplay.c mygetnstr.c stripgfx.c strlcpy.c strlcat.c y.tab.c lex.yy.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)
LIBS = -lcurses -lcrypt $(LUTIL) -ll LIBS = -lcurses -lcrypt $(LUTIL) -ll

View File

@ -162,6 +162,22 @@ create_config ()
graceful_exit(104); graceful_exit(104);
return; return;
} }
}
else
{
#ifdef DEFCONFIG
config = DEFCONFIG;
if ((config_file = fopen(DEFCONFIG, "r")) != NULL)
{
yyin = config_file;
yyparse();
fclose(config_file);
}
#else
myconfig = &defconfig;
return;
#endif
}
if (!myconfig) /* a parse error occurred */ if (!myconfig) /* a parse error occurred */
{ {
@ -196,11 +212,6 @@ create_config ()
if (!myconfig->spool) myconfig->spool = defconfig.spool; if (!myconfig->spool) myconfig->spool = defconfig.spool;
if (!myconfig->passwd) myconfig->passwd = defconfig.passwd; if (!myconfig->passwd) myconfig->passwd = defconfig.passwd;
if (!myconfig->lockfile) myconfig->lockfile = defconfig.lockfile; if (!myconfig->lockfile) myconfig->lockfile = defconfig.lockfile;
}
else
{
myconfig = &defconfig;
}
} }
/* ************************************************************* */ /* ************************************************************* */