summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2014-06-11 21:02:46 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2014-06-11 21:02:46 (GMT)
commit1c5a6304a2ab4d8b8d3f30cc371df10e537431ae (patch)
treee6b4060deaecd82844e6ccc95be182f3ce7cc1f6 /programs
parent0c62103105143eaaf0fa5caae09e65318063a417 (diff)
downloadlz4-1c5a6304a2ab4d8b8d3f30cc371df10e537431ae.zip
lz4-1c5a6304a2ab4d8b8d3f30cc371df10e537431ae.tar.gz
lz4-1c5a6304a2ab4d8b8d3f30cc371df10e537431ae.tar.bz2
CLI : can select compression level > 9
Diffstat (limited to 'programs')
-rw-r--r--programs/Makefile2
-rw-r--r--programs/lz4cli.c27
2 files changed, 14 insertions, 15 deletions
diff --git a/programs/Makefile b/programs/Makefile
index 35bfd06..811dda2 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -165,6 +165,6 @@ test-mem: lz4 datagen
rm tmp
test-mem32: lz4c32 datagen
-# unfortunately, valgrind doesn't work with non-native binary. If someone knows how to valgrind-test a 32-bits exe on a 64-bits system...
+# unfortunately, valgrind doesn't seem to work with non-native binary. If someone knows how to do a valgrind-test on a 32-bits exe with a 64-bits system...
endif
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index e05a9a9..fd2721d 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -344,6 +344,19 @@ int main(int argc, char** argv)
if (*argument=='s') { displayLevel=1; continue; } // -s (silent mode)
#endif // DISABLE_LZ4C_LEGACY_OPTIONS
+ if ((*argument>='0') && (*argument<='9'))
+ {
+ cLevel = 0;
+ while ((*argument >= '0') && (*argument <= '9'))
+ {
+ cLevel *= 10;
+ cLevel += *argument - '0';
+ argument++;
+ }
+ argument--;
+ continue;
+ }
+
switch(argument[0])
{
// Display help
@@ -354,20 +367,6 @@ int main(int argc, char** argv)
// Compression (default)
case 'z': forceCompress = 1; break;
- // Compression level
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case 'A': /* non documented (hidden) */
- cLevel=*argument -'0'; break;
-
// Use Legacy format (for Linux kernel compression)
case 'l': legacy_format=1; break;