bug-texinfo
[Top][All Lists]
Advanced

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

[PATCH] * install-info/install-info.c: Recognize .zst file extension fro


From: Sam James
Subject: [PATCH] * install-info/install-info.c: Recognize .zst file extension from the zstd compression tool.
Date: Wed, 7 Sep 2022 04:50:28 +0100

* info/filesys.c: Ditto.
---
 ChangeLog                   |  7 +++++++
 info/filesys.c              |  1 +
 install-info/install-info.c | 11 +++++++++++
 3 files changed, 19 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 9cc73e4e3a..88369eae7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-09-07  Sam James  <sam@gentoo.org>
+
+       * install-info/install-info.c: Recognize .zst file
+       extension from the zstd compression tool.
+
+       * info/filesys.c: Ditto.
+
 2022-09-05  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/texinfo.tex (\cartouche): Use \vtop instead of \vbox
diff --git a/info/filesys.c b/info/filesys.c
index 5f27f58b6b..47060e002e 100644
--- a/info/filesys.c
+++ b/info/filesys.c
@@ -67,6 +67,7 @@ static COMPRESSION_ALIST compress_suffixes[] = {
   { ".z", "gunzip" },
   { ".lzma", "unlzma" },
   { ".Z", "uncompress" },
+  { ".zst", "unzstd --rm -q" },
   { ".Y", "unyabba" },
 #ifdef __MSDOS__
   { "gz", "gunzip" },
diff --git a/install-info/install-info.c b/install-info/install-info.c
index 263875504f..69449386cd 100644
--- a/install-info/install-info.c
+++ b/install-info/install-info.c
@@ -388,6 +388,11 @@ strip_info_suffix (char *fname)
       len -= 4;
       ret[len] = 0;
     }
+  else if (len > 4 && FILENAME_CMP (ret + len - 4, ".zst") == 0)
+    {
+      len -= 4;
+      ret[len] = 0;
+    }
   else if (len > 3 && FILENAME_CMP (ret + len - 3, ".lz") == 0)
     {
       len -= 3;
@@ -670,6 +675,12 @@ open_possibly_compressed_file (char *filename,
       *opened_filename = concat (filename, ".bz2", "");
       f = fopen (*opened_filename, FOPEN_RBIN);
     }
+  if (!f)
+    {
+      free (*opened_filename);
+      *opened_filename = concat (filename, ".zst", "");
+      f = fopen (*opened_filename, FOPEN_RBIN);
+    }
   if (!f)
     {
       free (*opened_filename);
-- 
2.37.3




reply via email to

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