Commit ba968192 authored by David Byers's avatar David Byers
Browse files

(init_cache): Data file is now terminated by EOF, not a dollar sign.

parent fefaf689
/*
* $Id: simple-cache.c,v 0.55 1996/07/26 01:50:12 ceder Exp $
* $Id: simple-cache.c,v 0.56 1996/07/27 11:16:33 byers Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -33,17 +33,19 @@
* New save algorithm by ceder.
*/
static char *rcsid = "$Id: simple-cache.c,v 0.55 1996/07/26 01:50:12 ceder Exp $";
static char *rcsid = "$Id: simple-cache.c,v 0.56 1996/07/27 11:16:33 byers Exp $";
#include "rcs.h"
USE(rcsid);
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#include <unistd.h>
#ifndef SEEK_END
# include <fcntl.h>
#endif
......@@ -1759,12 +1761,12 @@ save_one_text(void)
if ( cn->snap_shot != NULL )
{
fprintf(file_b, "T %ld ", sync_next);
fprintf(file_b, "T %ld", sync_next);
foutput_text_stat(file_b, cn->snap_shot);
}
else if ( cn->s.dirty == 0 && cn->ptr != NULL )
{
fprintf(file_b, "T %ld ", sync_next);
fprintf(file_b, "T %ld", sync_next);
foutput_text_stat(file_b, cn->ptr);
}
else
......@@ -2001,7 +2003,7 @@ init_cache(void)
Text_stat tmp_text;
long datafile_version;
long pos, num;
char done, read_text_no, read_conf_no;
char done, read_text_no, read_conf_no, c;
pers_mcb = create_cache_node_mcb(100, MAX_CONF);
conf_mcb = create_cache_node_mcb(100, MAX_CONF);
......@@ -2089,8 +2091,12 @@ init_cache(void)
for ( i = 1; !done ; i++ ) /* CONFS */
{
fskipwhite(file_a);
switch(getc(file_a))
switch(c = getc(file_a))
{
case EOF:
done = 1;
break;
case '@':
case '+':
restart_kom("init_cache(): old type record in new type file\n");
......@@ -2236,12 +2242,9 @@ init_cache(void)
clear_text_stat(&tmp_text);
break;
case '$':
done = 1;
break;
default:
restart_kom("init_cache(): Unknown key in data file\n");
restart_kom("init_cache(): Unknown key '%c' in data file\n",
c);
break;
}
}
......
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