(datadir, edatadir, gamedir): Rename to avoid confusion with Autoconf
output variable datadir and with configuration data.
This commit is contained in:
parent
58f67c8e19
commit
5282f500b5
6 changed files with 15 additions and 15 deletions
6
Make.mk
6
Make.mk
|
@ -65,7 +65,7 @@ scripts = $(srcdir)/src/scripts
|
||||||
depcomp = $(SHELL) $(srcdir)/depcomp
|
depcomp = $(SHELL) $(srcdir)/depcomp
|
||||||
tarball = $(SHELL) $(scripts)/tarball
|
tarball = $(SHELL) $(scripts)/tarball
|
||||||
econfig := $(sysconfdir)/empire/econfig
|
econfig := $(sysconfdir)/empire/econfig
|
||||||
edatadir := $(localstatedir)/empire
|
gamedir := $(localstatedir)/empire
|
||||||
einfodir := $(datadir)/empire/info.nr
|
einfodir := $(datadir)/empire/info.nr
|
||||||
ehtmldir := $(datadir)/empire/info.html
|
ehtmldir := $(datadir)/empire/info.html
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ ehtmldir := $(datadir)/empire/info.html
|
||||||
subst.in = sed \
|
subst.in = sed \
|
||||||
-e 's?@configure_input\@?$(notdir $@). Generated from $(notdir $<) by GNUmakefile.?g' \
|
-e 's?@configure_input\@?$(notdir $@). Generated from $(notdir $<) by GNUmakefile.?g' \
|
||||||
-e 's?@econfig\@?$(econfig)?g' \
|
-e 's?@econfig\@?$(econfig)?g' \
|
||||||
-e 's?@edatadir\@?$(edatadir)?g' \
|
-e 's?@gamedir\@?$(gamedir)?g' \
|
||||||
-e 's?@einfodir\@?$(einfodir)?g' \
|
-e 's?@einfodir\@?$(einfodir)?g' \
|
||||||
-e 's/@EMPIREHOST\@/$(EMPIREHOST)/g' \
|
-e 's/@EMPIREHOST\@/$(EMPIREHOST)/g' \
|
||||||
-e 's/@EMPIREPORT\@/$(EMPIREPORT)/g'
|
-e 's/@EMPIREPORT\@/$(EMPIREPORT)/g'
|
||||||
|
@ -186,7 +186,7 @@ install: all installdirs
|
||||||
|
|
||||||
.PHONY: installdirs
|
.PHONY: installdirs
|
||||||
installdirs:
|
installdirs:
|
||||||
mkdir -p $(bindir) $(sbindir) $(edatadir) $(einfodir) $(mandir)/man1 $(mandir)/man6 $(dir $(econfig))
|
mkdir -p $(bindir) $(sbindir) $(gamedir) $(einfodir) $(mandir)/man1 $(mandir)/man6 $(dir $(econfig))
|
||||||
|
|
||||||
.PHONY: install-html
|
.PHONY: install-html
|
||||||
install-html: html | $(ehtmldir)
|
install-html: html | $(ehtmldir)
|
||||||
|
|
|
@ -67,7 +67,7 @@ EMPCFBOTH((fvname), (vname), int, NSC_INT, KM_OPTION, (descr))
|
||||||
/* econfig key definitions: */
|
/* econfig key definitions: */
|
||||||
|
|
||||||
EMPCF_COMMENT("\n### Server configuration and information")
|
EMPCF_COMMENT("\n### Server configuration and information")
|
||||||
EMPCFBOTH("data", datadir, char *, NSC_STRING, KM_INTERNAL,
|
EMPCFBOTH("data", gamedir, char *, NSC_STRING, KM_INTERNAL,
|
||||||
"Directory where this game's data is stored")
|
"Directory where this game's data is stored")
|
||||||
EMPCFBOTH("info", infodir, char *, NSC_STRING, KM_INTERNAL,
|
EMPCFBOTH("info", infodir, char *, NSC_STRING, KM_INTERNAL,
|
||||||
"Directory where info pages are stored, can be shared among games")
|
"Directory where info pages are stored, can be shared among games")
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
char dflt_econfig[] = "@econfig@";
|
char dflt_econfig[] = "@econfig@";
|
||||||
char *infodir = "@einfodir@";
|
char *infodir = "@einfodir@";
|
||||||
char *datadir = "@edatadir@";
|
char *gamedir = "@gamedir@";
|
||||||
|
|
||||||
/* relative to DATADIR */
|
/* relative to DATADIR */
|
||||||
char *teldir = "tel";
|
char *teldir = "tel";
|
||||||
|
|
|
@ -202,8 +202,8 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
if (emp_config(config_file) < 0)
|
if (emp_config(config_file) < 0)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
if (chdir(datadir)) {
|
if (chdir(gamedir)) {
|
||||||
fprintf(stderr, "Can't chdir to %s (%s)\n", datadir, strerror(errno));
|
fprintf(stderr, "Can't chdir to %s (%s)\n", gamedir, strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,8 +435,8 @@ allocate_memory(void)
|
||||||
int i;
|
int i;
|
||||||
char *fname;
|
char *fname;
|
||||||
|
|
||||||
fname = malloc(strlen(datadir) + 1 + strlen(empfile[EF_SECTOR].file) + 1);
|
fname = malloc(strlen(gamedir) + 1 + strlen(empfile[EF_SECTOR].file) + 1);
|
||||||
sprintf(fname, "%s/%s", datadir, empfile[EF_SECTOR].file);
|
sprintf(fname, "%s/%s", gamedir, empfile[EF_SECTOR].file);
|
||||||
sect_fptr = fopen(fname, "wb");
|
sect_fptr = fopen(fname, "wb");
|
||||||
if (sect_fptr == NULL) {
|
if (sect_fptr == NULL) {
|
||||||
perror(fname);
|
perror(fname);
|
||||||
|
|
|
@ -119,19 +119,19 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
ef_init();
|
ef_init();
|
||||||
|
|
||||||
if (access(datadir, F_OK) < 0 && mkdir(datadir, 0750) < 0) {
|
if (access(gamedir, F_OK) < 0 && mkdir(gamedir, 0750) < 0) {
|
||||||
perror(datadir);
|
perror(gamedir);
|
||||||
printf("Can't make game directory\n");
|
printf("Can't make game directory\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (chdir(datadir)) {
|
if (chdir(gamedir)) {
|
||||||
fprintf(stderr, "Can't chdir to %s (%s)\n", datadir, strerror(errno));
|
fprintf(stderr, "Can't chdir to %s (%s)\n", gamedir, strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force) {
|
if (!force) {
|
||||||
printf("WARNING: this blasts the existing game in %s (if any)\n",
|
printf("WARNING: this blasts the existing game in %s (if any)\n",
|
||||||
datadir);
|
gamedir);
|
||||||
printf("continue? ");
|
printf("continue? ");
|
||||||
fgets(buf, sizeof(buf), stdin);
|
fgets(buf, sizeof(buf), stdin);
|
||||||
if (*buf != 'y' && *buf != 'Y')
|
if (*buf != 'y' && *buf != 'Y')
|
||||||
|
@ -188,7 +188,7 @@ main(int argc, char *argv[])
|
||||||
close(creat(timestampfil, 0600));
|
close(creat(timestampfil, 0600));
|
||||||
close(creat(annfil, 0600));
|
close(creat(annfil, 0600));
|
||||||
chmod(infodir, 0750);
|
chmod(infodir, 0750);
|
||||||
chmod(datadir, 0770);
|
chmod(gamedir, 0770);
|
||||||
chmod(teldir, 0770);
|
chmod(teldir, 0770);
|
||||||
|
|
||||||
/* create a zero-filled sector file */
|
/* create a zero-filled sector file */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue