(configdir): New, to be used for loading configuration tables.
(emp_config): Set it to econfig's directory.
This commit is contained in:
parent
376d87c3a0
commit
e4865d473e
3 changed files with 16 additions and 2 deletions
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
#include "nsc.h"
|
#include "nsc.h"
|
||||||
|
|
||||||
/* Default econfig file */
|
|
||||||
extern char dflt_econfig[];
|
extern char dflt_econfig[];
|
||||||
|
|
||||||
/* Game parameters, can be set in econfig */
|
/* Game parameters, can be set in econfig */
|
||||||
|
@ -45,7 +44,8 @@ extern char dflt_econfig[];
|
||||||
#include "econfig-spec.h"
|
#include "econfig-spec.h"
|
||||||
#undef EMP_CONFIG_H_OUTPUT
|
#undef EMP_CONFIG_H_OUTPUT
|
||||||
|
|
||||||
/* Variables that get values derived from econfig */
|
extern char *configdir;
|
||||||
|
|
||||||
extern char *motdfil;
|
extern char *motdfil;
|
||||||
extern char *downfil;
|
extern char *downfil;
|
||||||
extern char *disablefil;
|
extern char *disablefil;
|
||||||
|
|
|
@ -78,6 +78,7 @@ emp_config(char *file)
|
||||||
char scanspace[1024];
|
char scanspace[1024];
|
||||||
char *av[128];
|
char *av[128];
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
char *slash;
|
||||||
struct keymatch *kp;
|
struct keymatch *kp;
|
||||||
int lno = 0;
|
int lno = 0;
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
|
@ -94,6 +95,11 @@ emp_config(char *file)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((slash = strrchr(file, '/')))
|
||||||
|
configdir = strndup(file, slash + 1 - file);
|
||||||
|
else
|
||||||
|
configdir = NULL;
|
||||||
|
|
||||||
while (fgets(buf, sizeof buf, fp) != NULL) {
|
while (fgets(buf, sizeof buf, fp) != NULL) {
|
||||||
++lno;
|
++lno;
|
||||||
for (i = 0; buf[i] && isspace(buf[i]); ++i) ;
|
for (i = 0; buf[i] && isspace(buf[i]); ++i) ;
|
||||||
|
|
|
@ -37,8 +37,16 @@
|
||||||
|
|
||||||
#include "optlist.h"
|
#include "optlist.h"
|
||||||
|
|
||||||
|
/* econfig file to try when user doesn't specify one */
|
||||||
char dflt_econfig[] = "@econfig@";
|
char dflt_econfig[] = "@econfig@";
|
||||||
|
|
||||||
|
/* Where to find configuration, which is wherever econfig is looked for */
|
||||||
|
char *configdir;
|
||||||
|
|
||||||
|
/* Where to find info pages */
|
||||||
char *infodir = "@einfodir@";
|
char *infodir = "@einfodir@";
|
||||||
|
|
||||||
|
/* Where this game's data is stored */
|
||||||
char *gamedir = "@gamedir@";
|
char *gamedir = "@gamedir@";
|
||||||
|
|
||||||
/* relative to DATADIR */
|
/* relative to DATADIR */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue