summaryrefslogtreecommitdiffstats
path: root/programs/lz4cli.c
diff options
context:
space:
mode:
authorTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>2015-02-12 06:46:02 (GMT)
committerTakayuki MATSUOKA <takayuki.matsuoka@gmail.com>2015-03-02 04:38:23 (GMT)
commit97679fa5a17d79f87c0a2d1e2d44c3215d48958b (patch)
tree9d9db433095cf72cc1de2c7d2a8914e2b59078cc /programs/lz4cli.c
parent67f3b4141af0a33e9590e4678f06724076b7b69e (diff)
downloadlz4-97679fa5a17d79f87c0a2d1e2d44c3215d48958b.zip
lz4-97679fa5a17d79f87c0a2d1e2d44c3215d48958b.tar.gz
lz4-97679fa5a17d79f87c0a2d1e2d44c3215d48958b.tar.bz2
Google Code Issue 155: lz4 cli should support sparse file
https://code.google.com/p/lz4/issues/detail?id=155 This is experimental implementation. Just a proof of concept. It works Linux and Windows. # Build To build experimental version, define 'LZ4IO_ENABLE_SPARSE_FILE' like the following command : make lz4programs 'CFLAGS=-O3 -DLZ4IO_ENABLE_SPARSE_FILE=1' ./programs/lz4 -h You will see "EXPERIMENTAL_SPARSE_FILE" as lz4 revision : "*** LZ4 command line interface 64-bits EXPERIMENTAL_SPARSE_FILE, by Yann Collet (...) ***" # Experiment This experimental version adds option "-x" for sparse file for decompression. You can use this option like this : ./programs/lz4 -9 -f my-file ./programs/lz4 -d -f -x my-file.lz4 my-file.lz4.out cmp my-file my-file.lz4.out
Diffstat (limited to 'programs/lz4cli.c')
-rw-r--r--programs/lz4cli.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 0da5dce..5b54143 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -83,6 +83,11 @@
/*****************************
* Constants
******************************/
+#if defined(LZ4IO_ENABLE_SPARSE_FILE)
+# undef LZ4_VERSION
+# define LZ4_VERSION "EXPERIMENTAL_SPARSE_FILE"
+#endif
+
#define COMPRESSOR_NAME "LZ4 command line interface"
#ifndef LZ4_VERSION
# define LZ4_VERSION "r126"
@@ -186,6 +191,10 @@ static int usage_advanced(void)
DISPLAY( " -y : overwrite output without prompting \n");
DISPLAY( " -s : suppress warnings \n");
#endif /* ENABLE_LZ4C_LEGACY_OPTIONS */
+#if defined(LZ4IO_ENABLE_SPARSE_FILE)
+ DISPLAY( "Experimental : Sparse file\n");
+ DISPLAY( " -x : enable sparse file\n");
+#endif /* LZ4IO_ENABLE_SPARSE_FILE */
EXTENDED_HELP;
return 0;
}
@@ -276,6 +285,9 @@ int main(int argc, char** argv)
/* Init */
programName = argv[0];
LZ4IO_setOverwrite(0);
+#if defined(LZ4IO_ENABLE_SPARSE_FILE)
+ LZ4IO_setSparseFile(0);
+#endif /* LZ4IO_ENABLE_SPARSE_FILE */
blockSize = LZ4IO_setBlockSizeID(LZ4_BLOCKSIZEID_DEFAULT);
/* lz4cat behavior */
@@ -403,6 +415,11 @@ int main(int argc, char** argv)
/* Pause at the end (hidden option) */
case 'p': main_pause=1; BMK_SetPause(); break;
+#if defined(LZ4IO_ENABLE_SPARSE_FILE)
+ /* Experimental : Enable sparse file */
+ case 'x': LZ4IO_setSparseFile(1); break;
+#endif /* LZ4IO_ENABLE_SPARSE_FILE */
+
/* Specific commands for customized versions */
EXTENDED_ARGUMENTS;