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_UNLZMA "unlzma"
|
||||||
#define ZSTD_XZ "xz"
|
#define ZSTD_XZ "xz"
|
||||||
#define ZSTD_UNXZ "unxz"
|
#define ZSTD_UNXZ "unxz"
|
||||||
|
#define ZSTD_LZ4 "lz4"
|
||||||
|
#define ZSTD_UNLZ4 "unlz4"
|
||||||
|
|
||||||
#define KB *(1 <<10)
|
#define KB *(1 <<10)
|
||||||
#define MB *(1 <<20)
|
#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_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_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_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));
|
memset(&compressionParams, 0, sizeof(compressionParams));
|
||||||
|
|
||||||
/* command switches */
|
/* command switches */
|
||||||
|
@ -375,16 +375,27 @@ test-pool: poolTests
|
|||||||
$(QEMU_SYS) ./poolTests
|
$(QEMU_SYS) ./poolTests
|
||||||
|
|
||||||
test-lz4: ZSTD = LD_LIBRARY_PATH=/usr/local/lib $(PRGDIR)/zstd
|
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
|
test-lz4: zstd decodecorpus
|
||||||
|
ln -s $(PRGDIR)/zstd lz4
|
||||||
|
ln -s $(PRGDIR)/zstd unlz4
|
||||||
|
|
||||||
./decodecorpus -ptmp
|
./decodecorpus -ptmp
|
||||||
# lz4 -> zstd
|
# lz4 -> zstd
|
||||||
lz4 < tmp | \
|
lz4 < tmp | \
|
||||||
$(ZSTD) -d | \
|
$(ZSTD) -d | \
|
||||||
cmp - tmp
|
cmp - tmp
|
||||||
|
lz4 < tmp | \
|
||||||
|
$(ZSTD_UNLZ4) | \
|
||||||
|
cmp - tmp
|
||||||
# zstd -> lz4
|
# zstd -> lz4
|
||||||
$(ZSTD) --format=lz4 < tmp | \
|
$(ZSTD) --format=lz4 < tmp | \
|
||||||
lz4 -d | \
|
lz4 -d | \
|
||||||
cmp - tmp
|
cmp - tmp
|
||||||
|
$(ZSTD_LZ4) < tmp | \
|
||||||
|
lz4 -d | \
|
||||||
|
cmp - tmp
|
||||||
# zstd -> zstd
|
# zstd -> zstd
|
||||||
$(ZSTD) --format=lz4 < tmp | \
|
$(ZSTD) --format=lz4 < tmp | \
|
||||||
$(ZSTD) -d | \
|
$(ZSTD) -d | \
|
||||||
@ -394,6 +405,6 @@ test-lz4: zstd decodecorpus
|
|||||||
$(ZSTD) -d | \
|
$(ZSTD) -d | \
|
||||||
cmp - tmp
|
cmp - tmp
|
||||||
|
|
||||||
rm tmp
|
rm tmp lz4 unlz4
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user