]>
Commit | Line | Data |
---|---|---|
c6bc64b4 | 1 | diff -Nru texinfo-4.0/util/Makefile.am texinfo-4.0.new/util/Makefile.am |
2 | --- texinfo-4.0/util/Makefile.am Sat Jul 17 00:00:26 1999 | |
3 | +++ texinfo-4.0.new/util/Makefile.am Thu Oct 12 21:33:37 2000 | |
4 | @@ -7,7 +7,7 @@ | |
5 | ||
6 | localedir = $(datadir)/locale | |
7 | INCLUDES = -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\" | |
8 | -LDADD = ../lib/libtxi.a @INTLLIBS@ | |
9 | +LDADD = ../lib/libtxi.a -lz @INTLLIBS@ | |
10 | ||
11 | # Most of these are just for fun. The only one that's really supported | |
12 | # is texi2dvi. | |
13 | diff -Nru texinfo-4.0/util/install-info.c texinfo-4.0.new/util/install-info.c | |
14 | --- texinfo-4.0/util/install-info.c Thu Oct 12 21:34:07 2000 | |
15 | +++ texinfo-4.0.new/util/install-info.c Thu Oct 12 21:33:06 2000 | |
88542f05 | 16 | @@ -19,6 +19,7 @@ |
17 | ||
18 | #include "system.h" | |
19 | #include <getopt.h> | |
20 | +#include <zlib.h> | |
21 | ||
22 | static char *progname = "install-info"; | |
23 | ||
b1f55548 | 24 | @@ -481,7 +482,7 @@ |
88542f05 | 25 | COMPRESSION_PROGRAM. The compression program is determined by the |
26 | magic number, not the filename. */ | |
27 | ||
28 | -FILE * | |
29 | +gzFile | |
30 | open_possibly_compressed_file (filename, create_callback, | |
31 | opened_filename, compression_program, is_pipe) | |
32 | char *filename; | |
b1f55548 | 33 | @@ -493,7 +494,7 @@ |
88542f05 | 34 | char *local_opened_filename, *local_compression_program; |
35 | int nread; | |
36 | char data[4]; | |
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. */ | |
b1f55548 | 42 | @@ -501,23 +502,23 @@ |
88542f05 | 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 | #ifdef __MSDOS__ | |
54 | if (!f) | |
55 | { | |
56 | free (*opened_filename); | |
57 | *opened_filename = concat (filename, ".igz", ""); | |
58 | - f = fopen (*opened_filename, FOPEN_RBIN); | |
59 | + f = gzopen (*opened_filename, FOPEN_RBIN); | |
60 | } | |
61 | if (!f) | |
62 | { | |
63 | free (*opened_filename); | |
64 | *opened_filename = concat (filename, ".inz", ""); | |
65 | - f = fopen (*opened_filename, FOPEN_RBIN); | |
66 | + f = gzopen (*opened_filename, FOPEN_RBIN); | |
67 | } | |
68 | #endif | |
69 | if (!f) | |
b1f55548 | 70 | @@ -529,7 +530,7 @@ |
88542f05 | 71 | /* And try opening it again. */ |
72 | free (*opened_filename); | |
73 | *opened_filename = filename; | |
74 | - f = fopen (*opened_filename, FOPEN_RBIN); | |
75 | + f = gzopen (*opened_filename, FOPEN_RBIN); | |
76 | if (!f) | |
77 | pfatal_with_name (filename); | |
78 | } | |
b1f55548 | 79 | @@ -538,54 +539,7 @@ |
88542f05 | 80 | } |
81 | } | |
82 | ||
83 | - /* Read first few bytes of file rather than relying on the filename. | |
84 | - If the file is shorter than this it can't be usable anyway. */ | |
85 | - nread = fread (data, sizeof (data), 1, f); | |
86 | - if (nread != 1) | |
87 | - { | |
88 | - /* Empty files don't set errno, so we get something like | |
b1f55548 | 89 | - "install-info: No error for foo", which is confusing. */ |
88542f05 | 90 | - if (nread == 0) |
91 | - fatal (_("%s: empty file"), *opened_filename); | |
92 | - pfatal_with_name (*opened_filename); | |
93 | - } | |
94 | - | |
95 | - if (!compression_program) | |
96 | - compression_program = &local_compression_program; | |
97 | - | |
98 | - if (data[0] == '\x1f' && data[1] == '\x8b') | |
99 | -#if STRIP_DOT_EXE | |
100 | - /* An explicit .exe yields a better diagnostics from popen below | |
101 | - if they don't have gzip installed. */ | |
102 | - *compression_program = "gzip.exe"; | |
103 | -#else | |
104 | - *compression_program = "gzip"; | |
105 | -#endif | |
106 | - else | |
107 | - *compression_program = NULL; | |
108 | - | |
109 | - if (*compression_program) | |
110 | - { /* It's compressed, so fclose the file and then open a pipe. */ | |
111 | - char *command = concat (*compression_program," -cd <", *opened_filename); | |
112 | - if (fclose (f) < 0) | |
113 | - pfatal_with_name (*opened_filename); | |
114 | - f = popen (command, "r"); | |
115 | - if (f) | |
116 | - *is_pipe = 1; | |
117 | - else | |
118 | - pfatal_with_name (command); | |
119 | - } | |
120 | - else | |
121 | - { /* It's a plain file, seek back over the magic bytes. */ | |
122 | - if (fseek (f, 0, 0) < 0) | |
123 | - pfatal_with_name (*opened_filename); | |
124 | -#if O_BINARY | |
125 | - /* Since this is a text file, and we opened it in binary mode, | |
126 | - switch back to text mode. */ | |
127 | - f = freopen (*opened_filename, "r", f); | |
128 | -#endif | |
d8304022 | 129 | - *is_pipe = 0; |
88542f05 | 130 | - } |
d8304022 | 131 | + *is_pipe = 0; |
88542f05 | 132 | |
133 | return f; | |
134 | } | |
b1f55548 | 135 | @@ -608,7 +562,7 @@ |
88542f05 | 136 | char **compression_program; |
137 | { | |
138 | char *real_name; | |
139 | - FILE *f; | |
140 | + gzFile *f; | |
141 | int pipe_p; | |
142 | int filled = 0; | |
143 | int data_size = 8192; | |
b1f55548 | 144 | @@ -622,7 +576,7 @@ |
88542f05 | 145 | |
146 | for (;;) | |
147 | { | |
148 | - int nread = fread (data + filled, 1, data_size - filled, f); | |
149 | + int nread = gzread (f, data + filled, data_size - filled); | |
150 | if (nread < 0) | |
151 | pfatal_with_name (real_name); | |
152 | if (nread == 0) | |
b1f55548 | 153 | @@ -641,10 +595,7 @@ |
88542f05 | 154 | /* We need to close the stream, since on some systems the pipe created |
155 | by popen is simulated by a temporary file which only gets removed | |
156 | inside pclose. */ | |
157 | - if (pipe_p) | |
158 | - pclose (f); | |
159 | - else | |
160 | - fclose (f); | |
161 | + gzclose(f); | |
162 | ||
163 | *sizep = filled; | |
164 | return data; | |
b1f55548 | 165 | @@ -1407,7 +1358,7 @@ |
88542f05 | 166 | warning (_("no entries found for `%s'; nothing deleted"), infile); |
167 | ||
168 | output_dirfile (opened_dirfilename, dir_nlines, dir_lines, n_entries_to_add, | |
169 | - entries_to_add, input_sections, compression_program); | |
170 | + entries_to_add, input_sections, NULL); | |
171 | ||
172 | xexit (0); | |
173 | } |