texi2html/texinfo-zlib.patch

78 lines
2.5 KiB
Diff

Index: texinfo-5.2/install-info/Makefile.in
===================================================================
--- texinfo-5.2.orig/install-info/Makefile.in
+++ texinfo-5.2/install-info/Makefile.in
@@ -201,7 +201,7 @@ am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_ginstall_info_OBJECTS = install-info.$(OBJEXT)
ginstall_info_OBJECTS = $(am_ginstall_info_OBJECTS)
-ginstall_info_LDADD = $(LDADD)
+ginstall_info_LDADD = $(LDADD) -lzio
am__DEPENDENCIES_1 =
ginstall_info_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
$(am__DEPENDENCIES_1)
Index: texinfo-5.2/install-info/install-info.c
===================================================================
--- texinfo-5.2.orig/install-info/install-info.c
+++ texinfo-5.2/install-info/install-info.c
@@ -22,6 +22,7 @@
#include <getopt.h>
#include <regex.h>
#include <argz.h>
+#include <zio.h>
#define TAB_WIDTH 8
@@ -687,10 +688,31 @@ open_possibly_compressed_file (char *fil
*opened_filename = filename;
f = fopen (*opened_filename, FOPEN_RBIN);
+ if (!compression_program)
+ compression_program = &local_compression_program;
+ *compression_program = NULL;
+ if (f)
+ {
+ nread = fread (data, sizeof (data), 1, f);
+ if (nread == 1)
+ {
+ if (data[0] == '\x1f' && data[1] == '\x8b')
+ *compression_program = "g";
+ else if (data[0] == '\x1f' && data[1] == '\x9d')
+ *compression_program = "Z";
+ else if (data[0] == '\x1f' && data[1] == '\x9e')
+ *compression_program = "z";
+ else if (data[0] == 'B' && data[1] == 'Z' && data[2] == 'h')
+ *compression_program = "b";
+ }
+ fclose (f);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
+ }
if (!f)
{
*opened_filename = concat (filename, ".gz", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
+ *compression_program = "g";
}
if (!f)
{
@@ -702,7 +724,8 @@ open_possibly_compressed_file (char *fil
{
free (*opened_filename);
*opened_filename = concat (filename, ".bz2", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
+ *compression_program = "b";
}
if (!f)
{
@@ -739,7 +762,7 @@ open_possibly_compressed_file (char *fil
/* And try opening it again. */
free (*opened_filename);
*opened_filename = filename;
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
if (!f)
pfatal_with_name (filename);
}