diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-06-15 18:07:04 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-06-15 18:07:04 +0200 |
commit | 1c013fae2845a6062fb4ad9e7720b5e5d1117cac (patch) | |
tree | 5952578df3283e80c986f3235565e2ccd413bc35 /archival/bzip2.c | |
parent | 5d72ae53c972bd55864f47523e3923b1c683c185 (diff) | |
download | busybox-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>
Diffstat (limited to 'archival/bzip2.c')
-rw-r--r-- | archival/bzip2.c | 11 |
1 files changed, 6 insertions, 5 deletions
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 | } |