/*
* 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;
#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
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;
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;
}
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);
}
#endif /* !_WIN32 */
+ schedulefil = malloc(strlen(configdir) + 10);
+ sprintf(schedulefil, "%s/schedule", configdir);
+
free(cwd);
}