Add CLI Program Name Detection for LZ4
This commit is contained in:
parent
5705d9f25a
commit
d0519d4b0c
@ -61,6 +61,8 @@
|
||||
#define ZSTD_UNLZMA "unlzma"
|
||||
#define ZSTD_XZ "xz"
|
||||
#define ZSTD_UNXZ "unxz"
|
||||
#define ZSTD_LZ4 "lz4"
|
||||
#define ZSTD_UNLZ4 "unlz4"
|
||||
|
||||
#define KB *(1 <<10)
|
||||
#define MB *(1 <<20)
|
||||
@ -425,6 +427,8 @@ int main(int argCount, const char* argv[])
|
||||
if (exeNameMatch(programName, ZSTD_UNLZMA)) { operation=zom_decompress; FIO_setCompressionType(FIO_lzmaCompression); FIO_setRemoveSrcFile(1); } /* behave like unlzma */
|
||||
if (exeNameMatch(programName, ZSTD_XZ)) { suffix = XZ_EXTENSION; FIO_setCompressionType(FIO_xzCompression); FIO_setRemoveSrcFile(1); } /* behave like xz */
|
||||
if (exeNameMatch(programName, ZSTD_UNXZ)) { operation=zom_decompress; FIO_setCompressionType(FIO_xzCompression); FIO_setRemoveSrcFile(1); } /* behave like unxz */
|
||||
if (exeNameMatch(programName, ZSTD_LZ4)) { suffix = LZ4_EXTENSION; FIO_setCompressionType(FIO_lz4Compression); FIO_setRemoveSrcFile(1); } /* behave like xz */
|
||||
if (exeNameMatch(programName, ZSTD_UNLZ4)) { operation=zom_decompress; FIO_setCompressionType(FIO_lz4Compression); FIO_setRemoveSrcFile(1); } /* behave like unxz */
|
||||
memset(&compressionParams, 0, sizeof(compressionParams));
|
||||
|
||||
/* command switches */
|
||||
|
@ -375,16 +375,27 @@ test-pool: poolTests
|
||||
$(QEMU_SYS) ./poolTests
|
||||
|
||||
test-lz4: ZSTD = LD_LIBRARY_PATH=/usr/local/lib $(PRGDIR)/zstd
|
||||
test-lz4: ZSTD_LZ4 = LD_LIBRARY_PATH=/usr/local/lib ./lz4
|
||||
test-lz4: ZSTD_UNLZ4 = LD_LIBRARY_PATH=/usr/local/lib ./unlz4
|
||||
test-lz4: zstd decodecorpus
|
||||
ln -s $(PRGDIR)/zstd lz4
|
||||
ln -s $(PRGDIR)/zstd unlz4
|
||||
|
||||
./decodecorpus -ptmp
|
||||
# lz4 -> zstd
|
||||
lz4 < tmp | \
|
||||
$(ZSTD) -d | \
|
||||
cmp - tmp
|
||||
lz4 < tmp | \
|
||||
$(ZSTD_UNLZ4) | \
|
||||
cmp - tmp
|
||||
# zstd -> lz4
|
||||
$(ZSTD) --format=lz4 < tmp | \
|
||||
lz4 -d | \
|
||||
cmp - tmp
|
||||
$(ZSTD_LZ4) < tmp | \
|
||||
lz4 -d | \
|
||||
cmp - tmp
|
||||
# zstd -> zstd
|
||||
$(ZSTD) --format=lz4 < tmp | \
|
||||
$(ZSTD) -d | \
|
||||
@ -394,6 +405,6 @@ test-lz4: zstd decodecorpus
|
||||
$(ZSTD) -d | \
|
||||
cmp - tmp
|
||||
|
||||
rm tmp
|
||||
rm tmp lz4 unlz4
|
||||
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user