summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-03-27 10:28:03 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-03-27 10:28:03 (GMT)
commit2d4fed5ed2a8e0231f98d79699d28af0142d0099 (patch)
treebd552cc1b30993a7f0e3a329a5221abd2cd69466 /programs
parent00c3208c7a352f4136300b257b418c55f07450c8 (diff)
parentce71b073b5a4a9e2bdd78855f50ddc146baac1c5 (diff)
downloadlz4-2d4fed5ed2a8e0231f98d79699d28af0142d0099.zip
lz4-2d4fed5ed2a8e0231f98d79699d28af0142d0099.tar.gz
lz4-2d4fed5ed2a8e0231f98d79699d28af0142d0099.tar.bz2
Merge pull request #65 from Cyan4973/dev
Dev
Diffstat (limited to 'programs')
-rw-r--r--programs/Makefile22
-rw-r--r--programs/lz4.130
-rw-r--r--programs/lz4cli.c24
3 files changed, 47 insertions, 29 deletions
diff --git a/programs/Makefile b/programs/Makefile
index 6aade89..a324148 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -61,9 +61,13 @@ endif
TRAVIS_TARGET=$(LZ4_TRAVIS_CI_ENV)
-default: lz4 lz4c
+default: lz4
-all: lz4 lz4c lz4c32 fullbench fullbench32 fuzzer fuzzer32 frametest frametest32 datagen
+m32: lz4c32 fullbench32 fuzzer32 frametest32
+
+bins: lz4 lz4c fullbench fuzzer frametest datagen
+
+all: bins m32
lz4: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c $(LZ4DIR)/lz4frame.c $(LZ4DIR)/xxhash.c bench.c lz4io.c lz4cli.c
$(CC) $(FLAGS) $^ -o $@$(EXT)
@@ -144,16 +148,16 @@ test-travis: $(TRAVIS_TARGET)
test-lz4-sparse: lz4 datagen
@echo ---- test sparse file support ----
- ./datagen -g50M -P100 | ./lz4 -B4D | ./lz4 -dv --sparse-support > tmpB4
- ./datagen -g50M -P100 | ./lz4 -B5D | ./lz4 -dv --sparse-support > tmpB5
- ./datagen -g50M -P100 | ./lz4 -B6D | ./lz4 -dv --sparse-support > tmpB6
- ./datagen -g50M -P100 | ./lz4 -B7D | ./lz4 -dv --sparse-support > tmpB7
+ ./datagen -g50M -P100 | ./lz4 -B4D | ./lz4 -dv --sparse > tmpB4
+ ./datagen -g50M -P100 | ./lz4 -B5D | ./lz4 -dv --sparse > tmpB5
+ ./datagen -g50M -P100 | ./lz4 -B6D | ./lz4 -dv --sparse > tmpB6
+ ./datagen -g50M -P100 | ./lz4 -B7D | ./lz4 -dv --sparse > tmpB7
ls -ls tmp*
./datagen -g50M -P100 | diff -s - tmpB4
./datagen -g50M -P100 | diff -s - tmpB5
./datagen -g50M -P100 | diff -s - tmpB6
./datagen -g50M -P100 | diff -s - tmpB7
- ./datagen -s1 -g1200007 -P100 | ./lz4 | ./lz4 -dv --sparse-support > tmpOdd # Odd size file (to not finish on an exact nb of blocks)
+ ./datagen -s1 -g1200007 -P100 | ./lz4 | ./lz4 -dv --sparse > tmpOdd # Odd size file (to not finish on an exact nb of blocks)
./datagen -s1 -g1200007 -P100 | diff -s - tmpOdd
ls -ls tmpOdd
@rm tmp*
@@ -162,7 +166,7 @@ test-lz4-contentSize: lz4 datagen
@echo ---- test original size support ----
./datagen -g15M > tmp
./lz4 -v tmp | ./lz4 -t
- ./lz4 -v --frame-content-size tmp | ./lz4 -d > tmp2
+ ./lz4 -v --content-size tmp | ./lz4 -d > tmp2
diff -s tmp tmp2
@rm tmp*
@@ -237,8 +241,8 @@ test-mem: lz4 datagen fuzzer frametest
valgrind --leak-check=yes ./lz4 -9 -BD -f tmp $(VOID)
./datagen -g16MB > tmp
valgrind --leak-check=yes ./lz4 -9 -B5D -f tmp tmp2
- ./datagen -g256MB > tmp
valgrind --leak-check=yes ./lz4 -t tmp2
+ ./datagen -g256MB > tmp
valgrind --leak-check=yes ./lz4 -B4D -f -vq tmp $(VOID)
rm tmp*
valgrind --leak-check=yes ./fuzzer -i64 -t1
diff --git a/programs/lz4.1 b/programs/lz4.1
index 8bab7a3..1225832 100644
--- a/programs/lz4.1
+++ b/programs/lz4.1
@@ -59,12 +59,19 @@ files as is.
.B lz4
will decompress such files as if they were a single
.B .lz4
-file.
+file. For example:
+ lz4 file1 > foo.lz4
+ lz4 file2 >> foo.lz4
+ then
+ lz4cat foo.lz4
+ is equivalent to :
+ cat file1 file2
+
.PP
.SH OPTIONS
.
-.SS "Short command concatenation"
+.SS "Short commands concatenation"
In some cases, some options can be expressed using short command
.B "-x"
or long command
@@ -75,10 +82,11 @@ is equivalent to
.B "-dc" .
Long commands cannot be concatenated.
They must be clearly separated by a space.
+.SS "Multiple commands"
+When multiple contradictory commands are issued on a same command line,
+only the latest one will be applied.
.
.SS "Operation mode"
-If multiple operation mode options are given,
-the last one takes effect.
.TP
.BR \-z ", " \-\-compress
Compress.
@@ -112,7 +120,7 @@ Test the integrity of compressed
.B .lz4
files.
The decompressed data is discarded.
-No files are created or removed.
+No files are created nor removed.
.
.SS "Operation modifiers"
.TP
@@ -123,7 +131,7 @@ No files are created or removed.
high compression
.TP
-.BR \-f ", " --force
+.BR \-f ", " --[no-]force
This option has several effects:
.RS
.IP \(bu 3
@@ -168,13 +176,15 @@ with the resulting compressed file named
.B \-BD
block dependency (improve compression ratio)
.TP
-.B \--no-frame-crc
+.B \--[no-]frame-crc
disable stream checksum (default:enabled)
.TP
-.B \--frame-content-size
- compressed frame includes original size (default:not present)
+.B \--[no-]content-size
+ compressed file includes original size (default:not present)
+ Note : this option can only be activated when the original size can be determined,
+hence for a file. It won't work with unknown source size, such as stdin pipe.
.TP
-.B \--sparse-support
+.B \--[no-]sparse
enable sparse file (default:disabled)(experimental)
.TP
.B \-l
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 6c57864..da5da71 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -173,9 +173,9 @@ static int usage_advanced(void)
DISPLAY( " -B# : Block size [4-7](default : 7)\n");
DISPLAY( " -BD : Block dependency (improve compression ratio)\n");
/* DISPLAY( " -BX : enable block checksum (default:disabled)\n"); *//* Option currently inactive */
- DISPLAY( "--no-frame-crc : disable stream checksum (default:enabled)\n");
- DISPLAY( "--frame-content-size : compressed frame includes original size (default:not present)\n");
- DISPLAY( "--sparse-support : enable sparse file (default:disabled)(experimental)\n");
+ DISPLAY( "--no-frame-crc : disable stream checksum (default:enabled)\n");
+ DISPLAY( "--content-size : compressed frame includes original size (default:not present)\n");
+ DISPLAY( "--sparse : enable sparse file (default:disabled)(experimental)\n");
DISPLAY( "Benchmark arguments :\n");
DISPLAY( " -b : benchmark file(s)\n");
DISPLAY( " -i# : iteration loops [1-9](default : 3), benchmark mode only\n");
@@ -293,19 +293,23 @@ int main(int argc, char** argv)
/* long commands (--long-word) */
if (!strcmp(argument, "--compress")) { forceCompress = 1; continue; }
- if (!strcmp(argument, "--decompress")) { decode = 1; continue; }
- if (!strcmp(argument, "--uncompress")) { decode = 1; continue; }
+ if ((!strcmp(argument, "--decompress"))
+ || (!strcmp(argument, "--uncompress"))) { decode = 1; continue; }
if (!strcmp(argument, "--test")) { decode = 1; LZ4IO_setOverwrite(1); output_filename=nulmark; continue; }
if (!strcmp(argument, "--force")) { LZ4IO_setOverwrite(1); continue; }
- if (!strcmp(argument, "--stdout")) { forceStdout=1; output_filename=stdoutmark; displayLevel=1; continue; }
- if (!strcmp(argument, "--to-stdout")) { forceStdout=1; output_filename=stdoutmark; displayLevel=1; continue; }
+ if (!strcmp(argument, "--no-force")) { LZ4IO_setOverwrite(0); continue; }
+ if ((!strcmp(argument, "--stdout"))
+ || (!strcmp(argument, "--to-stdout"))) { forceStdout=1; output_filename=stdoutmark; displayLevel=1; continue; }
+ if (!strcmp(argument, "--frame-crc")) { LZ4IO_setStreamChecksumMode(1); continue; }
if (!strcmp(argument, "--no-frame-crc")) { LZ4IO_setStreamChecksumMode(0); continue; }
- if (!strcmp(argument, "--frame-content-size")) { LZ4IO_setContentSize(1); continue; }
- if (!strcmp(argument, "--sparse-support")) { LZ4IO_setSparseFile(1); continue; }
+ if (!strcmp(argument, "--content-size")) { LZ4IO_setContentSize(1); continue; }
+ if (!strcmp(argument, "--no-content-size")) { LZ4IO_setContentSize(0); continue; }
+ if (!strcmp(argument, "--sparse")) { LZ4IO_setSparseFile(1); continue; }
+ if (!strcmp(argument, "--no-sparse")) { LZ4IO_setSparseFile(0); continue; }
if (!strcmp(argument, "--verbose")) { displayLevel=4; continue; }
if (!strcmp(argument, "--quiet")) { if (displayLevel) displayLevel--; continue; }
if (!strcmp(argument, "--version")) { DISPLAY(WELCOME_MESSAGE); return 0; }
- if (!strcmp(argument, "--keep")) { continue; } /* keep source file (default anyway, so useless) (for xz/lzma compatibility) */
+ if (!strcmp(argument, "--keep")) { continue; } /* keep source file (default anyway; just for xz/lzma compatibility) */
/* Short commands (note : aggregated short commands are allowed) */
if (argument[0]=='-')