Commit 3c9a4850 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(read_config_file): Variable removed.

(CONFIG_FILE): Now static.
(default_config): New static variable.
(get_default_config_file_name): New function.
(free_default_config_file_name): New function.
(DEFAULT_DBASE_DIR): Removed.
parent 49324194
/*
* $Id: server-config.c,v 0.94 2003/08/14 23:01:13 ceder Exp $
* $Id: server-config.c,v 0.95 2003/08/15 19:46:09 ceder Exp $
* Copyright (C) 1991-1999, 2001-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -70,7 +70,6 @@
#endif
struct kom_par param;
char *read_config_file;
static Success log_param(const char *val, const struct parameter *par);
static Success jubel(const char *val, const struct parameter *par);
......@@ -532,14 +531,42 @@ static const struct parameter parameters[] = {
/* Where to save things. These are used by lyskomd and dbck. */
/*
* DEFAULT_DBASE_DIR can be overriden in the config file. The default
* config file is found in DEFAULT_DBASE_DIR/CONFIG_FILE (before
* DEFAULT_DBASE_DIR is overriden, of course).
*/
static const char *CONFIG_FILE = "etc/config";
static const char *default_config = NULL;
const char *
get_default_config_file_name(void)
{
if (default_config == NULL)
{
if (CONFIG_FILE[0] == '/')
default_config = CONFIG_FILE;
else
{
char *cfg = smalloc(strlen(DEFAULT_PREFIX)
+ strlen(CONFIG_FILE) + 2);
sprintf(cfg, "%s/%s", DEFAULT_PREFIX, CONFIG_FILE);
default_config = cfg;
}
}
return default_config;
}
void
free_default_config_file_name(void)
{
if (default_config != NULL && default_config != CONFIG_FILE)
{
/* cast away const; this string was allocated by
get_default_config_file_name(). */
sfree((char*)default_config);
}
default_config = NULL;
}
const char * DEFAULT_DBASE_DIR = DEFAULT_PREFIX;
const char *CONFIG_FILE = "etc/config";
/* This file descriptor, and any above it, will not be used by lyskomd. */
int fd_ceiling = 0; /* Initialized by main(). */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment