summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-03-24 18:00:40 (GMT)
committerYann Collet <cyan@fb.com>2017-03-24 18:00:40 (GMT)
commit8f8fc52fcfdb91186b7f19646699505232e25770 (patch)
tree286c472d56b7a9895e83e8189f48082a1029c4d6
parent68044acfec4a13284ca7c38744a70288a46609aa (diff)
parent0863931a1c65c5f3caf7cf83c8780ac8e85d091e (diff)
downloadlz4-8f8fc52fcfdb91186b7f19646699505232e25770.zip
lz4-8f8fc52fcfdb91186b7f19646699505232e25770.tar.gz
lz4-8f8fc52fcfdb91186b7f19646699505232e25770.tar.bz2
Merge branch 'dev' into optlz4opt
-rw-r--r--NEWS1
-rw-r--r--lib/lz4frame.h2
-rw-r--r--programs/lz4.1.md3
-rw-r--r--programs/lz4cli.c4
-rw-r--r--tests/Makefile8
5 files changed, 16 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 742217f..4fb8fdd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
v1.7.6
cli : fix : do not modify /dev/null permissions, reported by @Maokaman1
+cli : added GNU separator -- specifying that all following arguments are files
API : added LZ4_compress_HC_destSize(), by Oleg (@remittor)
API : fix : expose obsolete decoding functions, reported by Chen Yufei
build : dragonFlyBSD, OpenBSD, NetBSD supported
diff --git a/lib/lz4frame.h b/lib/lz4frame.h
index c1acba5..a0cf0ab 100644
--- a/lib/lz4frame.h
+++ b/lib/lz4frame.h
@@ -212,7 +212,7 @@ typedef struct {
LZ4FLIB_API unsigned LZ4F_getVersion(void);
/*! LZ4F_createCompressionContext() :
* The first thing to do is to create a compressionContext object, which will be used in all compression operations.
- * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version and an LZ4F_preferences_t structure.
+ * This is achieved using LZ4F_createCompressionContext(), which takes as argument a version.
* The version provided MUST be LZ4F_VERSION. It is intended to track potential version mismatch, notably when using DLL.
* The function will provide a pointer to a fully allocated LZ4F_cctx object.
* If @return != zero, there was an error during context creation.
diff --git a/programs/lz4.1.md b/programs/lz4.1.md
index 48f3152..6f42904 100644
--- a/programs/lz4.1.md
+++ b/programs/lz4.1.md
@@ -194,6 +194,9 @@ only the latest one will be applied.
* `--rm` :
Delete source files on successful compression or decompression
+* `--` :
+ Treat all subsequent arguments as files
+
### Benchmark mode
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 0578bde..7a75f55 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -271,6 +271,7 @@ int main(int argc, const char** argv)
forceStdout=0,
main_pause=0,
multiple_inputs=0,
+ all_arguments_are_files=0,
operationResult=0;
operationMode_e mode = om_auto;
const char* input_filename = NULL;
@@ -315,7 +316,7 @@ int main(int argc, const char** argv)
if(!argument) continue; /* Protection if argument empty */
/* Short commands (note : aggregated short commands are allowed) */
- if (argument[0]=='-') {
+ if (!all_arguments_are_files && argument[0]=='-') {
/* '-' means stdin/stdout */
if (argument[1]==0) {
if (!input_filename) input_filename=stdinmark;
@@ -325,6 +326,7 @@ int main(int argc, const char** argv)
/* long commands (--long-word) */
if (argument[1]=='-') {
+ if (!strcmp(argument, "--")) { all_arguments_are_files = 1; continue; }
if (!strcmp(argument, "--compress")) { mode = om_compress; continue; }
if ((!strcmp(argument, "--decompress"))
|| (!strcmp(argument, "--uncompress"))) { mode = om_decompress; continue; }
diff --git a/tests/Makefile b/tests/Makefile
index d68c700..bc22423 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -252,6 +252,14 @@ test-lz4-basic: lz4 datagen unlz4 lz4cat
$(DIFF) -q tmp tmp3
$(PRGDIR)/lz4cat < tmp > tmp2 # checks lz4cat works with stdin (#285)
$(DIFF) -q tmp tmp2
+ cp tmp ./-d
+ $(LZ4) --rm -- -d -d.lz4 # compresses ./d into ./-d.lz4
+ test -f ./-d.lz4
+ test ! -f ./-d
+ mv ./-d.lz4 ./-z
+ $(LZ4) -d --rm -- -z tmp4 # uncompresses ./-z into tmp4
+ test ! -f ./-z
+ $(DIFF) -q tmp tmp4
@$(RM) tmp*
test-lz4-hugefile: lz4 datagen