From 6b923d57a6af892d2d8da409fb07f256504c074c Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 23 Mar 2015 19:59:41 +0100 Subject: [PATCH] Updated long commands, with reverse "--no-" variants --- programs/lz4.1 | 18 ++++++++++++++---- programs/lz4cli.c | 24 ++++++++++++++---------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/programs/lz4.1 b/programs/lz4.1 index 8bab7a3..85bfb06 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,6 +82,9 @@ 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, @@ -171,10 +181,10 @@ with the resulting compressed file named .B \--no-frame-crc disable stream checksum (default:enabled) .TP -.B \--frame-content-size +.B \--content-size compressed frame includes original size (default:not present) .TP -.B \--sparse-support +.B \--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]=='-') -- 2.7.4