aboutsummaryrefslogtreecommitdiff
path: root/archival/bzip2.c
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 /archival/bzip2.c
parent5d72ae53c972bd55864f47523e3923b1c683c185 (diff)
downloadbusybox-1c013fae2845a6062fb4ad9e7720b5e5d1117cac.tar.gz
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.c11
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 @@
//usage: )
//usage: "\n -c Write to stdout"
//usage: "\n -f Force"
+//usage: "\n -k Keep input files"
#include "libbb.h"
#include "bb_archive.h"
@@ -196,13 +197,13 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
opt_complementary = "s2"; /* -s means -2 (compatibility) */
/* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
- opt = getopt32(argv, "cfv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs");
+ opt = getopt32(argv, "cfkv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs");
#if ENABLE_FEATURE_BZIP2_DECOMPRESS /* bunzip2_main may not be visible... */
- if (opt & 0x18) // -d and/or -t
+ if (opt & 0x30) // -d and/or -t
return bunzip2_main(argc, argv);
- opt >>= 5;
+ opt >>= 6;
#else
- opt >>= 3;
+ opt >>= 4;
#endif
opt = (uint8_t)opt; /* isolate bits for -1..-8 */
opt |= 0x100; /* if nothing else, assume -9 */
@@ -213,6 +214,6 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
}
argv += optind;
- option_mask32 &= 0x7; /* ignore all except -cfv */
+ option_mask32 &= 0xf; /* ignore all except -cfkv */
return bbunpack(argv, compressStream, append_ext, "bz2");
}