From 3176f992c55b8d788c4633809aaf9447376a5a12 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 8 Oct 2022 21:28:15 +0300 Subject: xz: Add .lz (lzip) decompression support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/xz/suffix.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/xz/suffix.c') 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]; -- cgit v1.2.3