Commit e69f2ca1 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(struct parameter, log_param): Moved to server-config.c.

(init_data_base): Removed code to build an empty data base.
(dump_exit_statistics): Call free_all_jubel().
parent 5bacf865
/*
* $Id: ramkomd.c,v 0.45 1994/01/12 04:08:51 ceder Exp $
* $Id: ramkomd.c,v 0.46 1994/02/19 04:44:56 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -31,7 +31,7 @@
* It has grown! /ceder
*/
static char *rcsid = "$Id: ramkomd.c,v 0.45 1994/01/12 04:08:51 ceder Exp $";
static char *rcsid = "$Id: ramkomd.c,v 0.46 1994/02/19 04:44:56 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -82,56 +82,14 @@ USE(rcsid);
#include "kom-memory.h"
#include "conf-file.h"
#include "param.h"
#include "admin.h"
#include "server-config.h"
#include "manipulate.h"
struct kom_par param;
Kom_err kom_errno = KOM_NO_ERROR;
unsigned long err_stat = 0;
static Conf_no c1 = 1;
static Conf_no c2 = 2;
static Conf_no c3 = 3;
static Conf_no c4 = 4;
static Text_no t0 = 0;
static Success log_param(const char *val, const struct parameter *par);
static const struct parameter parameters[] = {
/* "Normal" configuration */
{"Locale",
assign_string, 0, 1, NULL, &param.use_locale},
{"Prefix",
assign_string, 0, 1, NULL, &param.dbase_dir},
{"Send async",
assign_bool, 0, 1, "1", &param.send_async_messages},
{"Client port",
assign_string, 1, 1, NULL, &param.ip_client_port},
{"Mux port",
assign_string, 1, 1, NULL, &param.ip_mux_port},
{"Presentation of conferences",
assign_conf_no, 0, 1, &c1, &kom_info.conf_pres_conf},
{"Presentation of persons",
assign_conf_no, 0, 1, &c2, &kom_info.pers_pres_conf},
{"Motd-conference",
assign_conf_no, 0, 1, &c3, &kom_info.motd_conf},
{"News-conference",
assign_conf_no, 0, 1, &c4, &kom_info.kom_news_conf},
{"Message of the day",
assign_text_no, 0, 1, &t0, &kom_info.motd_of_lyskom},
#ifdef DEBUG
{"Never save",
assign_bool, 0, 1, "0", &param.never_save},
#endif
#ifdef LOGACCESSES
{"Log accesses",
assign_string, 0, 1, NULL, &param.logaccess_file},
#endif
/* Echo the value to the log. */
{"Echo",
log_param, 0, -1, NULL, NULL},
{NULL, NULL, NULL, FALSE, NULL}}; /* end marker */
#ifdef DEBUG
int buglevel = 0;
......@@ -149,14 +107,6 @@ static IscSession *listen_mux = NULL; /* -"- */
static void dump_exit_statistics(void);
static Success
log_param(const char *val, const struct parameter *par)
{
if (val != NULL)
log ("config: %s\n", val);
return OK;
}
static void
server_init (char * client_port, char * mux_port)
{
......@@ -219,47 +169,18 @@ server_init (char * client_port, char * mux_port)
static void
init_data_base(const char *dir_base)
{
String a = EMPTY_STRING, b = EMPTY_STRING, c = EMPTY_STRING,
d = EMPTY_STRING;
if (dir_base == NULL)
dir_base = DEFAULT_DBASE_DIR;
sprintf(datafilename, "%s/%s", dir_base, DATAFILE_NAME);
sprintf(backupfilename, "%s/%s", dir_base, BACKUPFILE_NAME);
sprintf(textfilename, "%s/%s", dir_base, TEXTFILE_NAME);
sprintf(statisticfile, "%s/%s", dir_base, STATISTIC_NAME);
sprintf(pidfile, "%s/%s", dir_base, PID_NAME);
sprintf(memusefile, "%s/%s", dir_base, MEMUSE_NAME);
sprintf(datafilename, "%s/%s", dir_base, param.datafile_name);
sprintf(backupfilename, "%s/%s", dir_base, param.backupfile_name);
sprintf(textfilename, "%s/%s", dir_base, param.textfile_name);
sprintf(statisticfile, "%s/%s", dir_base, param.statistic_name);
sprintf(pidfile, "%s/%s", dir_base, param.pid_name);
sprintf(memusefile, "%s/%s", dir_base, param.memuse_name);
log("Database = %s\n", datafilename);
log("Backup = %s\n", backupfilename);
if ( init_cache() == FAILURE )
{
log ( "Setting up first four conferences.\n");
if ( s_crea_str(&a, "Presentation (av nya) m|ten") != OK
|| s_crea_str(&b, "Presentation (av nya) medlemmar") != OK
|| s_crea_str(&c, "Lappar (p}) d|rren") != OK
|| s_crea_str(&d, "Nyheter om LysKOM") != OK)
{
restart_kom("init_data_base: can't create strings\n");
}
if ( ! ( do_create_conf(a, 0, 0, 0, NULL_CONF_TYPE)
&& do_create_conf(b, 0, 0, 0, NULL_CONF_TYPE)
&& do_create_conf(c, 0, 0, 0, NULL_CONF_TYPE)
&& do_create_conf(d, 0, 0, 0, NULL_CONF_TYPE)))
{
restart_kom("init_data_base: Kan ej skapa m|ten\n");
}
s_clear(&a);
s_clear(&b);
s_clear(&c);
s_clear(&d);
}
restart_kom ("Cannot find database.\n");
}
static void
......@@ -322,7 +243,7 @@ save_pid(void)
void
initialize(const char *config_file)
{
read_config(config_file, parameters);
read_configuration(config_file);
#ifdef HAVE_LOCALE_H
if (param.use_locale != NULL)
......@@ -448,6 +369,7 @@ dump_exit_statistics(void)
free_all_tmp();
free_all_cache();
free_all_jubel();
dump_smalloc_counts(stat_file);
dump_alloc_counts(stat_file);
......
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