0415479
diff -up texinfo-4.12/install-info/Makefile.in_old texinfo-4.12/install-info/Makefile.in
0415479
--- texinfo-4.12/install-info/Makefile.in_old	2008-05-13 13:33:55.000000000 +0200
0415479
+++ texinfo-4.12/install-info/Makefile.in	2008-05-13 13:52:35.000000000 +0200
0415479
@@ -114,7 +114,7 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
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 =
21e91be
 ginstall_info_DEPENDENCIES = ../lib/libtxi.a \
21e91be
 	$(top_builddir)/gnulib/lib/libgnu.a $(am__DEPENDENCIES_1)
0415479
diff -up texinfo-4.12/install-info/install-info.c_old texinfo-4.12/install-info/install-info.c
0415479
--- texinfo-4.12/install-info/install-info.c_old	2008-05-13 13:52:44.000000000 +0200
0415479
+++ texinfo-4.12/install-info/install-info.c	2008-05-14 10:30:53.000000000 +0200
0415479
@@ -21,6 +21,7 @@
e34f792
 #include <getopt.h>
21e91be
 #include <regex.h>
0415479
 #include <argz.h>
e34f792
+#include <zlib.h>
e34f792
 
0415479
 #define TAB_WIDTH 8
e34f792
 
0415479
@@ -638,7 +639,7 @@ The first time you invoke Info you start
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) 
0415479
@@ -646,7 +647,7 @@ open_possibly_compressed_file (char *fil
e34f792
   char *local_opened_filename, *local_compression_program;
e34f792
   int nread;
0415479
   char data[13];
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.  */
0415479
@@ -654,22 +655,22 @@ open_possibly_compressed_file (char *fil
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
     }
0415479
   if (!f)
0415479
     {
0415479
      free (*opened_filename);
0415479
      *opened_filename = concat (filename, ".lzma", "");
0415479
-     f = fopen (*opened_filename, FOPEN_RBIN);
0415479
+     f = gzopen (*opened_filename, FOPEN_RBIN);
0415479
     }
e34f792
 
e34f792
 #ifdef __MSDOS__
0415479
@@ -677,13 +678,13 @@ open_possibly_compressed_file (char *fil
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)
0415479
@@ -695,7 +696,7 @@ open_possibly_compressed_file (char *fil
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
             }
0415479
@@ -706,12 +707,12 @@ open_possibly_compressed_file (char *fil
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
     }
0415479
@@ -758,20 +759,22 @@ open_possibly_compressed_file (char *fil
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);
0415479
@@ -796,7 +799,7 @@ readfile (char *filename, int *sizep,
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;
0415479
@@ -810,7 +813,12 @@ readfile (char *filename, int *sizep,
e34f792
 
e34f792
   for (;;)
e34f792
     {
e34f792
-      int nread = fread (data + filled, 1, data_size - filled, f);
e34f792
+      int nread;
21e91be
+      
e34f792
+      if (pipe_p)
21e91be
+       nread = fread (data + filled, 1, data_size - filled, f);
e34f792
+      else
21e91be
+       nread = gzread (f, data + filled, data_size - filled);
e34f792
       if (nread < 0)
e34f792
         pfatal_with_name (real_name);
e34f792
       if (nread == 0)
0415479
@@ -832,7 +840,7 @@ readfile (char *filename, int *sizep,
e34f792
   if (pipe_p)
e34f792
     pclose (f);
e34f792
   else
e34f792
-    fclose (f);
e34f792
+    gzclose (f);
e34f792
 
e34f792
   *sizep = filled;
e34f792
   return data;