Commit 8fb8fbda authored by David Byers's avatar David Byers
Browse files

(init_cache): Override database kom_info with command-line kom_info.

(cache_sync): Output kom_info structure.
(init_cache): If no explicit output format is given, select output
format to be the same as the input format.
(init_cache): Initialize read_text_num and read_conf_num to avoid
compiler warnings.
parent 9b208902
/*
* $Id: dbck-cache.c,v 0.23 1996/02/23 16:00:12 byers Exp $
* $Id: dbck-cache.c,v 0.24 1996/06/09 13:54:20 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -32,7 +32,7 @@
* Also save time as a time_t instead of a struct tm.
*/
static char *rcsid = "$Id: dbck-cache.c,v 0.23 1996/02/23 16:00:12 byers Exp $";
static char *rcsid = "$Id: dbck-cache.c,v 0.24 1996/06/09 13:54:20 byers Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -596,6 +596,13 @@ cache_sync(void)
fprintf(fp, "#T %d\n", next_text_num);
}
fprintf(fp, "I %d %d %d %d %ld\n",
kom_info.conf_pres_conf,
kom_info.pers_pres_conf,
kom_info.motd_conf,
kom_info.kom_news_conf,
kom_info.motd_of_lyskom);
for ( i = 1; i < next_free_num; i++ ) /* CONFS */
{
if ( conf_arr[ i ] == NULL && oformat == 0)
......@@ -725,7 +732,17 @@ init_cache(void)
long num;
long data_file_version;
char done, read_text_num, read_conf_num;
extern int modifications;
extern long oformat;
extern int pers_pres_conf;
extern int conf_pres_conf;
extern int motd_conf;
extern int motd_of_lyskom;
extern int kom_news_conf;
read_text_num = 0;
read_conf_num = 0;
for (i = 0; i < MAX_CONF; i++)
conf_arr[i] = NULL;
for (i = 0; i < MAX_CONF; i++)
......@@ -769,6 +786,9 @@ init_cache(void)
return FAILURE;
}
if (oformat == -1)
oformat = data_file_version;
if (data_file_version == 0)
fseek(fp, 6, SEEK_SET); /* skip clean/dirty flag. */
else
......@@ -811,6 +831,32 @@ init_cache(void)
kom_info.motd_conf = fparse_long(fp);
kom_info.kom_news_conf = fparse_long(fp);
kom_info.motd_of_lyskom = fparse_long(fp);
if (pers_pres_conf != -1)
{
modifications += (kom_info.pers_pres_conf != pers_pres_conf);
kom_info.pers_pres_conf = pers_pres_conf;
}
if (conf_pres_conf != -1)
{
modifications += (kom_info.conf_pres_conf != conf_pres_conf);
kom_info.conf_pres_conf = conf_pres_conf;
}
if (motd_conf != -1)
{
modifications += (kom_info.motd_conf != motd_conf);
kom_info.motd_conf = motd_conf;
}
if (kom_news_conf != -1)
{
modifications += (kom_info.kom_news_conf != kom_news_conf);
kom_info.kom_news_conf = kom_news_conf;
}
if (motd_of_lyskom != -1)
{
modifications += (kom_info.motd_of_lyskom != motd_of_lyskom);
kom_info.motd_of_lyskom = motd_of_lyskom;
}
break;
case 'C':
......
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