aboutsummaryrefslogtreecommitdiff
path: root/src/xz/suffix.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-10-08 21:28:15 +0300
committerLasse Collin <lasse.collin@tukaani.org>2022-11-09 14:28:41 +0200
commit3176f992c55b8d788c4633809aaf9447376a5a12 (patch)
treea08fb57cecafafb4d41bd1b2df3007d61aff513d /src/xz/suffix.c
parentliblzma: Add .lz support to lzma_auto_decoder(). (diff)
downloadxz-3176f992c55b8d788c4633809aaf9447376a5a12.tar.xz
xz: Add .lz (lzip) decompression support.
If configured with --disable-lzip-decoder then --long-help will still list `lzip' in --format but I left it like that since due to translations it would be messy to have two help strings. Features are disabled only in special situations so wrong help in such a situation shouldn't matter much. Thanks to Michał Górny for the original patch.
Diffstat (limited to 'src/xz/suffix.c')
-rw-r--r--src/xz/suffix.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/xz/suffix.c b/src/xz/suffix.c
index 9d4fcd13..55e4ee2f 100644
--- a/src/xz/suffix.c
+++ b/src/xz/suffix.c
@@ -119,7 +119,10 @@ uncompressed_name(const char *src_name, const size_t src_len)
#ifdef __DJGPP__
{ ".lzm", "" },
#endif
- { ".tlz", ".tar" },
+ { ".tlz", ".tar" }, // Both .tar.lzma and .tar.lz
+#ifdef HAVE_LZIP_DECODER
+ { ".lz", "" },
+#endif
// { ".gz", "" },
// { ".tgz", ".tar" },
};
@@ -208,6 +211,15 @@ compressed_name(const char *src_name, size_t src_len)
#endif
".tlz",
NULL
+#ifdef HAVE_LZIP_DECODER
+ // This is needed to keep the table indexing in sync with
+ // enum format_type from coder.h.
+ }, {
+/*
+ ".lz",
+*/
+ NULL
+#endif
/*
}, {
".gz",
@@ -221,8 +233,11 @@ compressed_name(const char *src_name, size_t src_len)
}
};
- // args.c ensures this.
+ // args.c ensures these.
assert(opt_format != FORMAT_AUTO);
+#ifdef HAVE_LZIP_DECODER
+ assert(opt_format != FORMAT_LZIP);
+#endif
const size_t format = opt_format - 1;
const char *const *suffixes = all_suffixes[format];
@@ -299,8 +314,11 @@ compressed_name(const char *src_name, size_t src_len)
// xz foo.tar -> foo.txz
// xz -F lzma foo.tar -> foo.tlz
static const char *const tar_suffixes[] = {
- ".txz",
- ".tlz",
+ ".txz", // .tar.xz
+ ".tlz", // .tar.lzma
+/*
+ ".tlz", // .tar.lz
+*/
// ".tgz",
};
suffix = tar_suffixes[format];