Репозитории ALT
Группа :: Издательство
Пакет: texinfo
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: texinfo-alt-install-info-zio.patch
Скачать
Скачать
Read compressed info pages using libzio.
--- texinfo/install-info/Makefile.am
+++ texinfo/install-info/Makefile.am
@@ -33,4 +33,4 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/gnulib/lib \
-I$(top_builddir)/gnulib/lib \
-DLOCALEDIR=\"$(localedir)\"
-LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL) $(LIBTHREAD)
+LDADD = $(top_builddir)/gnulib/lib/libgnu.a -lzio $(LIBINTL) $(LIBTHREAD)
--- texinfo/install-info/install-info.c
+++ texinfo/install-info/install-info.c
@@ -19,6 +19,7 @@
#include <getopt.h>
#include <regex.h>
#include <argz.h>
+#include <zio.h>
#define TAB_WIDTH 8
@@ -692,11 +693,9 @@ The first time you invoke Info you start off looking at this node.\n\
FILE *
open_possibly_compressed_file (char *filename,
void (*create_callback) (char *),
- char **opened_filename, char **compression_program)
+ char **opened_filename, char **compression_program)
{
- char *local_opened_filename, *local_compression_program;
- int nread;
- char data[13];
+ char *local_opened_filename;
FILE *f;
/* We let them pass NULL if they don't want this info, but it's easier
@@ -705,48 +704,48 @@ open_possibly_compressed_file (char *filename,
opened_filename = &local_opened_filename;
*opened_filename = filename;
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
if (!f)
{
*opened_filename = concat (filename, ".gz", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
}
if (!f)
{
free (*opened_filename);
*opened_filename = concat (filename, ".xz", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
}
if (!f)
{
free (*opened_filename);
*opened_filename = concat (filename, ".bz2", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
}
if (!f)
{
free (*opened_filename);
*opened_filename = concat (filename, ".lz", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
}
if (!f)
{
free (*opened_filename);
*opened_filename = concat (filename, ".lzma", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
}
#ifdef __MSDOS__
if (!f)
{
free (*opened_filename);
*opened_filename = concat (filename, ".igz", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
}
if (!f)
{
free (*opened_filename);
*opened_filename = concat (filename, ".inz", "");
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
}
#endif /* __MSDOS__ */
if (!f)
@@ -762,7 +761,7 @@ open_possibly_compressed_file (char *filename,
(*create_callback) (filename);
/* And try opening it again. */
- f = fopen (*opened_filename, FOPEN_RBIN);
+ f = fzopen (*opened_filename, FOPEN_RBIN);
if (!f)
return 0;
}
@@ -770,6 +769,7 @@ open_possibly_compressed_file (char *filename,
return 0;
}
+#if 0
/* Read first few bytes of file rather than relying on the filename.
If the file is shorter than this it can't be usable anyway. */
nread = fread (data, sizeof (data), 1, f);
@@ -866,6 +866,7 @@ determine_file_type:
return 0;
#endif
}
+#endif
return f;
}
@@ -918,7 +919,7 @@ readfile (char *filename, int *sizep,
by popen is simulated by a temporary file which only gets removed
inside pclose. */
if (f != stdin)
- pclose (f);
+ fclose (f);
*sizep = filled;
return data;
@@ -932,19 +933,13 @@ readfile (char *filename, int *sizep,
static void
output_dirfile (char *dirfile, int dir_nlines, struct line_data *dir_lines,
int n_entries_to_add, struct spec_entry *entries_to_add,
- struct spec_section *input_sections, char *compression_program)
+ struct spec_section *input_sections)
{
int n_entries_added = 0;
int i;
FILE *output;
- if (compression_program)
- {
- char *command = concat (compression_program, ">", dirfile);
- output = popen (command, "w");
- }
- else
- output = fopen (dirfile, "w");
+ output = fopen (dirfile, "w");
if (!output)
{
@@ -1055,10 +1050,7 @@ output_dirfile (char *dirfile, int dir_nlines, struct line_data *dir_lines,
/* Some systems, such as MS-DOS, simulate pipes with temporary files.
On those systems, the compressor actually gets run inside pclose,
so we must call pclose. */
- if (compression_program)
- pclose (output);
- else
- fclose (output);
+ fclose (output);
}
/* Read through the input LINES, to find the section names and the
@@ -2684,7 +2676,7 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
else
output_dirfile (opened_dirfilename, dir_nlines, dir_lines,
n_entries_to_add, entries_to_add,
- input_sections, compression_program);
+ input_sections);
exit (EXIT_SUCCESS);
}