e34f792
--- texinfo-4.8/util/Makefile.in.zlib	2006-01-16 05:53:28.000000000 +0100
e34f792
+++ texinfo-4.8/util/Makefile.in	2006-01-16 05:53:45.000000000 +0100
e34f792
@@ -83,7 +83,7 @@
e34f792
 PROGRAMS = $(bin_PROGRAMS)
e34f792
 am_ginstall_info_OBJECTS = install-info.$(OBJEXT)
e34f792
 ginstall_info_OBJECTS = $(am_ginstall_info_OBJECTS)
e34f792
-ginstall_info_LDADD = $(LDADD)
e34f792
+ginstall_info_LDADD = $(LDADD) -lz
e34f792
 am__DEPENDENCIES_1 =
e34f792
 ginstall_info_DEPENDENCIES = ../lib/libtxi.a $(am__DEPENDENCIES_1)
e34f792
 texindex_SOURCES = texindex.c
e34f792
--- texinfo-4.8/util/install-info.c.zlib	2006-01-16 05:55:00.000000000 +0100
e34f792
+++ texinfo-4.8/util/install-info.c	2006-01-16 06:03:40.000000000 +0100
e34f792
@@ -20,6 +20,7 @@
e34f792
 
e34f792
 #include "system.h"
e34f792
 #include <getopt.h>
e34f792
+#include <zlib.h>
e34f792
 
e34f792
 static char *progname = "install-info";
e34f792
 
e34f792
@@ -529,7 +530,7 @@
e34f792
    COMPRESSION_PROGRAM.  The compression program is determined by the
e34f792
    magic number, not the filename.  */
e34f792
 
e34f792
-FILE *
e34f792
+void *
e34f792
 open_possibly_compressed_file (char *filename,
e34f792
     void (*create_callback) (char *),
e34f792
     char **opened_filename, char **compression_program, int *is_pipe) 
e34f792
@@ -537,7 +538,7 @@
e34f792
   char *local_opened_filename, *local_compression_program;
e34f792
   int nread;
e34f792
   char data[4];
e34f792
-  FILE *f;
e34f792
+  gzFile *f;
e34f792
 
e34f792
   /* We let them pass NULL if they don't want this info, but it's easier
e34f792
      to always determine it.  */
e34f792
@@ -545,16 +546,16 @@
e34f792
     opened_filename = &local_opened_filename;
e34f792
 
e34f792
   *opened_filename = filename;
e34f792
-  f = fopen (*opened_filename, FOPEN_RBIN);
e34f792
+  f = gzopen (*opened_filename, FOPEN_RBIN);
e34f792
   if (!f)
e34f792
     {
e34f792
       *opened_filename = concat (filename, ".gz", "");
e34f792
-      f = fopen (*opened_filename, FOPEN_RBIN);
e34f792
+      f = gzopen (*opened_filename, FOPEN_RBIN);
e34f792
   if (!f)
e34f792
     {
e34f792
       free (*opened_filename);
e34f792
       *opened_filename = concat (filename, ".bz2", "");
e34f792
-      f = fopen (*opened_filename, FOPEN_RBIN);
e34f792
+      f = gzopen (*opened_filename, FOPEN_RBIN);
e34f792
     }
e34f792
 
e34f792
 #ifdef __MSDOS__
e34f792
@@ -562,13 +563,13 @@
e34f792
         {
e34f792
           free (*opened_filename);
e34f792
           *opened_filename = concat (filename, ".igz", "");
e34f792
-          f = fopen (*opened_filename, FOPEN_RBIN);
e34f792
+          f = gzopen (*opened_filename, FOPEN_RBIN);
e34f792
         }
e34f792
       if (!f)
e34f792
         {
e34f792
           free (*opened_filename);
e34f792
           *opened_filename = concat (filename, ".inz", "");
e34f792
-          f = fopen (*opened_filename, FOPEN_RBIN);
e34f792
+          f = gzopen (*opened_filename, FOPEN_RBIN);
e34f792
         }
e34f792
 #endif
e34f792
       if (!f)
e34f792
@@ -580,7 +581,7 @@
e34f792
               /* And try opening it again.  */
e34f792
               free (*opened_filename);
e34f792
               *opened_filename = filename;
e34f792
-              f = fopen (*opened_filename, FOPEN_RBIN);
e34f792
+              f = gzopen (*opened_filename, FOPEN_RBIN);
e34f792
               if (!f)
e34f792
                 pfatal_with_name (filename);
e34f792
             }
