|
Rizin
unix-like reverse engineering framework and cli tools
|
#include "platform.h"#include "util.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include "bench.h"#include "lz4io.h"#include "lz4hc.h"#include "lz4.h"Go to the source code of this file.
Macros | |
| #define | COMPRESSOR_NAME "LZ4 command line interface" |
| #define | AUTHOR "Yann Collet" |
| #define | WELCOME_MESSAGE "*** %s %i-bits v%s, by %s ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_versionString(), AUTHOR |
| #define | LZ4_EXTENSION ".lz4" |
| #define | LZ4CAT "lz4cat" |
| #define | UNLZ4 "unlz4" |
| #define | LZ4_LEGACY "lz4c" |
| #define | KB *(1U<<10) |
| #define | MB *(1U<<20) |
| #define | GB *(1U<<30) |
| #define | LZ4_BLOCKSIZEID_DEFAULT 7 |
| #define | DISPLAYOUT(...) fprintf(stdout, __VA_ARGS__) |
| #define | DISPLAY(...) fprintf(stderr, __VA_ARGS__) |
| #define | DISPLAYLEVEL(l, ...) if (displayLevel>=l) { DISPLAY(__VA_ARGS__); } |
| #define | DEBUG 0 |
| #define | DEBUGOUTPUT(...) if (DEBUG) DISPLAY(__VA_ARGS__); |
| #define | EXM_THROW(error, ...) |
| #define | DEFAULT_COMPRESSOR LZ4IO_compressFilename |
| #define | DEFAULT_DECOMPRESSOR LZ4IO_decompressFilename |
Enumerations | |
| enum | operationMode_e { om_auto , om_compress , om_decompress , om_test , om_bench , om_list } |
Functions | |
| int | LZ4IO_compressFilename_Legacy (const char *input_filename, const char *output_filename, int compressionlevel, const LZ4IO_prefs_t *prefs) |
| int | LZ4IO_compressMultipleFilenames_Legacy (const char **inFileNamesTable, int ifntSize, const char *suffix, int compressionLevel, const LZ4IO_prefs_t *prefs) |
| static int | usage (const char *exeName) |
| static int | usage_advanced (const char *exeName) |
| static int | usage_longhelp (const char *exeName) |
| static int | badusage (const char *exeName) |
| static void | waitEnter (void) |
| static const char * | lastNameFromPath (const char *path) |
| static int | exeNameMatch (const char *exeName, const char *test) |
| static unsigned | readU32FromChar (const char **stringPtr) |
| static int | longCommandWArg (const char **stringPtr, const char *longCommand) |
| static operationMode_e | determineOpMode (const char *inputFilename) |
| int | main (int argc, const char **argv) |
Variables | |
| static int | g_lz4c_legacy_commands = 0 |
| static unsigned | displayLevel = 2 |
| #define DEFAULT_COMPRESSOR LZ4IO_compressFilename |
| #define DEFAULT_DECOMPRESSOR LZ4IO_decompressFilename |
| #define DISPLAYLEVEL | ( | l, | |
| ... | |||
| ) | if (displayLevel>=l) { DISPLAY(__VA_ARGS__); } |
| #define EXM_THROW | ( | error, | |
| ... | |||
| ) |
| enum operationMode_e |
Definition at line 228 of file lz4cli.c.
References DISPLAYLEVEL, displayLevel, test-lz4-list::exit, and usage().
Referenced by main().
|
static |
determineOpMode() : auto-determine operation mode, based on input filename extension
om_decompress if input filename has .lz4 extension and om_compress otherwise. Definition at line 301 of file lz4cli.c.
References LZ4_EXTENSION, om_compress, and om_decompress.
Referenced by main().
Definition at line 242 of file lz4cli.c.
Referenced by main().
longCommandWArg() : check if *stringPtr is the same as longCommand. If yes,
Definition at line 287 of file lz4cli.c.
Referenced by main().
| int LZ4IO_compressFilename_Legacy | ( | const char * | input_filename, |
| const char * | output_filename, | ||
| int | compressionlevel, | ||
| const LZ4IO_prefs_t * | prefs | ||
| ) |
Definition at line 399 of file lz4io.c.
References assert(), DISPLAYLEVEL, DISPLAYUPDATE, dst, EXM_THROW, benchmark::FILE, free(), int, LEGACY_BLOCKSIZE, LEGACY_MAGICNUMBER, long, LZ4_compress_HC(), LZ4_compressBound(), LZ4IO_LZ4_compress(), LZ4IO_openDstFile(), LZ4IO_openSrcFile(), LZ4IO_writeLE32(), MAGICNUMBER_SIZE, malloc(), NULL, src, srcSize, and stdoutmark.
Referenced by LZ4IO_compressMultipleFilenames_Legacy(), and main().
| int LZ4IO_compressMultipleFilenames_Legacy | ( | const char ** | inFileNamesTable, |
| int | ifntSize, | ||
| const char * | suffix, | ||
| int | compressionLevel, | ||
| const LZ4IO_prefs_t * | prefs | ||
| ) |
Definition at line 485 of file lz4io.c.
References compressionLevel, FNSPACE, free(), i, LZ4IO_compressFilename_Legacy(), malloc(), NULL, stdoutmark, and suffix.
Referenced by main().
Definition at line 310 of file lz4cli.c.
References _FILE_OFFSET_BITS, _POSIX_C_SOURCE, argv, assert(), B, badusage(), BMK_benchFiles(), BMK_setBenchSeparately(), BMK_setBlockSize(), BMK_setNbSeconds(), BMK_setNotificationLevel(), calloc(), test-lz4-speed::default, DEFAULT_COMPRESSOR, DEFAULT_DECOMPRESSOR, determineOpMode(), DISPLAY, DISPLAYLEVEL, displayLevel, DISPLAYOUT, exeNameMatch(), test-lz4-list::exit, free(), g_lz4c_legacy_commands, i, int, INT_MAX, IS_CONSOLE, lastNameFromPath(), longCommandWArg(), LZ4_BLOCKSIZEID_DEFAULT, LZ4_EXTENSION, LZ4_LEGACY, LZ4CAT, LZ4HC_CLEVEL_MAX, LZ4IO_blockIndependent, LZ4IO_blockLinked, LZ4IO_compressFilename_Legacy(), LZ4IO_compressMultipleFilenames(), LZ4IO_compressMultipleFilenames_Legacy(), LZ4IO_decompressMultipleFilenames(), LZ4IO_defaultPreferences(), LZ4IO_displayCompressedFilesInfo(), LZ4IO_favorDecSpeed(), LZ4IO_freePreferences(), LZ4IO_setBlockChecksumMode(), LZ4IO_setBlockMode(), LZ4IO_setBlockSize(), LZ4IO_setBlockSizeID(), LZ4IO_setContentSize(), LZ4IO_setDictionaryFilename(), LZ4IO_setNotificationLevel(), LZ4IO_setOverwrite(), LZ4IO_setPassThrough(), LZ4IO_setRemoveSrcFile(), LZ4IO_setSparseFile(), LZ4IO_setStreamChecksumMode(), LZ4IO_setTestMode(), MB, NULL, NULL_OUTPUT, nulmark, om_auto, om_bench, om_compress, om_decompress, om_list, om_test, PLATFORM_POSIX_VERSION, readU32FromChar(), stdinmark, stdoutmark, UNLZ4, usage_advanced(), usage_longhelp(), UTIL_createFileList(), UTIL_freeFileList(), UTIL_isRegFile(), waitEnter(), and WELCOME_MESSAGE.
char format allows and interprets K, KB, KiB, M, MB and MiB suffix. Will also modify *stringPtr, advancing it to position where it stopped reading. Note : function result can overflow if digit string > MAX_UINT Definition at line 264 of file lz4cli.c.
References unsigned.
Referenced by main().
Definition at line 105 of file lz4cli.c.
References DISPLAY, LZ4_EXTENSION, and stdinmark.
Referenced by badusage(), and usage_advanced().
Definition at line 125 of file lz4cli.c.
References DISPLAY, g_lz4c_legacy_commands, LZ4HC_CLEVEL_MAX, usage(), and WELCOME_MESSAGE.
Referenced by main(), and usage_longhelp().
Definition at line 167 of file lz4cli.c.
References DISPLAY, g_lz4c_legacy_commands, LZ4_EXTENSION, LZ4HC_CLEVEL_MAX, NULL_OUTPUT, stdoutmark, and usage_advanced().
Referenced by main().
|
static |
|
static |
Definition at line 73 of file lz4cli.c.
Referenced by badusage(), and main().
|
static |
Definition at line 58 of file lz4cli.c.
Referenced by main(), usage_advanced(), and usage_longhelp().