From f02adc79389732177dca6fa21a3e716249aa63dd Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sat, 21 Mar 2015 13:34:55 +0100 Subject: new long commands --- programs/lz4cli.c | 45 +++++++++++++++++++++------------------------ programs/lz4io.h | 8 ++++---- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/programs/lz4cli.c b/programs/lz4cli.c index 84bfa84..0f914b4 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -59,23 +59,20 @@ #include /* exit, calloc, free */ #include /* strcmp, strlen */ #include "bench.h" /* BMK_benchFile, BMK_SetNbIterations, BMK_SetBlocksize, BMK_SetPause */ -#include "lz4io.h" +#include "lz4io.h" /* LZ4IO_compressFilename, LZ4IO_decompressFilename, LZ4IO_compressMultipleFilenames */ /**************************** * OS-specific Includes *****************************/ #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) -# include /* _O_BINARY */ -# include /* _setmode, _isatty */ +# include /* _isatty */ # ifdef __MINGW32__ int _fileno(FILE *stream); /* MINGW somehow forgets to include this prototype into */ # endif -# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY) # define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) #else # include /* isatty */ -# define SET_BINARY_MODE(file) # define IS_CONSOLE(stdStream) isatty(fileno(stdStream)) #endif @@ -90,8 +87,8 @@ #define AUTHOR "Yann Collet" #define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_VERSION, AUTHOR, __DATE__ #define LZ4_EXTENSION ".lz4" -#define LZ4_CAT "lz4cat" -#define UN_LZ4 "unlz4" +#define LZ4CAT "lz4cat" +#define UNLZ4 "unlz4" #define KB *(1U<<10) #define MB *(1U<<20) @@ -140,7 +137,7 @@ static char* programName; int LZ4IO_compressFilename_Legacy(const char* input_filename, const char* output_filename, int compressionlevel); /* hidden function */ -/**************************** +/***************************** * Functions *****************************/ static int usage(void) @@ -176,8 +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( " -Sx : disable stream checksum (default:enabled)\n"); - DISPLAY( " -X : enable sparse file (default:disabled)(experimental)\n"); + 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( "Benchmark arguments :\n"); DISPLAY( " -b : benchmark file(s)\n"); DISPLAY( " -i# : iteration loops [1-9](default : 3), benchmark mode only\n"); @@ -269,7 +267,7 @@ int main(int argc, char** argv) main_pause=0, multiple_inputs=0; const char* input_filename=0; - char* output_filename=0; + const char* output_filename=0; char* dynNameSpace=0; const char** inFileNames = NULL; unsigned ifnIdx=0; @@ -283,8 +281,8 @@ int main(int argc, char** argv) blockSize = LZ4IO_setBlockSizeID(LZ4_BLOCKSIZEID_DEFAULT); /* lz4cat predefined behavior */ - if (!strcmp(programName, LZ4_CAT)) { decode=1; forceStdout=1; output_filename=stdoutmark; displayLevel=1; } - if (!strcmp(programName, UN_LZ4)) { decode=1; } + if (!strcmp(programName, LZ4CAT)) { decode=1; forceStdout=1; output_filename=stdoutmark; displayLevel=1; } + if (!strcmp(programName, UNLZ4)) { decode=1; } /* command switches */ for(i=1; i4) - while ((outl >= inl-4) && (input_filename[outl] == extension[outl-inl+4])) output_filename[outl--]=0; + while ((outl >= inl-4) && (input_filename[outl] == extension[outl-inl+4])) dynNameSpace[outl--]=0; if (outl != inl-5) { DISPLAYLEVEL(1, "Cannot determine an output filename\n"); badusage(); } + output_filename = dynNameSpace; DISPLAYLEVEL(2, "Decoding file %s \n", output_filename); } } diff --git a/programs/lz4io.h b/programs/lz4io.h index 2441174..b4d75f7 100644 --- a/programs/lz4io.h +++ b/programs/lz4io.h @@ -35,12 +35,12 @@ /* Special input/output values */ /* ************************************************** */ #define NULL_OUTPUT "null" -static char stdinmark[] = "stdin"; -static char stdoutmark[] = "stdout"; +static char const stdinmark[] = "stdin"; +static char const stdoutmark[] = "stdout"; #ifdef _WIN32 -static char nulmark[] = "nul"; +static char const nulmark[] = "nul"; #else -static char nulmark[] = "/dev/null"; +static char const nulmark[] = "/dev/null"; #endif -- cgit v0.12