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