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:
parent
9e10c33d22
commit
cb40c5ffc0
4
Makefile
4
Makefile
|
@ -1,4 +1,6 @@
|
|||
VERSION = 1.4.1
|
||||
# Hardcoded path to config file
|
||||
DEFCONFIG = /etc/dgamelaunch.conf
|
||||
NAME = dgamelaunch
|
||||
exclusions = CVS .svn .cvsignore tags
|
||||
PREFIX = /usr
|
||||
|
@ -38,7 +40,7 @@ CC = gcc
|
|||
LDFLAGS =
|
||||
CFLAGS = -g3 $(optimize) -Wall -Wno-unused $(DEFS)
|
||||
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
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LIBS = -lcurses -lcrypt $(LUTIL) -ll
|
||||
|
|
|
@ -162,45 +162,56 @@ create_config ()
|
|||
graceful_exit(104);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myconfig) /* a parse error occurred */
|
||||
{
|
||||
myconfig = &defconfig;
|
||||
return;
|
||||
}
|
||||
/* Fill the rest with defaults */
|
||||
if (!myconfig->shed_user && myconfig->shed_uid == -1)
|
||||
{
|
||||
struct passwd *pw;
|
||||
if ((pw = getpwnam(defconfig.shed_user)))
|
||||
myconfig->shed_uid = pw->pw_uid;
|
||||
else
|
||||
myconfig->shed_uid = defconfig.shed_uid;
|
||||
}
|
||||
|
||||
if (!myconfig->shed_group && myconfig->shed_gid == -1)
|
||||
{
|
||||
struct group *gr;
|
||||
if ((gr = getgrnam(defconfig.shed_group)))
|
||||
myconfig->shed_gid = gr->gr_gid;
|
||||
else
|
||||
myconfig->shed_gid = defconfig.shed_gid;
|
||||
}
|
||||
|
||||
if (myconfig->max == 0 && !set_max) myconfig->max = defconfig.max;
|
||||
if (!myconfig->banner) myconfig->banner = defconfig.banner;
|
||||
if (!myconfig->chroot) myconfig->chroot = defconfig.chroot;
|
||||
if (!myconfig->nethack) myconfig->nethack = defconfig.nethack;
|
||||
if (!myconfig->dglroot) myconfig->dglroot = defconfig.dglroot;
|
||||
if (!myconfig->rcfile) myconfig->rcfile = defconfig.rcfile;
|
||||
if (!myconfig->spool) myconfig->spool = defconfig.spool;
|
||||
if (!myconfig->passwd) myconfig->passwd = defconfig.passwd;
|
||||
if (!myconfig->lockfile) myconfig->lockfile = defconfig.lockfile;
|
||||
}
|
||||
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 */
|
||||
{
|
||||
myconfig = &defconfig;
|
||||
return;
|
||||
}
|
||||
/* Fill the rest with defaults */
|
||||
if (!myconfig->shed_user && myconfig->shed_uid == -1)
|
||||
{
|
||||
struct passwd *pw;
|
||||
if ((pw = getpwnam(defconfig.shed_user)))
|
||||
myconfig->shed_uid = pw->pw_uid;
|
||||
else
|
||||
myconfig->shed_uid = defconfig.shed_uid;
|
||||
}
|
||||
|
||||
if (!myconfig->shed_group && myconfig->shed_gid == -1)
|
||||
{
|
||||
struct group *gr;
|
||||
if ((gr = getgrnam(defconfig.shed_group)))
|
||||
myconfig->shed_gid = gr->gr_gid;
|
||||
else
|
||||
myconfig->shed_gid = defconfig.shed_gid;
|
||||
}
|
||||
|
||||
if (myconfig->max == 0 && !set_max) myconfig->max = defconfig.max;
|
||||
if (!myconfig->banner) myconfig->banner = defconfig.banner;
|
||||
if (!myconfig->chroot) myconfig->chroot = defconfig.chroot;
|
||||
if (!myconfig->nethack) myconfig->nethack = defconfig.nethack;
|
||||
if (!myconfig->dglroot) myconfig->dglroot = defconfig.dglroot;
|
||||
if (!myconfig->rcfile) myconfig->rcfile = defconfig.rcfile;
|
||||
if (!myconfig->spool) myconfig->spool = defconfig.spool;
|
||||
if (!myconfig->passwd) myconfig->passwd = defconfig.passwd;
|
||||
if (!myconfig->lockfile) myconfig->lockfile = defconfig.lockfile;
|
||||
}
|
||||
|
||||
/* ************************************************************* */
|
||||
|
|
Loading…
Reference in New Issue