Commit f63afb44 authored by Per Cederqvist's avatar Per Cederqvist

Include dbck-cache.h.

(rcsid): Added a missing const.
(next_text_num): Changed type from int to Text_no.
(TEXT_RANGE): Adjusted printf format for next_text_num change.
(VOID_TEXT_RANGE): Likewise.
(cache_sync): Changed type of local variable i from int to
	unsigned long.  Removed extern declaration of oformat.
	Adjusted printf formats for next_text_num change.
(init_cache): Removed extern declaration of oformat.
	Adjusted printf formats for next_text_num change.
parent dda7a011
/* /*
* $Id: dbck-cache.c,v 0.29 1997/09/13 15:32:03 byers Exp $ * $Id: dbck-cache.c,v 0.30 1998/07/08 16:21:43 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
* Also save time as a time_t instead of a struct tm. * Also save time as a time_t instead of a struct tm.
*/ */
static char *rcsid = "$Id: dbck-cache.c,v 0.29 1997/09/13 15:32:03 byers Exp $"; static const char *
rcsid = "$Id: dbck-cache.c,v 0.30 1998/07/08 16:21:43 ceder Exp $";
#include "rcs.h" #include "rcs.h"
USE(rcsid); USE(rcsid);
...@@ -75,6 +76,7 @@ USE(rcsid); ...@@ -75,6 +76,7 @@ USE(rcsid);
#include "ram-parse.h" #include "ram-parse.h"
#include "ram-output.h" #include "ram-output.h"
#include "param.h" #include "param.h"
#include "dbck-cache.h"
/* /*
* All functions that can fail sets kom_errno to a suitable value * All functions that can fail sets kom_errno to a suitable value
...@@ -89,7 +91,7 @@ String name_list [ MAX_CONF ]; /* "cache" list */ ...@@ -89,7 +91,7 @@ String name_list [ MAX_CONF ]; /* "cache" list */
int next_free_num = 1; int next_free_num = 1;
Text_stat * text_arr[ MAX_TEXT ]; Text_stat * text_arr[ MAX_TEXT ];
int next_text_num = 1; static Text_no next_text_num = 1;
Info kom_info = Info kom_info =
{ {
...@@ -128,7 +130,7 @@ BUGDECL; ...@@ -128,7 +130,7 @@ BUGDECL;
#define TEXT_RANGE(str, num, retval) if ( num == 0 || num >= next_text_num ) \ #define TEXT_RANGE(str, num, retval) if ( num == 0 || num >= next_text_num ) \
{ \ { \
return retval;\ return retval;\
printf("Text_no out of range 1 ... %d ", next_text_num); \ printf("Text_no out of range 1 ... %ld ", next_text_num); \
printf(str); \ printf(str); \
fflush(stdout); \ fflush(stdout); \
fflush(stderr); \ fflush(stderr); \
...@@ -138,7 +140,7 @@ BUGDECL; ...@@ -138,7 +140,7 @@ BUGDECL;
#define VOID_TEXT_RANGE(str, num) if ( num == 0 || num >= next_text_num ) \ #define VOID_TEXT_RANGE(str, num) if ( num == 0 || num >= next_text_num ) \
{ \ { \
return;\ return;\
printf("Text_no out of range 1 ... %d ", next_text_num); \ printf("Text_no out of range 1 ... %ld ", next_text_num); \
printf(str); \ printf(str); \
fflush(stdout); \ fflush(stdout); \
fflush(stderr); \ fflush(stderr); \
...@@ -562,8 +564,7 @@ extern void /* Write out everything. */ ...@@ -562,8 +564,7 @@ extern void /* Write out everything. */
cache_sync(void) cache_sync(void)
{ {
FILE *fp; FILE *fp;
int i; unsigned long i;
extern long oformat;
#ifdef TIME_SYNC #ifdef TIME_SYNC
struct rusage start, after_confs, after_persons, after_text_stats, struct rusage start, after_confs, after_persons, after_text_stats,
...@@ -604,7 +605,7 @@ cache_sync(void) ...@@ -604,7 +605,7 @@ cache_sync(void)
case 1: case 1:
fprintf(fp, "DIRTY:%05ld\n", oformat); fprintf(fp, "DIRTY:%05ld\n", oformat);
fprintf(fp, "#C %d\n", next_free_num); fprintf(fp, "#C %d\n", next_free_num);
fprintf(fp, "#T %d\n", next_text_num); fprintf(fp, "#T %ld\n", next_text_num);
fprintf(fp, "I"); fprintf(fp, "I");
foutput_info(fp, &kom_info); foutput_info(fp, &kom_info);
fprintf(fp, "\n"); fprintf(fp, "\n");
...@@ -687,7 +688,7 @@ cache_sync(void) ...@@ -687,7 +688,7 @@ cache_sync(void)
switch (oformat) switch (oformat)
{ {
case 0: case 0:
fprintf(fp, "%d\n", next_text_num); /* NEXT_TEXT_NUM */ fprintf(fp, "%ld\n", next_text_num); /* NEXT_TEXT_NUM */
break; break;
case 1: case 1:
break; break;
...@@ -806,7 +807,6 @@ init_cache(void) ...@@ -806,7 +807,6 @@ init_cache(void)
long data_file_version; long data_file_version;
char done, read_text_num, read_conf_num, c; char done, read_text_num, read_conf_num, c;
extern int modifications; extern int modifications;
extern long oformat;
extern int pers_pres_conf; extern int pers_pres_conf;
extern int conf_pres_conf; extern int conf_pres_conf;
extern int motd_conf; extern int motd_conf;
...@@ -1215,7 +1215,7 @@ init_cache(void) ...@@ -1215,7 +1215,7 @@ init_cache(void)
read_text_num = 1; read_text_num = 1;
if ( vflag ) if ( vflag )
log("Reading %d texts, starting at pos %lu.\n", log("Reading %ld texts, starting at pos %lu.\n",
next_text_num-1, (unsigned long)ftell(fp)); next_text_num-1, (unsigned long)ftell(fp));
for ( i = 1; i < next_text_num; i++ ) /* TEXT_STATS */ for ( i = 1; i < next_text_num; i++ ) /* TEXT_STATS */
...@@ -1245,7 +1245,7 @@ init_cache(void) ...@@ -1245,7 +1245,7 @@ init_cache(void)
} }
} /* if (datafile_version == 0) */ } /* if (datafile_version == 0) */
log("Read %d confs/persons and %d texts, eof at %lu\n", log("Read %d confs/persons and %ld texts, eof at %lu\n",
next_free_num-1, next_text_num-1, (unsigned long)ftell(fp)); next_free_num-1, next_text_num-1, (unsigned long)ftell(fp));
if (read_text_num == 0 || read_conf_num == 0) if (read_text_num == 0 || read_conf_num == 0)
......
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