e34f792
@@ -591,12 +592,12 @@
e34f792
 
e34f792
   /* Read first few bytes of file rather than relying on the filename.
e34f792
      If the file is shorter than this it can't be usable anyway.  */
e34f792
-  nread = fread (data, sizeof (data), 1, f);
e34f792
-  if (nread != 1)
e34f792
+  nread = gzread (f, data, sizeof (data));
e34f792
+  if (nread != sizeof (data))
e34f792
     {
e34f792
       /* Empty files don't set errno, so we get something like
e34f792
          "install-info: No error for foo", which is confusing.  */
e34f792
-      if (nread == 0)
e34f792
+      if (nread >= 0)
e34f792
         fatal (_("%s: empty file"), *opened_filename, 0);
e34f792
       pfatal_with_name (*opened_filename);
e34f792
     }
e34f792
@@ -629,20 +630,22 @@
e34f792
 
e34f792
   if (*compression_program)
e34f792
     { /* It's compressed, so fclose the file and then open a pipe.  */
e34f792
+      FILE *p;
e34f792
       char *command = concat (*compression_program," -cd <", *opened_filename);
e34f792
-      if (fclose (f) < 0)
e34f792
+      if (gzclose (f) < 0)
e34f792
         pfatal_with_name (*opened_filename);
e34f792
-      f = popen (command, "r");
e34f792
-      if (f)
e34f792
+      p = popen (command, "r");
e34f792
+      if (p)
e34f792
         *is_pipe = 1;
e34f792
       else
e34f792
         pfatal_with_name (command);
e34f792
+      return p;
e34f792
     }
e34f792
   else
e34f792
     { /* It's a plain file, seek back over the magic bytes.  */
e34f792
-      if (fseek (f, 0, 0) < 0)
e34f792
+      if (gzseek (f, 0, SEEK_SET) < 0)
e34f792
         pfatal_with_name (*opened_filename);
e34f792
-#if O_BINARY
e34f792
+#if 0 && O_BINARY
e34f792
       /* Since this is a text file, and we opened it in binary mode,
e34f792
          switch back to text mode.  */
e34f792
       f = freopen (*opened_filename, "r", f);
e34f792
@@ -667,7 +670,7 @@
e34f792
     char **compression_program)
e34f792
 {
e34f792
   char *real_name;
e34f792
-  FILE *f;
e34f792
+  void *f;
e34f792
   int pipe_p;
e34f792
   int filled = 0;
e34f792
   int data_size = 8192;
e34f792
@@ -681,7 +684,12 @@
e34f792
 
e34f792
   for (;;)
e34f792
     {
e34f792
-      int nread = fread (data + filled, 1, data_size - filled, f);
e34f792
+      int nread;
e34f792
+
e34f792
+      if (pipe_p)
e34f792
+	nread = fread (data + filled, 1, data_size - filled, f);
e34f792
+      else
e34f792
+	nread = gzread (f, data + filled, data_size - filled);
e34f792
       if (nread < 0)
e34f792
         pfatal_with_name (real_name);
e34f792
       if (nread == 0)
e34f792
@@ -703,7 +711,7 @@
e34f792
   if (pipe_p)
e34f792
     pclose (f);
e34f792
   else
e34f792
-    fclose (f);
e34f792
+    gzclose (f);
e34f792
 
e34f792
   *sizep = filled;
e34f792
   return data;