bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Please, add lzip support to info and install-info


From: Antonio Diaz Diaz
Subject: [PATCH] Please, add lzip support to info and install-info
Date: Fri, 22 Feb 2013 19:08:02 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

The attached patch adds support for lzip-compressed files (.lz) to info and install-info.

The patch is pretty trivial. Basically I copied the relevant blocks of code and documentation were gzip appears and then did the equivalent to "s/gz/lz/".

Please, consider applying it.


Thanks and regards,
Antonio.
diff -urdN texinfo-5.0/ChangeLog texinfo-5.0.new/ChangeLog
--- texinfo-5.0/ChangeLog       2013-02-17 00:53:48.000000000 +0100
+++ texinfo-5.0.new/ChangeLog   2013-02-22 16:10:52.000000000 +0100
@@ -1,3 +1,9 @@
+2013-02-22  Antonio Diaz Diaz  <address@hidden>
+
+       * info/filesys.c (compress_suffixes): Add .lz/lzip.
+       * install-info/install-info.c (open_possibly_compressed_file):
+       Add lzip support.
+
 2013-02-16  Karl Berry  <address@hidden>
 
        * Version 5.0.
diff -urdN texinfo-5.0/doc/info-stnd.texi texinfo-5.0.new/doc/info-stnd.texi
--- texinfo-5.0/doc/info-stnd.texi      2013-01-20 19:06:37.000000000 +0100
+++ texinfo-5.0.new/doc/info-stnd.texi  2013-02-22 14:21:43.000000000 +0100
@@ -217,10 +217,11 @@
 @file{.info}, @file{-info}, @file{/index}, and @file{.inf}.  For every
 known extension, Info looks for a compressed file, if a regular file
 isn't found.  Info supports files compressed with @code{gzip},
address@hidden, @code{bzip2}, @code{lzma}, @code{compress} and @code{yabba}
-programs, assumed to have @file{.z}, @file{.gz}, @file{.xz},
address@hidden, @file{.lzma}, @file{.Z}, or @file{.Y} extensions,
-possibly after one of the known Info files extensions.
address@hidden, @code{bzip2}, @code{lzip}, @code{lzma}, @code{compress} and
address@hidden programs, assumed to have @file{.z}, @file{.gz},
address@hidden, @file{.bz2}, @file{.lz}, @file{.lzma}, @file{.Z}, or
address@hidden extensions, possibly after one of the known Info files
+extensions.
 
 On MS-DOS, Info allows for the Info extension, such as @code{.inf},
 and the short compressed file extensions, such as @file{.z} and
diff -urdN texinfo-5.0/doc/texinfo.txi texinfo-5.0.new/doc/texinfo.txi
--- texinfo-5.0/doc/texinfo.txi 2013-02-17 01:19:12.000000000 +0100
+++ texinfo-5.0.new/doc/texinfo.txi     2013-02-22 14:21:43.000000000 +0100
@@ -19159,6 +19159,7 @@
 @cindex Compressed dir files, reading
 @cindex XZ-compressed dir files, reading
 @cindex Bzipped dir files, reading
address@hidden Lzip-compressed dir files, reading
 @cindex LZMA-compressed dir files, reading
 @cindex Dir files, compressed
 If any input file is compressed with @code{gzip} (@pxref{Top,,, gzip,
@@ -19167,8 +19168,8 @@
 automatically leaves it compressed after writing any changes.  If
 @var{dir-file} itself does not exist, @code{install-info} tries to
 open @address@hidden, @address@hidden,
address@hidden@var{dir-file}.bz2}, and @address@hidden, in that
-order.
address@hidden@var{dir-file}.bz2}, @address@hidden, and
address@hidden@var{dir-file}.lzma}, in that order.
 
 Options:
 
diff -urdN texinfo-5.0/info/filesys.c texinfo-5.0.new/info/filesys.c
--- texinfo-5.0/info/filesys.c  2013-02-13 23:50:16.000000000 +0100
+++ texinfo-5.0.new/info/filesys.c      2013-02-22 15:58:43.000000000 +0100
@@ -57,8 +57,10 @@
 static COMPRESSION_ALIST compress_suffixes[] = {
 #if STRIP_DOT_EXE
   { ".gz", "gunzip" },
+  { ".lz", "lunzip" },
 #else
   { ".gz", "gzip -d" },
+  { ".lz", "lzip -d" },
 #endif
   { ".xz", "unxz" },
   { ".bz2", "bunzip2" },
diff -urdN texinfo-5.0/install-info/install-info.c 
texinfo-5.0.new/install-info/install-info.c
--- texinfo-5.0/install-info/install-info.c     2013-01-07 00:18:56.000000000 
+0100
+++ texinfo-5.0.new/install-info/install-info.c 2013-02-22 14:21:43.000000000 
+0100
@@ -425,6 +425,11 @@
       len -= 4;
       ret[len] = 0;
     }
+  else if (len > 3 && FILENAME_CMP (ret + len - 3, ".lz") == 0)
+    {
+      len -= 3;
+      ret[len] = 0;
+    }
   else if (len > 5 && FILENAME_CMP (ret + len - 5, ".lzma") == 0)
    {
       len -= 5;
@@ -701,6 +706,12 @@
     }
   if (!f)
     {
+      free (*opened_filename);
+      *opened_filename = concat (filename, ".lz", "");
+      f = fopen (*opened_filename, FOPEN_RBIN);
+    }
+  if (!f)
+    {
      free (*opened_filename);
      *opened_filename = concat (filename, ".lzma", "");
      f = fopen (*opened_filename, FOPEN_RBIN);
@@ -782,6 +793,14 @@
     *compression_program = "bzip";
 #endif
 
+  else if (data[0] == 0x4C && data[1] == 0x5A && data[2] == 0x49
+           && data[3] == 0x50 && data[4] == 1)         /* "LZIP" */
+#ifndef STRIP_DOT_EXE
+    *compression_program = "lzip.exe";
+#else
+    *compression_program = "lzip";
+#endif
+
     /* We (try to) match against old lzma format (which lacks proper
        header, two first matches), as well as the new format (last match).  */
   else if ((data[9] == 0x00 && data[10] == 0x00 && data[11] == 0x00

reply via email to

[Prev in Thread] Current Thread [Next in Thread]