summaryrefslogtreecommitdiff
path: root/src/info2html/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/info2html/parse.c')
-rw-r--r--src/info2html/parse.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/info2html/parse.c b/src/info2html/parse.c
index 67575c87..5f19012d 100644
--- a/src/info2html/parse.c
+++ b/src/info2html/parse.c
@@ -5,14 +5,17 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <zlib.h>
#include "parse.h"
#include "data.h"
#include "utils.h"
+int num_files_left;
+
/* main routine to read in a node once we found its start in file f */
/* assumes NODE has already been allocated */
-int read_node (FILE *f, char *line, NODE *node)
+int read_node (gzFile f, char *line, NODE *node)
{
/* we found a node line */
if (!parse_node_line( node, line ))
@@ -112,7 +115,7 @@ char *parse_node_label( char **line, char *label, int allow_eof )
#define SEARCH_BUF_SIZE 1024
#define CONTENTS_BUF_INCR 1024
-int read_node_contents( FILE *f, NODE *node )
+int read_node_contents( gzFile f, NODE *node )
{
int nread;
int found;
@@ -135,14 +138,14 @@ int read_node_contents( FILE *f, NODE *node )
/* and save contents as we go along */
for ( found=0 ; !found ; )
{
- status=fgets( searchbuf, SEARCH_BUF_SIZE, f);
+ status=gzgets(f, searchbuf, SEARCH_BUF_SIZE);
linelen = strlen( searchbuf );
for (found=0, ptr = searchbuf; *ptr && !found; ptr++)
if (*ptr == INFO_FF || *ptr == INFO_COOKIE)
found=1;
/* if we didn't find the magic character, but hit eof, same deal */
- if (!found && feof(f))
+ if (!found && gzeof(f))
{
found = 1;
continue;
@@ -156,7 +159,7 @@ int read_node_contents( FILE *f, NODE *node )
memcpy(tmpcontents+nread, searchbuf, linelen);
nread += linelen;
- if (!feof(f))
+ if (!gzeof(f) || num_files_left)
*(tmpcontents+nread) = '\14';
}