Blame SOURCES/texinfo-4.12-zlib.patch

1b2300
diff -up texinfo-5.1/install-info/install-info.c.orig texinfo-5.1/install-info/install-info.c
1b2300
--- texinfo-5.1/install-info/install-info.c.orig	2013-03-09 03:21:55.000000000 +0100
1b2300
+++ texinfo-5.1/install-info/install-info.c	2013-03-18 12:47:02.721136885 +0100
1b2300
@@ -22,6 +22,7 @@
1b2300
 #include <getopt.h>
1b2300
 #include <regex.h>
1b2300
 #include <argz.h>
1b2300
+#include <zlib.h>
1b2300
 
1b2300
 #define TAB_WIDTH 8
1b2300
 
1b2300
@@ -670,7 +671,7 @@ The first time you invoke Info you start
1b2300
    
1b2300
    MAGIC number, not the filename.  */
1b2300
 
1b2300
-FILE *
1b2300
+void *
1b2300
 open_possibly_compressed_file (char *filename,
1b2300
     void (*create_callback) (char *),
1b2300
     char **opened_filename, char **compression_program, int *is_pipe) 
1b2300
@@ -678,7 +679,7 @@ open_possibly_compressed_file (char *fil
1b2300
   char *local_opened_filename, *local_compression_program;
1b2300
   int nread;
1b2300
   char data[13];
1b2300
-  FILE *f;
1b2300
+  gzFile *f;
1b2300
 
1b2300
   /* We let them pass NULL if they don't want this info, but it's easier
1b2300
      to always determine it.  */
1b2300
@@ -686,48 +687,48 @@ open_possibly_compressed_file (char *fil
1b2300
     opened_filename = &local_opened_filename;
1b2300
 
1b2300
   *opened_filename = filename;
1b2300
-  f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+  f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
   if (!f)
1b2300
     {
1b2300
       *opened_filename = concat (filename, ".gz", "");
1b2300
-      f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+      f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
     }
1b2300
   if (!f)
1b2300
     {
1b2300
       free (*opened_filename);
1b2300
       *opened_filename = concat (filename, ".xz", "");
1b2300
-      f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+      f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
     }
1b2300
   if (!f)
1b2300
     {
1b2300
       free (*opened_filename);
1b2300
       *opened_filename = concat (filename, ".bz2", "");
1b2300
-      f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+      f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
     }
1b2300
   if (!f)
1b2300
     {
1b2300
       free (*opened_filename);
1b2300
       *opened_filename = concat (filename, ".lz", "");
1b2300
-      f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+      f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
     }
1b2300
   if (!f)
1b2300
     {
1b2300
      free (*opened_filename);
1b2300
      *opened_filename = concat (filename, ".lzma", "");
1b2300
-     f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+     f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
     }
1b2300
 #ifdef __MSDOS__
1b2300
   if (!f)
1b2300
     {
1b2300
       free (*opened_filename);
1b2300
       *opened_filename = concat (filename, ".igz", "");
1b2300
-      f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+      f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
     }
1b2300
   if (!f)
1b2300
     {
1b2300
       free (*opened_filename);
1b2300
       *opened_filename = concat (filename, ".inz", "");
1b2300
-      f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+      f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
     }
1b2300
 #endif /* __MSDOS__ */
1b2300
    if (!f)
1b2300
@@ -739,7 +740,7 @@ open_possibly_compressed_file (char *fil
1b2300
            /* And try opening it again.  */
1b2300
            free (*opened_filename);
1b2300
            *opened_filename = filename;
1b2300
-           f = fopen (*opened_filename, FOPEN_RBIN);
1b2300
+           f = gzopen (*opened_filename, FOPEN_RBIN);
1b2300
            if (!f)
1b2300
              pfatal_with_name (filename);
1b2300
          }
1b2300
@@ -749,12 +750,12 @@ open_possibly_compressed_file (char *fil
1b2300
 
1b2300
   /* Read first few bytes of file rather than relying on the filename.
1b2300
      If the file is shorter than this it can't be usable anyway.  */
1b2300
-  nread = fread (data, sizeof (data), 1, f);
1b2300
-  if (nread != 1)
1b2300
+  nread = gzread (f, data, sizeof (data));
1b2300
+  if (nread != sizeof (data))
1b2300
     {
1b2300
       /* Empty files don't set errno, so we get something like
1b2300
          "install-info: No error for foo", which is confusing.  */
1b2300
-      if (nread == 0)
1b2300
+      if (nread >= 0)
1b2300
         fatal (_("%s: empty file"), *opened_filename);
1b2300
       pfatal_with_name (*opened_filename);
1b2300
     }
1b2300
@@ -821,20 +822,22 @@ open_possibly_compressed_file (char *fil
1b2300
 
1b2300
   if (*compression_program)
1b2300
     { /* It's compressed, so fclose the file and then open a pipe.  */
1b2300
+      FILE *p;
1b2300
       char *command = concat (*compression_program," -cd <", *opened_filename);
1b2300
-      if (fclose (f) < 0)
1b2300
+      if (gzclose (f) < 0)
1b2300
         pfatal_with_name (*opened_filename);
1b2300
-      f = popen (command, "r");
1b2300
-      if (f)
1b2300
+      p = popen (command, "r");
1b2300
+      if (p)
1b2300
         *is_pipe = 1;
1b2300
       else
1b2300
         pfatal_with_name (command);
1b2300
+      return p;
1b2300
     }
1b2300
   else
1b2300
     { /* It's a plain file, seek back over the magic bytes.  */
1b2300
-      if (fseek (f, 0, 0) < 0)
1b2300
+      if (gzseek (f, 0, SEEK_SET) < 0)
1b2300
         pfatal_with_name (*opened_filename);
1b2300
-#if O_BINARY
1b2300
+#if 0 && O_BINARY
1b2300
       /* Since this is a text file, and we opened it in binary mode,
1b2300
          switch back to text mode.  */
1b2300
       f = freopen (*opened_filename, "r", f);
1b2300
@@ -859,7 +862,7 @@ readfile (char *filename, int *sizep,
1b2300
     char **compression_program)
1b2300
 {
1b2300
   char *real_name;
1b2300
-  FILE *f;
1b2300
+  void *f;
1b2300
   int pipe_p;
1b2300
   int filled = 0;
1b2300
   int data_size = 8192;
1b2300
@@ -873,7 +876,12 @@ readfile (char *filename, int *sizep,
1b2300
 
1b2300
   for (;;)
1b2300
     {
1b2300
-      int nread = fread (data + filled, 1, data_size - filled, f);
1b2300
+      int nread;
1b2300
+
1b2300
+      if (pipe_p)
1b2300
+        nread = fread (data + filled, 1, data_size - filled, f);
1b2300
+      else
1b2300
+        nread = gzread (f, data + filled, data_size - filled);
1b2300
       if (nread < 0)
1b2300
         pfatal_with_name (real_name);
1b2300
       if (nread == 0)
1b2300
@@ -895,7 +903,7 @@ readfile (char *filename, int *sizep,
1b2300
   if (pipe_p)
1b2300
     pclose (f);
1b2300
   else
1b2300
-    fclose (f);
1b2300
+    gzclose (f);
1b2300
 
1b2300
   *sizep = filled;
1b2300
   return data;
1b2300
diff -up texinfo-5.1/install-info/Makefile.in.orig texinfo-5.1/install-info/Makefile.in
1b2300
--- texinfo-5.1/install-info/Makefile.in.orig	2013-03-12 23:56:43.000000000 +0100
1b2300
+++ texinfo-5.1/install-info/Makefile.in	2013-03-18 12:42:57.165767101 +0100
1b2300
@@ -171,7 +171,7 @@ am__installdirs = "$(DESTDIR)$(bindir)"
1b2300
 PROGRAMS = $(bin_PROGRAMS)
1b2300
 am_ginstall_info_OBJECTS = install-info.$(OBJEXT)
1b2300
 ginstall_info_OBJECTS = $(am_ginstall_info_OBJECTS)
1b2300
-ginstall_info_LDADD = $(LDADD)
1b2300
+ginstall_info_LDADD = $(LDADD) -lz
1b2300
 am__DEPENDENCIES_1 =
1b2300
 ginstall_info_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
1b2300
 	$(am__DEPENDENCIES_1)