aboutsummaryrefslogtreecommitdiff
path: root/archival/bzip2.c
diff options
context:
space:
mode:
authorKang-Che Sung <explorer09@gmail.com>2017-01-08 14:28:34 +0800
committerDenys Vlasenko <vda.linux@googlemail.com>2017-01-09 09:03:31 +0100
commitb130f9f758b6404c6d0911a1c120937ae6ab47f8 (patch)
treece1502cfcfc67e7e9fb40b85d13488273aa82689 /archival/bzip2.c
parentfb87d93d1e0a6760049fa88aadd1232b7e1545e7 (diff)
downloadbusybox-w32-b130f9f758b6404c6d0911a1c120937ae6ab47f8.tar.gz
busybox-w32-b130f9f758b6404c6d0911a1c120937ae6ab47f8.tar.bz2
busybox-w32-b130f9f758b6404c6d0911a1c120937ae6ab47f8.zip
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 @@
19//config: 19//config:
20//config: Unless you have a specific application which requires bzip2, you 20//config: Unless you have a specific application which requires bzip2, you
21//config: should probably say N here. 21//config: should probably say N here.
22//config:
23//config:config FEATURE_BZIP2_DECOMPRESS
24//config: bool "Enable decompression"
25//config: default y
26//config: depends on BZIP2 || BUNZIP2 || BZCAT
27//config: help
28//config: Enable -d (--decompress) and -t (--test) options for bzip2.
29//config: This will be automatically selected if bunzip2 or bzcat is
30//config: enabled.
22 31
23//applet:IF_BZIP2(APPLET(bzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) 32//applet:IF_BZIP2(APPLET(bzip2, BB_DIR_USR_BIN, BB_SUID_DROP))
24//kbuild:lib-$(CONFIG_BZIP2) += bzip2.o 33//kbuild:lib-$(CONFIG_BZIP2) += bzip2.o
@@ -28,7 +37,10 @@
28//usage:#define bzip2_full_usage "\n\n" 37//usage:#define bzip2_full_usage "\n\n"
29//usage: "Compress FILEs (or stdin) with bzip2 algorithm\n" 38//usage: "Compress FILEs (or stdin) with bzip2 algorithm\n"
30//usage: "\n -1..9 Compression level" 39//usage: "\n -1..9 Compression level"
40//usage: IF_FEATURE_BZIP2_DECOMPRESS(
31//usage: "\n -d Decompress" 41//usage: "\n -d Decompress"
42//usage: "\n -t Test file integrity"
43//usage: )
32//usage: "\n -c Write to stdout" 44//usage: "\n -c Write to stdout"
33//usage: "\n -f Force" 45//usage: "\n -f Force"
34 46
@@ -184,8 +196,8 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
184 196
185 opt_complementary = "s2"; /* -s means -2 (compatibility) */ 197 opt_complementary = "s2"; /* -s means -2 (compatibility) */
186 /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ 198 /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
187 opt = getopt32(argv, "cfv" IF_BUNZIP2("dt") "123456789qzs"); 199 opt = getopt32(argv, "cfv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs");
188#if ENABLE_BUNZIP2 /* bunzip2_main may not be visible... */ 200#if ENABLE_FEATURE_BZIP2_DECOMPRESS /* bunzip2_main may not be visible... */
189 if (opt & 0x18) // -d and/or -t 201 if (opt & 0x18) // -d and/or -t
190 return bunzip2_main(argc, argv); 202 return bunzip2_main(argc, argv);
191 opt >>= 5; 203 opt >>= 5;