texinfo-4.13-xz.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. https://bugs.gentoo.org/269742
  2. From bfae00d02b5fb3a2ce34c09d2dbf0ca2f96b154f Mon Sep 17 00:00:00 2001
  3. From: Karl Berry <karl@gnu.org>
  4. Date: Sat, 14 Mar 2009 17:57:41 +0000
  5. Subject: [PATCH] support xz compression, http://tukaani.org/xz
  6. ---
  7. ChangeLog | 6 ++++++
  8. NEWS | 4 ++++
  9. doc/info-stnd.texi | 34 +++++++++++++++++-----------------
  10. info/filesys.c | 1 +
  11. install-info/install-info.c | 29 +++++++++++++++++++++++++----
  12. 5 files changed, 53 insertions(+), 21 deletions(-)
  13. 2009-03-14 Karl Berry <karl@gnu.org>
  14. * info/filesys.c (compress_suffixes): add .xz/unxz.
  15. * info/filesys.h (DEFAULT_INFOPATH): include PATH by default.
  16. diff --git a/doc/info-stnd.texi b/doc/info-stnd.texi
  17. index 2bd67f3..c730cff 100644
  18. --- a/doc/info-stnd.texi
  19. +++ b/doc/info-stnd.texi
  20. @@ -202,21 +202,21 @@ directory.
  21. @cindex Info files, compressed
  22. In every directory Info tries, if @var{filename} is not found, Info
  23. looks for it with a number of known extensions of Info files@footnote{
  24. -@file{.info}, @file{-info}, @file{/index}, and @file{.inf}.}. For every
  25. -known extension, Info looks for a compressed file, if a regular file
  26. -isn't found. Info supports files compressed with @code{gzip},
  27. -@code{bzip2}, @code{compress} and @code{yabba} programs; it calls
  28. -@code{gunzip}, @code{bunzip2}, @code{uncompress} and @code{unyabba},
  29. -accordingly, to decompress such files. Compressed Info files are
  30. -assumed to have @file{.z}, @file{.gz}, @file{.bz2}, @file{.Z}, or
  31. -@file{.Y} extensions, possibly in addition to one of the known Info
  32. -files extensions@footnote{The MS-DOS version allows for the Info
  33. -extension, such as @code{.inf}, and the short compressed file
  34. -extensions, such as @file{.z} and @file{.gz}, to be merged into a single
  35. -extension, since DOS doesn't allow more than a single dot in the
  36. -basename of a file. Thus, on MS-DOS, if Info looks for @file{bison},
  37. -file names like @file{bison.igz} and @file{bison.inz} will be found and
  38. -decompressed by @code{gunzip}.}.
  39. +@file{.info}, @file{-info}, @file{/index}, and @file{.inf}.}. For
  40. +every known extension, Info looks for a compressed file, if a regular
  41. +file isn't found. Info supports files compressed with @code{gzip},
  42. +@code{xz}, @code{bzip2}, @code{lzma}, @code{compress} and @code{yabba}
  43. +programs, assumed to have @file{.z}, @file{.gz}, @file{.xz},
  44. +@file{.bz2}, @file{.lzma}, @file{.Z}, or @file{.Y} extensions,
  45. +possibly after one of the known Info files extensions.
  46. +
  47. +On MS-DOS, Info allows for the Info extension, such as @code{.inf},
  48. +and the short compressed file extensions, such as @file{.z} and
  49. +@file{.gz}, to be merged into a single extension, since DOS doesn't
  50. +allow more than a single dot in the basename of a file. Thus, on
  51. +MS-DOS, if Info looks for @file{bison}, file names like
  52. +@file{bison.igz} and @file{bison.inz} will be found and decompressed
  53. +by @code{gunzip}.
  54. @item --help
  55. @itemx -h
  56. diff --git a/info/filesys.c b/info/filesys.c
  57. index fdd18a8..5e795bc 100644
  58. --- a/info/filesys.c
  59. +++ b/info/filesys.c
  60. @@ -55,6 +55,7 @@ static char *info_suffixes[] = {
  61. static COMPRESSION_ALIST compress_suffixes[] = {
  62. { ".gz", "gunzip" },
  63. + { ".xz", "unxz" },
  64. { ".bz2", "bunzip2" },
  65. { ".z", "gunzip" },
  66. { ".lzma", "unlzma" },
  67. diff --git a/install-info/install-info.c b/install-info/install-info.c
  68. index 24669b3..0f18ca4 100644
  69. --- a/install-info/install-info.c
  70. +++ b/install-info/install-info.c
  71. @@ -400,6 +400,11 @@ strip_info_suffix (char *fname)
  72. len -= 3;
  73. ret[len] = 0;
  74. }
  75. + else if (len > 3 && FILENAME_CMP (ret + len - 3, ".xz") == 0)
  76. + {
  77. + len -= 3;
  78. + ret[len] = 0;
  79. + }
  80. else if (len > 4 && FILENAME_CMP (ret + len - 4, ".bz2") == 0)
  81. {
  82. len -= 4;
  83. @@ -659,6 +664,12 @@ open_possibly_compressed_file (char *filename,
  84. {
  85. *opened_filename = concat (filename, ".gz", "");
  86. f = fopen (*opened_filename, FOPEN_RBIN);
  87. + }
  88. + if (!f)
  89. + {
  90. + *opened_filename = concat (filename, ".xz", "");
  91. + f = fopen (*opened_filename, FOPEN_RBIN);
  92. + }
  93. if (!f)
  94. {
  95. free (*opened_filename);
  96. @@ -702,7 +712,6 @@ open_possibly_compressed_file (char *filename,
  97. else
  98. pfatal_with_name (filename);
  99. }
  100. - }
  101. /* Read first few bytes of file rather than relying on the filename.
  102. If the file is shorter than this it can't be usable anyway. */
  103. @@ -727,6 +736,15 @@ open_possibly_compressed_file (char *filename,
  104. #else
  105. *compression_program = "gzip";
  106. #endif
  107. +
  108. + else if (data[0] == '\xFD' && data[1] == '7' && data[2] == 'z'
  109. + && data[3] == 'X' && data[4] == 'Z' && data[5] == 0)
  110. +#ifndef STRIP_DOT_EXE
  111. + *compression_program = "xz.exe";
  112. +#else
  113. + *compression_program = "xz";
  114. +#endif
  115. +
  116. else if (data[0] == 'B' && data[1] == 'Z' && data[2] == 'h')
  117. #ifndef STRIP_DOT_EXE
  118. *compression_program = "bzip2.exe";
  119. --
  120. 1.7.4.rc2