]> git.pond.sub.org Git - empserver/blobdiff - src/lib/gen/emp_config.c
Update copyright notice
[empserver] / src / lib / gen / emp_config.c
index e63912b99367201cd5fa51a04563acd3a01eb279..7997b9a54ab2bdda75befad749d89558d5e3f9b7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 #include <config.h>
 
 #include <assert.h>
+#include <ctype.h>
 #include <errno.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
-#ifdef _WIN32
-#include <direct.h>
-#endif
+#include <unistd.h>
 
-#include "misc.h"
 #include "file.h"
+#include "misc.h"
 #include "optlist.h"
-#include "gen.h"
+#include "prototypes.h"
 
 /* Dummy one */
 static int emp_config_dummy;
@@ -67,8 +65,8 @@ struct keymatch configkeys[] = {
 #undef EMP_CONFIG_C_OUTPUT
 };
 
-static struct keymatch *keylookup(s_char *key, struct keymatch tbl[]);
-static void set_dirs(char *);
+static struct keymatch *keylookup(char *key, struct keymatch tbl[]);
+static void set_paths(char *);
 
 /*
  * read in empire configuration
@@ -101,7 +99,7 @@ emp_config(char *file)
        for (i = 0; buf[i] && isspace(buf[i]); ++i) ;
        if (!buf[i] || buf[i] == '#')
            continue;
-       if (parse(buf, av, NULL, scanspace, NULL) < 0) {
+       if (parse(buf, scanspace, av, NULL, NULL, NULL) < 0) {
            fprintf(stderr, "%s:%d: Can't parse line %s", file, lno, buf);
            errors = 1;
            continue;
@@ -152,16 +150,16 @@ emp_config(char *file)
 
 done:
     WORLD_X &= ~1;             /* force even */
-    set_dirs(file);
+    set_paths(file);
 
     return -errors;
 }
 
 /* find the key in the table */
 static struct keymatch *
-keylookup(register s_char *command, struct keymatch *tbl)
+keylookup(char *command, struct keymatch *tbl)
 {
-    register struct keymatch *kp;
+    struct keymatch *kp;
 
     if (command == 0 || *command == 0)
        return 0;
@@ -173,12 +171,13 @@ keylookup(register s_char *command, struct keymatch *tbl)
 }
 
 static void
-set_dirs(char *econfig)
+set_paths(char *econfig)
 {
     char *slash;
     char *cwd = getcwd(NULL, 0);
 
 #ifdef _WIN32
+    /* normalize path separator to '\\', for easier searching: */
     econfig = _fullpath(NULL, econfig, 0);
     slash = strrchr(econfig, '\\');
     configdir = malloc(slash - econfig + 1);
@@ -202,6 +201,9 @@ set_dirs(char *econfig)
     }
 #endif /* !_WIN32 */
 
+    schedulefil = malloc(strlen(configdir) + 10);
+    sprintf(schedulefil, "%s/schedule", configdir);
+
     free(cwd);
 }