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

Use param."foo" (from param.h) instead of "FOO".

parent 598ae16e
/*
* $Id: admin.c,v 0.12 1994/01/12 01:31:00 ceder Exp $
* $Id: admin.c,v 0.13 1994/02/19 04:27:21 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Administrative calls.
*/
static char *rcsid = "$Id: admin.c,v 0.12 1994/01/12 01:31:00 ceder Exp $";
static char *rcsid = "$Id: admin.c,v 0.13 1994/02/19 04:27:21 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -51,6 +51,7 @@ USE(rcsid);
#include "config.h"
#include "log.h"
#include "send-async.h"
#include "param.h"
/* All of the fields in this structure except the version number
is set from the configuration file at startup (see ramkomd.c).
......@@ -101,7 +102,7 @@ set_motd_of_lyskom (Text_no motd)
if ( motd != 0 )
{
GET_T_STAT(new_motd, motd, FAILURE);
if ( new_motd->no_of_marks >= MAX_MARKS_TEXT )
if ( new_motd->no_of_marks >= param.max_marks_text )
{
log("LIMIT: set_motd_of_lyskom(%d): New motd has %d marks.\n",
motd, new_motd->no_of_marks);
......@@ -151,7 +152,7 @@ broadcast (String message)
{
CHK_LOGIN(FAILURE);
if (s_strlen(message) > BROADCAST_LEN)
if (s_strlen(message) > param.broadcast_len)
{
kom_errno = KOM_LONG_STR;
return FAILURE;
......@@ -170,7 +171,7 @@ send_message (Pers_no recipient,
{
CHK_LOGIN(FAILURE);
if (s_strlen(message) > BROADCAST_LEN)
if (s_strlen(message) > param.broadcast_len)
{
kom_errno = KOM_LONG_STR;
return FAILURE;
......
/*
* $Id: conference.c,v 0.23 1993/10/18 12:28:55 ceder Exp $
* $Id: conference.c,v 0.24 1994/02/19 04:27:27 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* All atomic calls that deals with conferences.
*/
static char *rcsid = "$Id: conference.c,v 0.23 1993/10/18 12:28:55 ceder Exp $";
static char *rcsid = "$Id: conference.c,v 0.24 1994/02/19 04:27:27 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -60,9 +60,11 @@ USE(rcsid);
#include "lyskomd.h"
#include "debug.h"
#include "send-async.h"
#include "param.h"
/*
* Defined in conference.c. This will go away when we use regexp-matching.
* This is only temporary. +++***
* This is only temporary. FIXME+++***
*/
extern Conf_no *conf_table;
......@@ -139,7 +141,7 @@ do_delete_conf (Conf_no conf_no,
Bool
legal_name( String name )
{
if (name.len == 0 || name.len > CONF_NAME_LEN )
if (name.len == 0 || name.len > param.conf_name_len )
{
kom_errno = KOM_LONG_STR;
return FALSE;
......@@ -269,9 +271,7 @@ do_create_conf(String name,
conf_c->type = type;
conf_c->last_written= conf_c->creation_time;
conf_c->msg_of_day = 0;
conf_c->nice = DEFAULT_NICE;
conf_c->members = EMPTY_MEMBER_LIST;
conf_c->texts = EMPTY_TEXT_LIST;
conf_c->nice = param.default_nice;
mark_conference_as_changed (conf_no);
......@@ -395,7 +395,8 @@ create_conf(String name,
CHK_LOGIN(0);
if (!ANYONE_CAN_CREATE_NEW_CONFS && !ENA(create_conf, 0) )
if (param.anyone_can_create_new_confs == FALSE
&& !ENA(create_conf, 0) )
{
kom_errno = KOM_PERM;
return 0;
......@@ -919,7 +920,7 @@ do_set_presentation(Conf_no conf_no,
if ( text_no != 0 )
{
GET_T_STAT(new_pres, text_no, FAILURE);
if ( new_pres->no_of_marks >= MAX_MARKS_TEXT )
if ( new_pres->no_of_marks >= param.max_marks_text )
{
log("%s(%d, ptr, %d): New presentation has %d marks.\n",
"LIMIT: do_set_presentation",
......@@ -977,7 +978,7 @@ do_set_etc_motd(Conf_no conf_no,
if ( text_no != 0 )
{
GET_T_STAT(new_motd, text_no, FAILURE);
if ( new_motd->no_of_marks >= MAX_MARKS_TEXT )
if ( new_motd->no_of_marks >= param.max_marks_text )
{
log("LIMIT: do_set_motd(%d, ptr, %d): New motd has %d marks.\n",
conf_no, text_no, new_motd->no_of_marks);
......
/*
* $Id: dbck.c,v 0.19 1993/10/18 12:29:14 ceder Exp $
* $Id: dbck.c,v 0.20 1994/02/19 04:27:33 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Author: Per Cederqvist.
*/
static char *rcsid = "$Id: dbck.c,v 0.19 1993/10/18 12:29:14 ceder Exp $";
static char *rcsid = "$Id: dbck.c,v 0.20 1994/02/19 04:27:33 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -54,6 +54,12 @@ USE(rcsid);
#include "config.h"
#include "debug.h"
#include "dbck-cache.h"
#include "param.h"
#include "server-config.h"
#include "manipulate.h"
Info kom_info; /* Not used, but needed by server-config.o. */
struct kom_par param;
/* This is set to TRUE if init_cache finds out that the last part of the
database is missing. */
......@@ -63,7 +69,6 @@ char datafilename[1024]; /* Full pathname to the database file */
char backupfilename[1024]; /* Full pathname to the backup file */
char textfilename[1024];
char textbackupfilename[1024]; /* unshrinked text-file. */
static const char *dbase_dir = NULL; /* Directory where database resides */
#define TEXTBACKUPFILE_NAME "db/backup-texts"
......@@ -133,6 +138,15 @@ restart_kom (format, a, b, c, d, e, f, g)
}
#endif
void
register_jubel(Pers_no pno,
Text_no divis,
Text_no tno)
{
/* Not needed in dbck.c, but called from conf-file.c. */
}
static Person_scratchpad *
alloc_person_scratchpad(void)
{
......@@ -1134,15 +1148,12 @@ check_data_base(void)
}
static void
init_data_base(void)
init_data_base(char *dbase_dir)
{
if (dbase_dir == NULL)
dbase_dir = DEFAULT_DBASE_DIR;
sprintf(datafilename, "%s/%s", dbase_dir, DATAFILE_NAME);
sprintf(backupfilename, "%s/%s", dbase_dir, BACKUPFILE_NAME);
sprintf(textfilename, "%s/%s", dbase_dir, TEXTFILE_NAME);
sprintf(textbackupfilename, "%s/%s", dbase_dir, TEXTBACKUPFILE_NAME);
sprintf(datafilename, "%s/%s", dbase_dir, param.datafile_name);
sprintf(backupfilename, "%s/%s", dbase_dir, param.backupfile_name);
sprintf(textfilename, "%s/%s", dbase_dir, param.textfile_name);
sprintf(textbackupfilename, "%s/%s", dbase_dir, param.textbackupfile_name);
if ( vflag )
{
......@@ -1192,7 +1203,7 @@ print_statistics(void)
int *hist;
int i;
hist = calloc(TEXT_LEN, sizeof(int));
hist = calloc(param.text_len, sizeof(int));
if (hist == NULL)
{
......@@ -1213,7 +1224,7 @@ print_statistics(void)
}
log("Length Frequency\n");
for(i=0; i<TEXT_LEN; i++)
for(i=0; i<param.text_len; i++)
if(hist[i] != 0)
log("%8d %d\n", i, hist[i]);
}
......@@ -1227,6 +1238,8 @@ main (int argc,
{
int i;
int errors;
char *default_config_file;
char *config_file;
BUGDECL;
for (i = 1; i < argc && argv[i][0] == '-'; i++)
......@@ -1239,10 +1252,6 @@ main (int argc,
break;
#endif
case 'D': /* Database directory */
dbase_dir = argv[i]+2;
break;
case 'i': /* Running interactively. */
iflag++; /* Will ask user and try to repair. */
break;
......@@ -1264,14 +1273,31 @@ main (int argc,
break;
default:
restart_kom("usage: %s [-d] [-Ddir] [-i] [-r] [-v] [-g] [-s]\n",
argv[0]);
restart_kom("usage: %s %s [config_file]\n",
argv[0], "[-d ...] [-i] [-r] [-v] [-g] [-s]");
}
}
/* Read in the configuration file. */
default_config_file = smalloc(strlen(DEFAULT_DBASE_DIR) +
strlen(CONFIG_FILE) + 2);
sprintf(default_config_file, "%s/%s", DEFAULT_DBASE_DIR, CONFIG_FILE);
if (i < argc)
config_file = argv[i++];
else
config_file = default_config_file;
read_configuration(config_file);
sfree(default_config_file);
if (i != argc)
restart_kom("usage: %s %s [config_file]\n",
argv[0], "[-d ...] [-i] [-r] [-v] [-g] [-s]");
s_set_storage_management(smalloc, srealloc, sfree);
init_data_base();
init_data_base(param.dbase_dir);
errors = check_data_base();
if (truncated_texts == TRUE)
......
/*
* $Id: disk-end-of-atomic.c,v 0.12 1993/10/18 12:29:20 ceder Exp $
* $Id: disk-end-of-atomic.c,v 0.13 1994/02/19 04:27:40 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -36,7 +36,7 @@
* to forget old texts.
*/
static char *rcsid = "$Id: disk-end-of-atomic.c,v 0.12 1993/10/18 12:29:20 ceder Exp $";
static char *rcsid = "$Id: disk-end-of-atomic.c,v 0.13 1994/02/19 04:27:40 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -54,11 +54,12 @@ USE(rcsid);
#include "config.h"
#include "text-garb.h"
#include "disk-cache.h"
#include "param.h"
long
end_of_atomic( Bool idle )
{
int timeout = TIMEOUT;
int timeout = param.timeout;
static int limit = 0;
free_tmp();
......@@ -72,10 +73,10 @@ end_of_atomic( Bool idle )
if ( idle )
if ( garb_text() == FALSE )
timeout = GARBTIMEOUT;
timeout = param.garbtimeout;
if ( sync_part() == FALSE )
timeout = SYNCTIMEOUT;
timeout = param.synctimeout;
return timeout;
}
#
# $Id: fncdef.txt,v 0.13 1993/10/10 22:36:46 ceder Exp $
# $Id: fncdef.txt,v 0.14 1994/02/19 04:27:47 ceder Exp $
# Copyright (C) 1991 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -22,7 +22,7 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: fncdef.txt,v 0.13 1993/10/10 22:36:46 ceder Exp $
# $Id: fncdef.txt,v 0.14 1994/02/19 04:27:47 ceder Exp $
#
# This file is used to describe the functions in services.c. All
# functions that are reachable from the clients are listed here, together
......@@ -35,19 +35,19 @@
#
# (Functions whose name end in _old are obsolete and should not be used.)
#
success login_old num c_string (PWD_LEN)
success login_old num c_string (param.pwd_len)
success logout
success pepsi num
success change_name num c_string (CONF_NAME_LEN)
success change_what_i_am_doing string (WHAT_DO_LEN)
number create_person c_string (CONF_NAME_LEN) c_string (PWD_LEN)
success change_name num c_string (param.conf_name_len)
success change_what_i_am_doing string (param.what_do_len)
number create_person c_string (param.conf_name_len) c_string (param.pwd_len)
success get_person_stat_old num num : person
success set_priv_bits num priv_bits
success set_passwd num c_string (PWD_LEN) c_string (PWD_LEN)
success set_passwd num c_string (param.pwd_len) c_string (param.pwd_len)
success query_read_texts num num : membership
number create_conf c_string (CONF_NAME_LEN) conf_type
number create_conf c_string (param.conf_name_len) conf_type
success delete_conf num
success lookup_name c_string (CONF_NAME_LEN) : conf_list
success lookup_name c_string (param.conf_name_len) : conf_list
success get_conf_stat_old num num : conference
success add_member num num num num
success sub_member num num
......@@ -63,7 +63,7 @@ success mark_text_old num num
success get_text num num num : string
success get_text_stat num : text_stat
success mark_as_read num num c_local_text_no_p
number create_text c_string (TEXT_LEN) num c_misc_info_p
number create_text c_string (param.text_len) num c_misc_info_p
success delete_text num
success add_recipient num num num
success sub_recipient num num
......@@ -80,7 +80,7 @@ success set_motd_of_lyskom num
success enable num
success sync_kom
success shutdown_kom num
success broadcast c_string (BROADCAST_LEN)
success broadcast c_string (param.broadcast_len)
success get_membership num num num num : membership_list
success get_created_texts num num num : text_list
success get_members num num num : member_list
......@@ -88,23 +88,23 @@ success get_person_stat num : person
success get_conf_stat num : conference
success who_is_on : who_info_list
success get_unread_confs num : conf_no_list
success send_message num c_string (BROADCAST_LEN)
success send_message num c_string (param.broadcast_len)
success get_session_info num : session_info
success disconnect num
success who_am_i : session_no
success set_user_area num num
success get_last_text time_date : text_no
number create_anonymous_text c_string (TEXT_LEN) num c_misc_info_p
number create_anonymous_text c_string (param.text_len) num c_misc_info_p
success find_next_text_no num : text_no
success find_previous_text_no num : text_no
success login num c_string (PWD_LEN) num
success login num c_string (param.pwd_len) num
success who_is_on_ident : who_info_ident_list
success get_session_info_ident num : session_info_ident
success re_lookup_person c_string (REGEXP_LEN) : conf_no_list
success re_lookup_conf c_string (REGEXP_LEN) : conf_no_list
success lookup_person c_string (CONF_NAME_LEN) : conf_no_list
success lookup_conf c_string (CONF_NAME_LEN) : conf_no_list
success set_client_version c_string (CONF_NAME_LEN) c_string (CONF_NAME_LEN)
success re_lookup_person c_string (param.regexp_len) : conf_no_list
success re_lookup_conf c_string (param.regexp_len) : conf_no_list
success lookup_person c_string (param.conf_name_len) : conf_no_list
success lookup_conf c_string (param.conf_name_len) : conf_no_list
success set_client_version c_string (param.conf_name_len) c_string (param.conf_name_len)
success get_client_name num : string
success get_client_version num : string
success mark_text num num
......
/*
* $Id: person.c,v 0.26 1994/01/12 01:36:36 ceder Exp $
* $Id: person.c,v 0.27 1994/02/19 04:27:52 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* All atomic calls that deals with persons.
*/
static char *rcsid = "$Id: person.c,v 0.26 1994/01/12 01:36:36 ceder Exp $";
static char *rcsid = "$Id: person.c,v 0.27 1994/02/19 04:27:52 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -64,6 +64,7 @@ USE(rcsid);
#include "log.h"
#include "minmax.h"
#include "lyskomd.h"
#include "param.h"
/*
* Static functions.
......@@ -173,8 +174,8 @@ do_mark_text(Pers_no pers_no,
if ( text_s == NULL )
GET_T_STAT(text_s, text_no, FAILURE);
if (text_s->no_of_marks >= MAX_MARKS_TEXT
|| pers_p->marks.no_of_marks >= MAX_MARKS_PERSON)
if (text_s->no_of_marks >= param.max_marks_text
|| pers_p->marks.no_of_marks >= param.max_marks_person)
{
kom_errno = KOM_MARK_LIMIT;
return FAILURE;
......@@ -283,12 +284,12 @@ do_set_user_area(Pers_no pers_no,
if ( user_area != 0 )
{
GET_T_STAT(new_user_area, user_area, FAILURE);
if ( new_user_area->no_of_marks >= MAX_MARKS_TEXT )
if ( new_user_area->no_of_marks >= param.max_marks_text )
{
log("%s(%d, %d): New user_area's mark count (%d) > %d.\n",
"LIMIT: set_user_area",
pers_no, user_area, new_user_area->no_of_marks,
MAX_MARKS_TEXT);
param.max_marks_text);
kom_errno = KOM_MARK_LIMIT;
return FAILURE;
}
......@@ -515,7 +516,7 @@ create_person (String name,
Person * pers_p;
if (!CREATE_PERSON_BEFORE_LOGIN && ACTPERS == 0 )
if (!param.create_person_before_login && ACTPERS == 0 )
{
kom_errno = KOM_LOGIN;
return 0;
......@@ -567,9 +568,7 @@ create_person (String name,
mailbox->type.letter_box = 1;
mailbox->last_written = mailbox->creation_time;
mailbox->msg_of_day = 0;
mailbox->nice = DEFAULT_NICE;
mailbox->members = EMPTY_MEMBER_LIST;
mailbox->texts = EMPTY_TEXT_LIST;
mailbox->nice = param.default_nice;
mark_conference_as_changed (new_user);
......@@ -591,7 +590,6 @@ create_person (String name,
/* Fill in Person */
*pers_p = EMPTY_PERSON;
if ( do_set_passwd( pers_p->pwd, passwd) != OK )
restart_kom("create_person(): can't set passwd\n");
......
#
# $Id: prot-a-parse-arg-c.awk,v 0.9 1993/11/22 19:05:02 ceder Exp $
# $Id: prot-a-parse-arg-c.awk,v 0.10 1994/02/19 04:27:58 ceder Exp $
# Copyright (C) 1991 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -22,7 +22,7 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: prot-a-parse-arg-c.awk,v 0.9 1993/11/22 19:05:02 ceder Exp $
# $Id: prot-a-parse-arg-c.awk,v 0.10 1994/02/19 04:27:58 ceder Exp $
BEGIN {
printf("/* Don't edit this file - it is generated automatically");
printf(" from\n prot-a-parse-arg-c.awk and fncdef.txt */\n\n");
......@@ -41,7 +41,8 @@ BEGIN {
printf("#include \"prot-a.h\"\n");
printf("#include \"prot-a-parse.h\"\n");
printf("#include \"prot-a-parse-arg.h\"\n");
printf("#include \"config.h\"\n\n");
printf("#include \"config.h\"\n");
printf("#include \"param.h\"\n\n");
}
$1 != "#" {
printf("void\nprot_a_parse_arg_%s(Connection *client)\n{\n", $2);
......@@ -72,7 +73,8 @@ $1 != "#" {
{
printf("\tif ( parse_nonwhite_char(client) != '{' )\n");
printf("\t longjmp(parse_env, ISC_PROTOCOL_ERR);\n");
printf("\tif ( client->num%d > MARK_AS_READ_CHUNK )\n", num-1);
printf("\tif ( client->num%d > param.mark_as_read_chunk )\n",
num-1);
printf("\t longjmp(parse_env, ISC_PROTOCOL_ERR);\n");
printf("\n");
printf("\tclient->c_local_text_no_p = ");
......@@ -98,7 +100,7 @@ $1 != "#" {
{
printf("\tif ( parse_nonwhite_char(client) != '{' )\n");
printf("\t longjmp(parse_env, ISC_PROTOCOL_ERR);\n");
printf("\tif ( client->num%d > MAX_CREA_MISC )\n", num-1);
printf("\tif ( client->num%d > param.max_crea_misc )\n", num-1);
printf("\t longjmp(parse_env, ISC_PROTOCOL_ERR);\n");
printf("\n");
printf("\tclient->c_misc_info_p = ");
......
/*
* $Id: text-garb.c,v 0.15 1994/01/12 01:49:41 ceder Exp $
* $Id: text-garb.c,v 0.16 1994/02/19 04:28:04 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -28,7 +28,7 @@
* Author: Per Cederqvist.
*/
static char *rcsid = "$Id: text-garb.c,v 0.15 1994/01/12 01:49:41 ceder Exp $";
static char *rcsid = "$Id: text-garb.c,v 0.16 1994/02/19 04:28:04 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -51,6 +51,7 @@ USE(rcsid);
#include "lyskomd.h"
#include "log.h"
#include "internal-services.h"
#include "param.h"
/*
* This comment is a description of how this _could_ be done in a more
......@@ -110,7 +111,7 @@ garb_text(void)
if ( last_checked == 0 )
{
if ( last_start != NO_TIME
&& difftime(time(NULL), last_start) < GARB_INTERVAL * 60 )
&& difftime(time(NULL), last_start) < param.garb_interval * 60 )
{
return TRUE;
}
......
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