]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - texinfo/patches/texinfo-4.12-zlib.patch
Change file layout of the makefiles.
[people/ms/ipfire-3.x.git] / texinfo / patches / texinfo-4.12-zlib.patch
1 diff -up texinfo-4.12/install-info/Makefile.in_old texinfo-4.12/install-info/Makefile.in
2 --- texinfo-4.12/install-info/Makefile.in_old 2008-05-13 13:33:55.000000000 +0200
3 +++ texinfo-4.12/install-info/Makefile.in 2008-05-13 13:52:35.000000000 +0200
4 @@ -114,7 +114,7 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
5 PROGRAMS = $(bin_PROGRAMS)
6 am_ginstall_info_OBJECTS = install-info.$(OBJEXT)
7 ginstall_info_OBJECTS = $(am_ginstall_info_OBJECTS)
8 -ginstall_info_LDADD = $(LDADD)
9 +ginstall_info_LDADD = $(LDADD) -lz
10 am__DEPENDENCIES_1 =
11 ginstall_info_DEPENDENCIES = ../lib/libtxi.a \
12 $(top_builddir)/gnulib/lib/libgnu.a $(am__DEPENDENCIES_1)
13 diff -up texinfo-4.12/install-info/install-info.c_old texinfo-4.12/install-info/install-info.c
14 --- texinfo-4.12/install-info/install-info.c_old 2008-05-13 13:52:44.000000000 +0200
15 +++ texinfo-4.12/install-info/install-info.c 2008-05-14 10:30:53.000000000 +0200
16 @@ -21,6 +21,7 @@
17 #include <getopt.h>
18 #include <regex.h>
19 #include <argz.h>
20 +#include <zlib.h>
21
22 #define TAB_WIDTH 8
23
24 @@ -638,7 +639,7 @@ The first time you invoke Info you start
25 COMPRESSION_PROGRAM. The compression program is determined by the
26 magic number, not the filename. */
27
28 -FILE *
29 +void *
30 open_possibly_compressed_file (char *filename,
31 void (*create_callback) (char *),
32 char **opened_filename, char **compression_program, int *is_pipe)
33 @@ -646,7 +647,7 @@ open_possibly_compressed_file (char *fil
34 char *local_opened_filename, *local_compression_program;
35 int nread;
36 char data[13];
37 - FILE *f;
38 + gzFile *f;
39
40 /* We let them pass NULL if they don't want this info, but it's easier
41 to always determine it. */
42 @@ -654,22 +655,22 @@ open_possibly_compressed_file (char *fil
43 opened_filename = &local_opened_filename;
44
45 *opened_filename = filename;
46 - f = fopen (*opened_filename, FOPEN_RBIN);
47 + f = gzopen (*opened_filename, FOPEN_RBIN);
48 if (!f)
49 {
50 *opened_filename = concat (filename, ".gz", "");
51 - f = fopen (*opened_filename, FOPEN_RBIN);
52 + f = gzopen (*opened_filename, FOPEN_RBIN);
53 if (!f)
54 {
55 free (*opened_filename);
56 *opened_filename = concat (filename, ".bz2", "");
57 - f = fopen (*opened_filename, FOPEN_RBIN);
58 + f = gzopen (*opened_filename, FOPEN_RBIN);
59 }
60 if (!f)
61 {
62 free (*opened_filename);
63 *opened_filename = concat (filename, ".lzma", "");
64 - f = fopen (*opened_filename, FOPEN_RBIN);
65 + f = gzopen (*opened_filename, FOPEN_RBIN);
66 }
67
68 #ifdef __MSDOS__
69 @@ -677,13 +678,13 @@ open_possibly_compressed_file (char *fil
70 {
71 free (*opened_filename);
72 *opened_filename = concat (filename, ".igz", "");
73 - f = fopen (*opened_filename, FOPEN_RBIN);
74 + f = gzopen (*opened_filename, FOPEN_RBIN);
75 }
76 if (!f)
77 {
78 free (*opened_filename);
79 *opened_filename = concat (filename, ".inz", "");
80 - f = fopen (*opened_filename, FOPEN_RBIN);
81 + f = gzopen (*opened_filename, FOPEN_RBIN);
82 }
83 #endif
84 if (!f)
85 @@ -695,7 +696,7 @@ open_possibly_compressed_file (char *fil
86 /* And try opening it again. */
87 free (*opened_filename);
88 *opened_filename = filename;
89 - f = fopen (*opened_filename, FOPEN_RBIN);
90 + f = gzopen (*opened_filename, FOPEN_RBIN);
91 if (!f)
92 pfatal_with_name (filename);
93 }
94 @@ -706,12 +707,12 @@ open_possibly_compressed_file (char *fil
95
96 /* Read first few bytes of file rather than relying on the filename.
97 If the file is shorter than this it can't be usable anyway. */
98 - nread = fread (data, sizeof (data), 1, f);
99 - if (nread != 1)
100 + nread = gzread (f, data, sizeof (data));
101 + if (nread != sizeof (data))
102 {
103 /* Empty files don't set errno, so we get something like
104 "install-info: No error for foo", which is confusing. */
105 - if (nread == 0)
106 + if (nread >= 0)
107 fatal (_("%s: empty file"), *opened_filename, 0);
108 pfatal_with_name (*opened_filename);
109 }
110 @@ -758,20 +759,22 @@ open_possibly_compressed_file (char *fil
111
112 if (*compression_program)
113 { /* It's compressed, so fclose the file and then open a pipe. */
114 + FILE *p;
115 char *command = concat (*compression_program," -cd <", *opened_filename);
116 - if (fclose (f) < 0)
117 + if (gzclose (f) < 0)
118 pfatal_with_name (*opened_filename);
119 - f = popen (command, "r");
120 - if (f)
121 + p = popen (command, "r");
122 + if (p)
123 *is_pipe = 1;
124 else
125 pfatal_with_name (command);
126 + return p;
127 }
128 else
129 { /* It's a plain file, seek back over the magic bytes. */
130 - if (fseek (f, 0, 0) < 0)
131 + if (gzseek (f, 0, SEEK_SET) < 0)
132 pfatal_with_name (*opened_filename);
133 -#if O_BINARY
134 +#if 0 && O_BINARY
135 /* Since this is a text file, and we opened it in binary mode,
136 switch back to text mode. */
137 f = freopen (*opened_filename, "r", f);
138 @@ -796,7 +799,7 @@ readfile (char *filename, int *sizep,
139 char **compression_program)
140 {
141 char *real_name;
142 - FILE *f;
143 + void *f;
144 int pipe_p;
145 int filled = 0;
146 int data_size = 8192;
147 @@ -810,7 +813,12 @@ readfile (char *filename, int *sizep,
148
149 for (;;)
150 {
151 - int nread = fread (data + filled, 1, data_size - filled, f);
152 + int nread;
153 +
154 + if (pipe_p)
155 + nread = fread (data + filled, 1, data_size - filled, f);
156 + else
157 + nread = gzread (f, data + filled, data_size - filled);
158 if (nread < 0)
159 pfatal_with_name (real_name);
160 if (nread == 0)
161 @@ -832,7 +840,7 @@ readfile (char *filename, int *sizep,
162 if (pipe_p)
163 pclose (f);
164 else
165 - fclose (f);
166 + gzclose (f);
167
168 *sizep = filled;
169 return data;