0603bd
diff -up texinfo-6.5.91/install-info/install-info.c.orig texinfo-6.5.91/install-info/install-info.c
0603bd
--- texinfo-6.5.91/install-info/install-info.c.orig	2019-01-13 12:43:10.000000000 +0100
0603bd
+++ texinfo-6.5.91/install-info/install-info.c	2019-01-14 09:31:45.322849494 +0100
0603bd
@@ -19,6 +19,7 @@
0603bd
 #include <getopt.h>
0603bd
 #include <regex.h>
0603bd
 #include <argz.h>
0603bd
+#include <zlib.h>
0603bd
 
0603bd
 #define TAB_WIDTH 8
0603bd
 
0603bd
@@ -681,15 +682,15 @@ The first time you invoke Info you start
0603bd
    
0603bd
    Return either stdin reading the file, or a non-stdin pipe reading
0603bd
    the output of the compression program.  */
0603bd
-FILE *
0603bd
+void *
0603bd
 open_possibly_compressed_file (char *filename,
0603bd
     void (*create_callback) (char *),
0603bd
-    char **opened_filename, char **compression_program) 
0603bd
+    char **opened_filename, char **compression_program, int *is_pipe)
0603bd
 {
0603bd
   char *local_opened_filename, *local_compression_program;
0603bd
   int nread;
0603bd
   char data[13];
0603bd
-  FILE *f;
0603bd
+  gzFile *f;
0603bd
 
0603bd
   /* We let them pass NULL if they don't want this info, but it's easier
0603bd
      to always determine it.  */
0603bd
@@ -697,48 +698,48 @@ open_possibly_compressed_file (char *fil
0603bd
     opened_filename = &local_opened_filename;
0603bd
 
0603bd
   *opened_filename = filename;
0603bd
-  f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+  f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
   if (!f)
0603bd
     {
0603bd
       *opened_filename = concat (filename, ".gz", "");
0603bd
-      f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+      f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
     }
0603bd
   if (!f)
0603bd
     {
0603bd
       free (*opened_filename);
0603bd
       *opened_filename = concat (filename, ".xz", "");
0603bd
-      f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+      f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
     }
0603bd
   if (!f)
0603bd
     {
0603bd
       free (*opened_filename);
0603bd
       *opened_filename = concat (filename, ".bz2", "");
0603bd
-      f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+      f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
     }
0603bd
   if (!f)
0603bd
     {
0603bd
       free (*opened_filename);
0603bd
       *opened_filename = concat (filename, ".lz", "");
0603bd
-      f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+      f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
     }
0603bd
   if (!f)
0603bd
     {
0603bd
      free (*opened_filename);
0603bd
      *opened_filename = concat (filename, ".lzma", "");
0603bd
-     f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+     f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
     }
0603bd
 #ifdef __MSDOS__
0603bd
   if (!f)
0603bd
     {
0603bd
       free (*opened_filename);
0603bd
       *opened_filename = concat (filename, ".igz", "");
0603bd
-      f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+      f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
     }
0603bd
   if (!f)
0603bd
     {
0603bd
       free (*opened_filename);
0603bd
       *opened_filename = concat (filename, ".inz", "");
0603bd
-      f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+      f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
     }
0603bd
 #endif /* __MSDOS__ */
0603bd
   if (!f)
0603bd
@@ -754,7 +755,7 @@ open_possibly_compressed_file (char *fil
0603bd
           (*create_callback) (filename);
0603bd
 
0603bd
           /* And try opening it again.  */
0603bd
-          f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+          f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
           if (!f)
0603bd
             return 0;
0603bd
         }
0603bd
@@ -764,26 +765,26 @@ open_possibly_compressed_file (char *fil
0603bd
 
0603bd
   /* Read first few bytes of file rather than relying on the filename.
0603bd
      If the file is shorter than this it can't be usable anyway.  */
0603bd
-  nread = fread (data, sizeof (data), 1, f);
0603bd
-  if (nread != 1)
0603bd
+  nread = gzread (f, data, sizeof (data));
0603bd
+  if (nread != sizeof (data))
0603bd
     {
0603bd
-      if (nread == 0)
0603bd
+      if (nread >= 0)
0603bd
         {
0603bd
           /* Try to create the file if its empty. */
0603bd
-          if (feof (f) && create_callback)
0603bd
+          if (gzeof (f) && create_callback)
0603bd
             {
0603bd
-              if (fclose (f) != 0)
0603bd
+              if (gzclose (f) < 0)
0603bd
                 return 0; /* unknown error closing file */
0603bd
 
0603bd
               if (remove (filename) != 0)
0603bd
                 return 0; /* unknown error deleting file */
0603bd
 
0603bd
               (*create_callback) (filename);
0603bd
-              f = fopen (*opened_filename, FOPEN_RBIN);
0603bd
+              f = gzopen (*opened_filename, FOPEN_RBIN);
0603bd
               if (!f)
0603bd
                 return 0;
0603bd
-              nread = fread (data, sizeof (data), 1, f);
0603bd
-              if (nread == 0)
0603bd
+              nread = gzread (f, data, sizeof (data));
0603bd
+              if (nread <= 0)
0603bd
                 return 0;
0603bd
               goto determine_file_type; /* success */
0603bd
             }
0603bd
@@ -854,35 +855,40 @@ determine_file_type:
0603bd
     *compression_program = NULL;
0603bd
 
0603bd
   /* Seek back over the magic bytes.  */
0603bd
-  if (fseek (f, 0, 0) < 0)
0603bd
+  if (gzseek (f, 0, SEEK_SET) == -1)
0603bd
     return 0;
0603bd
 
0603bd
   if (*compression_program)
0603bd
     { /* It's compressed, so open a pipe.  */
0603bd
+      FILE *p;
0603bd
       char *command = concat (*compression_program, " -d", "");
0603bd
 
0603bd
-      if (fclose (f) < 0)
0603bd
+      if (gzclose (f) < 0)
0603bd
         return 0;
0603bd
-      f = freopen (*opened_filename, FOPEN_RBIN, stdin);
0603bd
-      if (!f)
0603bd
+      p = freopen (*opened_filename, FOPEN_RBIN, stdin);
0603bd
+      if (!p)
0603bd
         return 0;
0603bd
-      f = popen (command, "r");
0603bd
-      if (!f)
0603bd
+      p = popen (command, "r");
0603bd
+      if (!p)
0603bd
         {
0603bd
           /* Used for error message in calling code. */
0603bd
           *opened_filename = command;
0603bd
           return 0;
0603bd
         }
0603bd
+      else
0603bd
+        *is_pipe = 1;
0603bd
+      return p;
0603bd
     }
0603bd
   else
0603bd
     {
0603bd
-#if O_BINARY
0603bd
+#if 0 && O_BINARY
0603bd
       /* Since this is a text file, and we opened it in binary mode,
0603bd
          switch back to text mode.  */
0603bd
       f = freopen (*opened_filename, "r", f);
0603bd
       if (! f)
0603bd
 	return 0;
0603bd
 #endif
0603bd
+      *is_pipe = 0;
0603bd
     }
0603bd
 
0603bd
   return f;
0603bd
@@ -901,7 +907,8 @@ readfile (char *filename, int *sizep,
0603bd
     void (*create_callback) (char *), char **opened_filename,
0603bd
     char **compression_program)
0603bd
 {
0603bd
-  FILE *f;
0603bd
+  void *f;
0603bd
+  int pipe_p;
0603bd
   int filled = 0;
0603bd
   int data_size = 8192;
0603bd
   char *data = xmalloc (data_size);
0603bd
@@ -909,14 +916,20 @@ readfile (char *filename, int *sizep,
0603bd
   /* If they passed the space for the file name to return, use it.  */
0603bd
   f = open_possibly_compressed_file (filename, create_callback,
0603bd
                                      opened_filename,
0603bd
-                                     compression_program);
0603bd
+                                     compression_program,
0603bd
+                                     &pipe_p);
0603bd
 
0603bd
   if (!f)
0603bd
     return 0;
0603bd
 
0603bd
   for (;;)
0603bd
     {
0603bd
-      int nread = fread (data + filled, 1, data_size - filled, f);
0603bd
+      int nread;
0603bd
+
0603bd
+      if (pipe_p)
0603bd
+        nread = fread (data + filled, 1, data_size - filled, f);
0603bd
+      else
0603bd
+        nread = gzread (f, data + filled, data_size - filled);
0603bd
       if (nread < 0)
0603bd
         return 0;
0603bd
       if (nread == 0)
0603bd
@@ -935,8 +948,10 @@ readfile (char *filename, int *sizep,
0603bd
   /* We need to close the stream, since on some systems the pipe created
0603bd
      by popen is simulated by a temporary file which only gets removed
0603bd
      inside pclose.  */
0603bd
-  if (f != stdin)
0603bd
+  if (pipe_p)
0603bd
     pclose (f);
0603bd
+  else
0603bd
+    gzclose (f);
0603bd
 
0603bd
   *sizep = filled;
0603bd
   return data;
0603bd
diff -up texinfo-6.5.91/install-info/Makefile.in.orig texinfo-6.5.91/install-info/Makefile.in
0603bd
--- texinfo-6.5.91/install-info/Makefile.in.orig	2019-01-14 09:32:31.729895052 +0100
0603bd
+++ texinfo-6.5.91/install-info/Makefile.in	2019-01-14 09:32:52.574914503 +0100
0603bd
@@ -218,7 +218,7 @@ am__installdirs = "$(DESTDIR)$(bindir)"
0603bd
 PROGRAMS = $(bin_PROGRAMS)
0603bd
 am_ginstall_info_OBJECTS = install-info.$(OBJEXT)
0603bd
 ginstall_info_OBJECTS = $(am_ginstall_info_OBJECTS)
0603bd
-ginstall_info_LDADD = $(LDADD)
0603bd
+ginstall_info_LDADD = $(LDADD) -lz
0603bd
 am__DEPENDENCIES_1 =
0603bd
 ginstall_info_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
0603bd
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)