]> git.pond.sub.org Git - empserver/commitdiff
(configdir): New, to be used for loading configuration tables.
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 18 Feb 2006 12:43:17 +0000 (12:43 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 18 Feb 2006 12:43:17 +0000 (12:43 +0000)
(emp_config): Set it to econfig's directory.

include/optlist.h
src/lib/gen/emp_config.c
src/lib/global/path.c.in

index efee4a8069199c305019a99bf5615b9ec0a1282f..44372c50f0946f36fb997a6f5a826ff0118ebbc6 100644 (file)
@@ -37,7 +37,6 @@
 
 #include "nsc.h"
 
-/* Default econfig file */
 extern char dflt_econfig[];
 
 /* Game parameters, can be set in econfig */
@@ -45,7 +44,8 @@ extern char dflt_econfig[];
 #include "econfig-spec.h"
 #undef EMP_CONFIG_H_OUTPUT
 
-/* Variables that get values derived from econfig */
+extern char *configdir;
+
 extern char *motdfil;
 extern char *downfil;
 extern char *disablefil;
index 1f31a597bf8680efbd5762dfa6892212e0ec1cb6..fba69426316e714c1823c2cd1769063f2fdf687f 100644 (file)
@@ -78,6 +78,7 @@ emp_config(char *file)
     char scanspace[1024];
     char *av[128];
     char buf[1024];
+    char *slash;
     struct keymatch *kp;
     int lno = 0;
     int errors = 0;
@@ -94,6 +95,11 @@ emp_config(char *file)
        return -1;
     }
 
+    if ((slash = strrchr(file, '/')))
+       configdir = strndup(file, slash + 1 - file);
+    else
+       configdir = NULL;
+
     while (fgets(buf, sizeof buf, fp) != NULL) {
        ++lno;
        for (i = 0; buf[i] && isspace(buf[i]); ++i) ;
index b1b70ebc9c2508dd95d229f27c60c795d2e499e3..37e9b9ef85a1b92ea8c878e9f2514a89a1caecb5 100644 (file)
 
 #include "optlist.h"
 
+/* econfig file to try when user doesn't specify one */
 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@";
+
+/* Where this game's data is stored */
 char *gamedir  = "@gamedir@";
 
 /* relative to DATADIR */