aboutsummaryrefslogtreecommitdiff
path: root/archival/bzip2.c
diff options
context:
space:
mode:
authorGravatar Kang-Che Sung <explorer09@gmail.com>2017-01-08 14:28:34 +0800
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2017-01-09 09:03:31 +0100
commitb130f9f758b6404c6d0911a1c120937ae6ab47f8 (patch)
treece1502cfcfc67e7e9fb40b85d13488273aa82689 /archival/bzip2.c
parentfb87d93d1e0a6760049fa88aadd1232b7e1545e7 (diff)
downloadbusybox-b130f9f758b6404c6d0911a1c120937ae6ab47f8.tar.gz
busybox-b130f9f758b6404c6d0911a1c120937ae6ab47f8.tar.bz2
Allow 'gzip -d' and 'bzip2 -d' without gunzip or bunzip2
Idea copied from the "ip" applet. Signed-off-by: Kang-Che Sung <explorer09@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/bzip2.c')
-rw-r--r--archival/bzip2.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/archival/bzip2.c b/archival/bzip2.c
index 47fa29af3..7e38e78b3 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -19,6 +19,15 @@
//config:
//config: Unless you have a specific application which requires bzip2, you
//config: should probably say N here.
+//config:
+//config:config FEATURE_BZIP2_DECOMPRESS
+//config: bool "Enable decompression"
+//config: default y
+//config: depends on BZIP2 || BUNZIP2 || BZCAT
+//config: help
+//config: Enable -d (--decompress) and -t (--test) options for bzip2.
+//config: This will be automatically selected if bunzip2 or bzcat is
+//config: enabled.
//applet:IF_BZIP2(APPLET(bzip2, BB_DIR_USR_BIN, BB_SUID_DROP))
//kbuild:lib-$(CONFIG_BZIP2) += bzip2.o
@@ -28,7 +37,10 @@
//usage:#define bzip2_full_usage "\n\n"
//usage: "Compress FILEs (or stdin) with bzip2 algorithm\n"
//usage: "\n -1..9 Compression level"
+//usage: IF_FEATURE_BZIP2_DECOMPRESS(
//usage: "\n -d Decompress"
+//usage: "\n -t Test file integrity"
+//usage: )
//usage: "\n -c Write to stdout"
//usage: "\n -f Force"
@@ -184,8 +196,8 @@ 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_BUNZIP2("dt") "123456789qzs");
-#if ENABLE_BUNZIP2 /* bunzip2_main may not be visible... */
+ opt = getopt32(argv, "cfv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs");
+#if ENABLE_FEATURE_BZIP2_DECOMPRESS /* bunzip2_main may not be visible... */
if (opt & 0x18) // -d and/or -t
return bunzip2_main(argc, argv);
opt >>= 5;