aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-06-15 18:07:04 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-06-15 18:07:04 +0200
commit1c013fae2845a6062fb4ad9e7720b5e5d1117cac (patch)
tree5952578df3283e80c986f3235565e2ccd413bc35
parent5d72ae53c972bd55864f47523e3923b1c683c185 (diff)
downloadbusybox-w32-1c013fae2845a6062fb4ad9e7720b5e5d1117cac.tar.gz
busybox-w32-1c013fae2845a6062fb4ad9e7720b5e5d1117cac.tar.bz2
busybox-w32-1c013fae2845a6062fb4ad9e7720b5e5d1117cac.zip
archival: add option -k "keep" to gzip/bzip2/lzop, add -U "nokeep" to lzop
function old new delta bbunpack 745 779 +34 lzop_main 93 121 +28 do_lzo_compress 320 328 +8 packed_usage 31685 31653 -32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 70/-32) Total: 38 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/bbunzip.c49
-rw-r--r--archival/bzip2.c11
-rw-r--r--archival/gzip.c11
-rw-r--r--archival/lzop.c53
4 files changed, 81 insertions, 43 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 0e2a261f0..c60f6e6df 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -21,10 +21,11 @@ enum {
21 OPT_STDOUT = 1 << 0, 21 OPT_STDOUT = 1 << 0,
22 OPT_FORCE = 1 << 1, 22 OPT_FORCE = 1 << 1,
23 /* only some decompressors: */ 23 /* only some decompressors: */
24 OPT_VERBOSE = 1 << 2, 24 OPT_KEEP = 1 << 2,
25 OPT_QUIET = 1 << 3, 25 OPT_VERBOSE = 1 << 3,
26 OPT_DECOMPRESS = 1 << 4, 26 OPT_QUIET = 1 << 4,
27 OPT_TEST = 1 << 5, 27 OPT_DECOMPRESS = 1 << 5,
28 OPT_TEST = 1 << 6,
28 SEAMLESS_MAGIC = (1 << 31) * ENABLE_ZCAT * SEAMLESS_COMPRESSION, 29 SEAMLESS_MAGIC = (1 << 31) * ENABLE_ZCAT * SEAMLESS_COMPRESSION,
29}; 30};
30 31
@@ -182,8 +183,11 @@ int FAST_FUNC bbunpack(char **argv,
182 } 183 }
183 /* Delete _source_ file */ 184 /* Delete _source_ file */
184 del = filename; 185 del = filename;
186 if (option_mask32 & OPT_KEEP) /* ... unless -k */
187 del = NULL;
185 } 188 }
186 xunlink(del); 189 if (del)
190 xunlink(del);
187 free_name: 191 free_name:
188 if (new_name != filename) 192 if (new_name != filename)
189 free(new_name); 193 free(new_name);
@@ -240,7 +244,16 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext)
240int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 244int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
241int uncompress_main(int argc UNUSED_PARAM, char **argv) 245int uncompress_main(int argc UNUSED_PARAM, char **argv)
242{ 246{
247// (N)compress 4.2.4.4:
248// -d If given, decompression is done instead
249// -c Write output on stdout, don't remove original
250// -b Parameter limits the max number of bits/code
251// -f Forces output file to be generated
252// -v Write compression statistics
253// -V Output vesion and compile options
254// -r Recursive. If a filename is a directory, descend into it and compress everything
243 getopt32(argv, "cf"); 255 getopt32(argv, "cf");
256
244 argv += optind; 257 argv += optind;
245 258
246 return bbunpack(argv, unpack_Z_stream, make_new_name_generic, "Z"); 259 return bbunpack(argv, unpack_Z_stream, make_new_name_generic, "Z");
@@ -273,11 +286,12 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
273 * Ken Turkowski, Dave Mack and Peter Jannesen. 286 * Ken Turkowski, Dave Mack and Peter Jannesen.
274 */ 287 */
275//usage:#define gunzip_trivial_usage 288//usage:#define gunzip_trivial_usage
276//usage: "[-cft] [FILE]..." 289//usage: "[-cfkt] [FILE]..."
277//usage:#define gunzip_full_usage "\n\n" 290//usage:#define gunzip_full_usage "\n\n"
278//usage: "Decompress FILEs (or stdin)\n" 291//usage: "Decompress FILEs (or stdin)\n"
279//usage: "\n -c Write to stdout" 292//usage: "\n -c Write to stdout"
280//usage: "\n -f Force" 293//usage: "\n -f Force"
294//usage: "\n -k Keep input files"
281//usage: "\n -t Test file integrity" 295//usage: "\n -t Test file integrity"
282//usage: 296//usage:
283//usage:#define gunzip_example_usage 297//usage:#define gunzip_example_usage
@@ -372,7 +386,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
372#if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS 386#if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS
373 applet_long_options = gunzip_longopts; 387 applet_long_options = gunzip_longopts;
374#endif 388#endif
375 getopt32(argv, "cfvqdtn"); 389 getopt32(argv, "cfkvqdtn");
376 argv += optind; 390 argv += optind;
377 391
378 /* If called as zcat... 392 /* If called as zcat...
@@ -394,11 +408,12 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
394 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 408 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
395 */ 409 */
396//usage:#define bunzip2_trivial_usage 410//usage:#define bunzip2_trivial_usage
397//usage: "[-cf] [FILE]..." 411//usage: "[-cfk] [FILE]..."
398//usage:#define bunzip2_full_usage "\n\n" 412//usage:#define bunzip2_full_usage "\n\n"
399//usage: "Decompress FILEs (or stdin)\n" 413//usage: "Decompress FILEs (or stdin)\n"
400//usage: "\n -c Write to stdout" 414//usage: "\n -c Write to stdout"
401//usage: "\n -f Force" 415//usage: "\n -f Force"
416//usage: "\n -k Keep input files"
402//usage:#define bzcat_trivial_usage 417//usage:#define bzcat_trivial_usage
403//usage: "[FILE]..." 418//usage: "[FILE]..."
404//usage:#define bzcat_full_usage "\n\n" 419//usage:#define bzcat_full_usage "\n\n"
@@ -432,7 +447,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
432int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 447int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
433int bunzip2_main(int argc UNUSED_PARAM, char **argv) 448int bunzip2_main(int argc UNUSED_PARAM, char **argv)
434{ 449{
435 getopt32(argv, "cfvqdt"); 450 getopt32(argv, "cfkvqdt");
436 argv += optind; 451 argv += optind;
437 if (ENABLE_BZCAT && applet_name[2] == 'c') /* bzcat */ 452 if (ENABLE_BZCAT && applet_name[2] == 'c') /* bzcat */
438 option_mask32 |= OPT_STDOUT; 453 option_mask32 |= OPT_STDOUT;
@@ -451,19 +466,21 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
451 * Licensed under GPLv2, see file LICENSE in this source tree. 466 * Licensed under GPLv2, see file LICENSE in this source tree.
452 */ 467 */
453//usage:#define unlzma_trivial_usage 468//usage:#define unlzma_trivial_usage
454//usage: "[-cf] [FILE]..." 469//usage: "[-cfk] [FILE]..."
455//usage:#define unlzma_full_usage "\n\n" 470//usage:#define unlzma_full_usage "\n\n"
456//usage: "Decompress FILE (or stdin)\n" 471//usage: "Decompress FILE (or stdin)\n"
457//usage: "\n -c Write to stdout" 472//usage: "\n -c Write to stdout"
458//usage: "\n -f Force" 473//usage: "\n -f Force"
474//usage: "\n -k Keep input files"
459//usage: 475//usage:
460//usage:#define lzma_trivial_usage 476//usage:#define lzma_trivial_usage
461//usage: "-d [-cf] [FILE]..." 477//usage: "-d [-cfk] [FILE]..."
462//usage:#define lzma_full_usage "\n\n" 478//usage:#define lzma_full_usage "\n\n"
463//usage: "Decompress FILE (or stdin)\n" 479//usage: "Decompress FILE (or stdin)\n"
464//usage: "\n -d Decompress" 480//usage: "\n -d Decompress"
465//usage: "\n -c Write to stdout" 481//usage: "\n -c Write to stdout"
466//usage: "\n -f Force" 482//usage: "\n -f Force"
483//usage: "\n -k Keep input files"
467//usage: 484//usage:
468//usage:#define lzcat_trivial_usage 485//usage:#define lzcat_trivial_usage
469//usage: "[FILE]..." 486//usage: "[FILE]..."
@@ -520,7 +537,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
520int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 537int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
521int unlzma_main(int argc UNUSED_PARAM, char **argv) 538int unlzma_main(int argc UNUSED_PARAM, char **argv)
522{ 539{
523 IF_LZMA(int opts =) getopt32(argv, "cfvqdt"); 540 IF_LZMA(int opts =) getopt32(argv, "cfkvqdt");
524# if ENABLE_LZMA 541# if ENABLE_LZMA
525 /* lzma without -d or -t? */ 542 /* lzma without -d or -t? */
526 if (applet_name[2] == 'm' && !(opts & (OPT_DECOMPRESS|OPT_TEST))) 543 if (applet_name[2] == 'm' && !(opts & (OPT_DECOMPRESS|OPT_TEST)))
@@ -537,19 +554,21 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv)
537 554
538 555
539//usage:#define unxz_trivial_usage 556//usage:#define unxz_trivial_usage
540//usage: "[-cf] [FILE]..." 557//usage: "[-cfk] [FILE]..."
541//usage:#define unxz_full_usage "\n\n" 558//usage:#define unxz_full_usage "\n\n"
542//usage: "Decompress FILE (or stdin)\n" 559//usage: "Decompress FILE (or stdin)\n"
543//usage: "\n -c Write to stdout" 560//usage: "\n -c Write to stdout"
544//usage: "\n -f Force" 561//usage: "\n -f Force"
562//usage: "\n -k Keep input files"
545//usage: 563//usage:
546//usage:#define xz_trivial_usage 564//usage:#define xz_trivial_usage
547//usage: "-d [-cf] [FILE]..." 565//usage: "-d [-cfk] [FILE]..."
548//usage:#define xz_full_usage "\n\n" 566//usage:#define xz_full_usage "\n\n"
549//usage: "Decompress FILE (or stdin)\n" 567//usage: "Decompress FILE (or stdin)\n"
550//usage: "\n -d Decompress" 568//usage: "\n -d Decompress"
551//usage: "\n -c Write to stdout" 569//usage: "\n -c Write to stdout"
552//usage: "\n -f Force" 570//usage: "\n -f Force"
571//usage: "\n -k Keep input files"
553//usage: 572//usage:
554//usage:#define xzcat_trivial_usage 573//usage:#define xzcat_trivial_usage
555//usage: "[FILE]..." 574//usage: "[FILE]..."
@@ -586,7 +605,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv)
586int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 605int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
587int unxz_main(int argc UNUSED_PARAM, char **argv) 606int unxz_main(int argc UNUSED_PARAM, char **argv)
588{ 607{
589 IF_XZ(int opts =) getopt32(argv, "cfvqdt"); 608 IF_XZ(int opts =) getopt32(argv, "cfkvqdt");
590# if ENABLE_XZ 609# if ENABLE_XZ
591 /* xz without -d or -t? */ 610 /* xz without -d or -t? */
592 if (applet_name[2] == '\0' && !(opts & (OPT_DECOMPRESS|OPT_TEST))) 611 if (applet_name[2] == '\0' && !(opts & (OPT_DECOMPRESS|OPT_TEST)))
diff --git a/archival/bzip2.c b/archival/bzip2.c
index 7e38e78b3..8afa43802 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -43,6 +43,7 @@
43//usage: ) 43//usage: )
44//usage: "\n -c Write to stdout" 44//usage: "\n -c Write to stdout"
45//usage: "\n -f Force" 45//usage: "\n -f Force"
46//usage: "\n -k Keep input files"
46 47
47#include "libbb.h" 48#include "libbb.h"
48#include "bb_archive.h" 49#include "bb_archive.h"
@@ -196,13 +197,13 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
196 197
197 opt_complementary = "s2"; /* -s means -2 (compatibility) */ 198 opt_complementary = "s2"; /* -s means -2 (compatibility) */
198 /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ 199 /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
199 opt = getopt32(argv, "cfv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs"); 200 opt = getopt32(argv, "cfkv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs");
200#if ENABLE_FEATURE_BZIP2_DECOMPRESS /* bunzip2_main may not be visible... */ 201#if ENABLE_FEATURE_BZIP2_DECOMPRESS /* bunzip2_main may not be visible... */
201 if (opt & 0x18) // -d and/or -t 202 if (opt & 0x30) // -d and/or -t
202 return bunzip2_main(argc, argv); 203 return bunzip2_main(argc, argv);
203 opt >>= 5; 204 opt >>= 6;
204#else 205#else
205 opt >>= 3; 206 opt >>= 4;
206#endif 207#endif
207 opt = (uint8_t)opt; /* isolate bits for -1..-8 */ 208 opt = (uint8_t)opt; /* isolate bits for -1..-8 */
208 opt |= 0x100; /* if nothing else, assume -9 */ 209 opt |= 0x100; /* if nothing else, assume -9 */
@@ -213,6 +214,6 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
213 } 214 }
214 215
215 argv += optind; 216 argv += optind;
216 option_mask32 &= 0x7; /* ignore all except -cfv */ 217 option_mask32 &= 0xf; /* ignore all except -cfkv */
217 return bbunpack(argv, compressStream, append_ext, "bz2"); 218 return bbunpack(argv, compressStream, append_ext, "bz2");
218} 219}
diff --git a/archival/gzip.c b/archival/gzip.c
index 7c6dee1d7..c895de426 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -84,7 +84,7 @@ aa: 85.1% -- replaced with aa.gz
84//kbuild:lib-$(CONFIG_GZIP) += gzip.o 84//kbuild:lib-$(CONFIG_GZIP) += gzip.o
85 85
86//usage:#define gzip_trivial_usage 86//usage:#define gzip_trivial_usage
87//usage: "[-cf" IF_FEATURE_GZIP_DECOMPRESS("dt") IF_FEATURE_GZIP_LEVELS("123456789") "] [FILE]..." 87//usage: "[-cfk" IF_FEATURE_GZIP_DECOMPRESS("dt") IF_FEATURE_GZIP_LEVELS("123456789") "] [FILE]..."
88//usage:#define gzip_full_usage "\n\n" 88//usage:#define gzip_full_usage "\n\n"
89//usage: "Compress FILEs (or stdin)\n" 89//usage: "Compress FILEs (or stdin)\n"
90//usage: IF_FEATURE_GZIP_LEVELS( 90//usage: IF_FEATURE_GZIP_LEVELS(
@@ -96,6 +96,7 @@ aa: 85.1% -- replaced with aa.gz
96//usage: ) 96//usage: )
97//usage: "\n -c Write to stdout" 97//usage: "\n -c Write to stdout"
98//usage: "\n -f Force" 98//usage: "\n -f Force"
99//usage: "\n -k Keep input files"
99//usage: 100//usage:
100//usage:#define gzip_example_usage 101//usage:#define gzip_example_usage
101//usage: "$ ls -la /tmp/busybox*\n" 102//usage: "$ ls -la /tmp/busybox*\n"
@@ -2219,13 +2220,13 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
2219 applet_long_options = gzip_longopts; 2220 applet_long_options = gzip_longopts;
2220#endif 2221#endif
2221 /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ 2222 /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
2222 opt = getopt32(argv, "cfv" IF_FEATURE_GZIP_DECOMPRESS("dt") "qn123456789"); 2223 opt = getopt32(argv, "cfkv" IF_FEATURE_GZIP_DECOMPRESS("dt") "qn123456789");
2223#if ENABLE_FEATURE_GZIP_DECOMPRESS /* gunzip_main may not be visible... */ 2224#if ENABLE_FEATURE_GZIP_DECOMPRESS /* gunzip_main may not be visible... */
2224 if (opt & 0x18) // -d and/or -t 2225 if (opt & 0x30) // -d and/or -t
2225 return gunzip_main(argc, argv); 2226 return gunzip_main(argc, argv);
2226#endif 2227#endif
2227#if ENABLE_FEATURE_GZIP_LEVELS 2228#if ENABLE_FEATURE_GZIP_LEVELS
2228 opt >>= ENABLE_FEATURE_GZIP_DECOMPRESS ? 7 : 5; /* drop cfv[dt]qn bits */ 2229 opt >>= ENABLE_FEATURE_GZIP_DECOMPRESS ? 8 : 6; /* drop cfkv[dt]qn bits */
2229 if (opt == 0) 2230 if (opt == 0)
2230 opt = 1 << 6; /* default: 6 */ 2231 opt = 1 << 6; /* default: 6 */
2231 opt = ffs(opt >> 4); /* Maps -1..-4 to [0], -5 to [1] ... -9 to [5] */ 2232 opt = ffs(opt >> 4); /* Maps -1..-4 to [0], -5 to [1] ... -9 to [5] */
@@ -2234,7 +2235,7 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
2234 max_lazy_match = gzip_level_config[opt].lazy2 * 2; 2235 max_lazy_match = gzip_level_config[opt].lazy2 * 2;
2235 nice_match = gzip_level_config[opt].nice2 * 2; 2236 nice_match = gzip_level_config[opt].nice2 * 2;
2236#endif 2237#endif
2237 option_mask32 &= 0x7; /* retain only -cfv */ 2238 option_mask32 &= 0xf; /* retain only -cfkv */
2238 2239
2239 /* Allocate all global buffers (for DYN_ALLOC option) */ 2240 /* Allocate all global buffers (for DYN_ALLOC option) */
2240 ALLOC(uch, G1.l_buf, INBUFSIZ); 2241 ALLOC(uch, G1.l_buf, INBUFSIZ);
diff --git a/archival/lzop.c b/archival/lzop.c
index ca61add3c..6ef82b749 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -33,13 +33,13 @@
33//config: 33//config:
34//config:config UNLZOP 34//config:config UNLZOP
35//config: bool "unlzop" 35//config: bool "unlzop"
36//config: default y 36//config: default n # INCOMPAT: upstream lzop does not provide such tool
37//config: help 37//config: help
38//config: Lzop decompresion. 38//config: Lzop decompresion.
39//config: 39//config:
40//config:config LZOPCAT 40//config:config LZOPCAT
41//config: bool "lzopcat" 41//config: bool "lzopcat"
42//config: default y 42//config: default n # INCOMPAT: upstream lzop does not provide such tool
43//config: help 43//config: help
44//config: Alias to "unlzop -c". 44//config: Alias to "unlzop -c".
45//config: 45//config:
@@ -61,12 +61,14 @@
61//kbuild:lib-$(CONFIG_LZOPCAT) += lzop.o 61//kbuild:lib-$(CONFIG_LZOPCAT) += lzop.o
62 62
63//usage:#define lzop_trivial_usage 63//usage:#define lzop_trivial_usage
64//usage: "[-cfvd123456789CF] [FILE]..." 64//usage: "[-cfUvd123456789CF] [FILE]..."
65//usage:#define lzop_full_usage "\n\n" 65//usage:#define lzop_full_usage "\n\n"
66//usage: " -1..9 Compression level" 66//usage: " -1..9 Compression level"
67//usage: "\n -d Decompress" 67//usage: "\n -d Decompress"
68//usage: "\n -c Write to stdout" 68//usage: "\n -c Write to stdout"
69//usage: "\n -f Force" 69//usage: "\n -f Force"
70//usage: "\n -U Delete input files"
71///////: "\n -k Keep input files" (default, so why bother documenting?)
70//usage: "\n -v Verbose" 72//usage: "\n -v Verbose"
71//usage: "\n -F Don't store or verify checksum" 73//usage: "\n -F Don't store or verify checksum"
72//usage: "\n -C Also write checksum of compressed block" 74//usage: "\n -C Also write checksum of compressed block"
@@ -78,10 +80,12 @@
78//usage: "\n -F Don't verify checksum" 80//usage: "\n -F Don't verify checksum"
79//usage: 81//usage:
80//usage:#define unlzop_trivial_usage 82//usage:#define unlzop_trivial_usage
81//usage: "[-cfvF] [FILE]..." 83//usage: "[-cfkvF] [FILE]..."
82//usage:#define unlzop_full_usage "\n\n" 84//usage:#define unlzop_full_usage "\n\n"
83//usage: " -c Write to stdout" 85//usage: " -c Write to stdout"
84//usage: "\n -f Force" 86//usage: "\n -f Force"
87//usage: "\n -U Delete input files"
88///////: "\n -k Keep input files" (default, so why bother documenting?)
85//usage: "\n -v Verbose" 89//usage: "\n -v Verbose"
86//usage: "\n -F Don't verify checksum" 90//usage: "\n -F Don't verify checksum"
87 91
@@ -472,27 +476,33 @@ struct globals {
472//#define LZOP_VERSION_STRING "1.01" 476//#define LZOP_VERSION_STRING "1.01"
473//#define LZOP_VERSION_DATE "Apr 27th 2003" 477//#define LZOP_VERSION_DATE "Apr 27th 2003"
474 478
475#define OPTION_STRING "cfvqdt123456789CF" 479// lzop wants to be weird:
480// unlike all other compressosrs, its -k "keep" option is the default,
481// and -U is used to delete the source. We will invert the bit after getopt().
482#define OPTION_STRING "cfUvqdt123456789CFk"
476 483
477/* Note: must be kept in sync with archival/bbunzip.c */ 484/* Note: must be kept in sync with archival/bbunzip.c */
478enum { 485enum {
479 OPT_STDOUT = (1 << 0), 486 OPT_STDOUT = (1 << 0),
480 OPT_FORCE = (1 << 1), 487 OPT_FORCE = (1 << 1),
481 OPT_VERBOSE = (1 << 2), 488 OPT_KEEP = (1 << 2),
482 OPT_QUIET = (1 << 3), 489 OPT_VERBOSE = (1 << 3),
483 OPT_DECOMPRESS = (1 << 4), 490 OPT_QUIET = (1 << 4),
484 OPT_TEST = (1 << 5), 491 OPT_DECOMPRESS = (1 << 5),
485 OPT_1 = (1 << 6), 492 OPT_TEST = (1 << 6),
486 OPT_2 = (1 << 7), 493 OPT_1 = (1 << 7),
487 OPT_3 = (1 << 8), 494 OPT_2 = (1 << 8),
488 OPT_4 = (1 << 9), 495 OPT_3 = (1 << 9),
489 OPT_5 = (1 << 10), 496 OPT_4 = (1 << 10),
490 OPT_6 = (1 << 11), 497 OPT_5 = (1 << 11),
491 OPT_789 = (7 << 12), 498 OPT_6 = (1 << 12),
492 OPT_7 = (1 << 13), 499 OPT_7 = (1 << 13),
493 OPT_8 = (1 << 14), 500 OPT_8 = (1 << 14),
494 OPT_C = (1 << 15), 501 OPT_9 = (1 << 15),
495 OPT_F = (1 << 16), 502 OPT_C = (1 << 16),
503 OPT_F = (1 << 17),
504 OPT_k = (1 << 18),
505 OPT_789 = OPT_7 | OPT_8 | OPT_9
496}; 506};
497 507
498/**********************************************************************/ 508/**********************************************************************/
@@ -1125,6 +1135,13 @@ int lzop_main(int argc UNUSED_PARAM, char **argv)
1125{ 1135{
1126 getopt32(argv, OPTION_STRING); 1136 getopt32(argv, OPTION_STRING);
1127 argv += optind; 1137 argv += optind;
1138 /* -U is "anti -k", invert bit for bbunpack(): */
1139 option_mask32 ^= OPT_KEEP;
1140 /* -k disables -U (if any): */
1141 /* opt_complementary = "k-U"; - nope, only handles -Uk, not -kU */
1142 if (option_mask32 & OPT_k)
1143 option_mask32 |= OPT_KEEP;
1144
1128 /* lzopcat? */ 1145 /* lzopcat? */
1129 if (ENABLE_LZOPCAT && applet_name[4] == 'c') 1146 if (ENABLE_LZOPCAT && applet_name[4] == 'c')
1130 option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS); 1147 option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS);