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
9 static char *progname = "install-info";
12 COMPRESSION_PROGRAM. The compression program is determined by the
13 magic number, not the filename. */
17 open_possibly_compressed_file (filename, create_callback,
18 opened_filename, compression_program, is_pipe)
21 char *local_opened_filename, *local_compression_program;
27 /* We let them pass NULL if they don't want this info, but it's easier
28 to always determine it. */
30 opened_filename = &local_opened_filename;
32 *opened_filename = filename;
33 - f = fopen (*opened_filename, FOPEN_RBIN);
34 + f = gzopen (*opened_filename, FOPEN_RBIN);
37 *opened_filename = concat (filename, ".gz", "");
38 - f = fopen (*opened_filename, FOPEN_RBIN);
39 + f = gzopen (*opened_filename, FOPEN_RBIN);
43 free (*opened_filename);
44 *opened_filename = concat (filename, ".igz", "");
45 - f = fopen (*opened_filename, FOPEN_RBIN);
46 + f = gzopen (*opened_filename, FOPEN_RBIN);
50 free (*opened_filename);
51 *opened_filename = concat (filename, ".inz", "");
52 - f = fopen (*opened_filename, FOPEN_RBIN);
53 + f = gzopen (*opened_filename, FOPEN_RBIN);
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);
64 pfatal_with_name (filename);
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);
75 - /* Empty files don't set errno, so we get something like
76 - "install-info: No error for foo", which is confusing. */
78 - fatal (_("%s: empty file"), *opened_filename);
79 - pfatal_with_name (*opened_filename);
82 - if (!compression_program)
83 - compression_program = &local_compression_program;
85 - if (data[0] == '\x1f' && data[1] == '\x8b')
87 - /* An explicit .exe yields a better diagnostics from popen below
88 - if they don't have gzip installed. */
89 - *compression_program = "gzip.exe";
91 - *compression_program = "gzip";
94 - *compression_program = NULL;
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);
100 - pfatal_with_name (*opened_filename);
101 - f = popen (command, "r");
105 - pfatal_with_name (command);
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);
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);
122 char **compression_program;
129 int data_size = 8192;
134 - int nread = fread (data + filled, 1, data_size - filled, f);
135 + int nread = gzread (f, data + filled, data_size - filled);
137 pfatal_with_name (real_name);
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
151 @@ -1407,7 +1358,7 @@
152 warning (_("no entries found for `%s'; nothing deleted"), infile);
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);
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
163 DEFS = @DEFS@ -I. -I$(srcdir) -I..
164 CPPFLAGS = @CPPFLAGS@
168 install_info_SOURCES = install-info.c
169 install_info_OBJECTS = install-info.o
170 install_info_LDADD = $(LDADD)