]> git.pld-linux.org Git - packages/texinfo.git/blob - texinfo-zlib.patch
- merge translations from Conectiva.
[packages/texinfo.git] / texinfo-zlib.patch
1 --- texinfo-4.0f/util/install-info.c.orig       Sat Feb  9 14:35:16 2002
2 +++ texinfo-4.0f/util/install-info.c    Sat Feb  9 14:37:13 2002
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  
11 @@ -481,7 +482,7 @@
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;
20 @@ -493,7 +494,7 @@
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.  */
29 @@ -501,23 +502,23 @@
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)
57 @@ -529,7 +530,7 @@
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              }
66 @@ -538,54 +539,7 @@
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
76 -         "install-info: No error for foo", which is confusing.  */
77 -      if (nread == 0)
78 -        fatal (_("%s: empty file"), *opened_filename, 0);
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
116 -      *is_pipe = 0;
117 -    }
118 +  *is_pipe = 0;
119  
120    return f;
121  }
122 @@ -608,7 +562,7 @@
123       char **compression_program;
124  {
125    char *real_name;
126 -  FILE *f;
127 +  gzFile *f;
128    int pipe_p;
129    int filled = 0;
130    int data_size = 8192;
131 @@ -622,7 +576,7 @@
132  
133    for (;;)
134      {
135 -      int nread = fread (data + filled, 1, data_size - filled, f);
136 +      int nread = gzread (f, data + filled, data_size - filled);
137        if (nread < 0)
138          pfatal_with_name (real_name);
139        if (nread == 0)
140 @@ -641,10 +595,7 @@
141    /* We need to close the stream, since on some systems the pipe created
142       by popen is simulated by a temporary file which only gets removed
143       inside pclose.  */
144 -  if (pipe_p)
145 -    pclose (f);
146 -  else
147 -    fclose (f);
148 +  gzclose(f);
149  
150    *sizep = filled;
151    return data;
152 @@ -1409,7 +1360,7 @@
153      warning (_("no entries found for `%s'; nothing deleted"), infile, 0);
154  
155    output_dirfile (opened_dirfilename, dir_nlines, dir_lines, n_entries_to_add,
156 -                  entries_to_add, input_sections, compression_program);
157 +                  entries_to_add, input_sections, NULL);
158  
159    xexit (0);
160  }
161 --- texinfo-4.0f/util/Makefile.am~      Sat Feb  9 15:15:46 2002
162 +++ texinfo-4.0f/util/Makefile.am       Sat Feb  9 15:15:46 2002
163 @@ -7,7 +7,7 @@
164  
165  localedir = $(datadir)/locale
166  INCLUDES = -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
167 -LDADD = ../lib/libtxi.a @INTLLIBS@
168 +LDADD = ../lib/libtxi.a @INTLLIBS@ -lz
169  
170  # Most of these are for fun.  The only one that's really supported is texi2dvi.
171  EXTRA_DIST = README deref.c fix-info-dir fixfonts \
This page took 0.120873 seconds and 3 git commands to generate.