aboutsummaryrefslogtreecommitdiff
path: root/archival/bbunzip.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/bbunzip.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/bbunzip.c')
-rw-r--r--archival/bbunzip.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 0eff58713..12c82eba4 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -12,9 +12,9 @@
12//kbuild:lib-$(CONFIG_LZOPCAT) += bbunzip.o 12//kbuild:lib-$(CONFIG_LZOPCAT) += bbunzip.o
13//kbuild:lib-$(CONFIG_UNLZOP) += bbunzip.o 13//kbuild:lib-$(CONFIG_UNLZOP) += bbunzip.o
14/* bzip2_main() too: */ 14/* bzip2_main() too: */
15//kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o 15//kbuild:lib-$(CONFIG_FEATURE_BZIP2_DECOMPRESS) += bbunzip.o
16/* gzip_main() too: */ 16/* gzip_main() too: */
17//kbuild:lib-$(CONFIG_GZIP) += bbunzip.o 17//kbuild:lib-$(CONFIG_FEATURE_GZIP_DECOMPRESS) += bbunzip.o
18 18
19/* Note: must be kept in sync with archival/lzop.c */ 19/* Note: must be kept in sync with archival/lzop.c */
20enum { 20enum {
@@ -197,7 +197,7 @@ int FAST_FUNC bbunpack(char **argv,
197} 197}
198 198
199#if ENABLE_UNCOMPRESS \ 199#if ENABLE_UNCOMPRESS \
200 || ENABLE_BUNZIP2 || ENABLE_BZCAT \ 200 || ENABLE_FEATURE_BZIP2_DECOMPRESS \
201 || ENABLE_UNLZMA || ENABLE_LZCAT || ENABLE_LZMA \ 201 || ENABLE_UNLZMA || ENABLE_LZCAT || ENABLE_LZMA \
202 || ENABLE_UNXZ || ENABLE_XZCAT || ENABLE_XZ 202 || ENABLE_UNXZ || ENABLE_XZCAT || ENABLE_XZ
203static 203static
@@ -295,6 +295,7 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
295//config:config GUNZIP 295//config:config GUNZIP
296//config: bool "gunzip" 296//config: bool "gunzip"
297//config: default y 297//config: default y
298//config: select FEATURE_GZIP_DECOMPRESS
298//config: help 299//config: help
299//config: gunzip is used to decompress archives created by gzip. 300//config: gunzip is used to decompress archives created by gzip.
300//config: You can use the `-t' option to test the integrity of 301//config: You can use the `-t' option to test the integrity of
@@ -303,6 +304,7 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
303//config:config ZCAT 304//config:config ZCAT
304//config: bool "zcat" 305//config: bool "zcat"
305//config: default y 306//config: default y
307//config: select FEATURE_GZIP_DECOMPRESS
306//config: help 308//config: help
307//config: Alias to "gunzip -c". 309//config: Alias to "gunzip -c".
308//config: 310//config:
@@ -315,9 +317,7 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
315 317
316//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP)) 318//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP))
317//applet:IF_ZCAT(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) 319//applet:IF_ZCAT(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat))
318//kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o 320#if ENABLE_FEATURE_GZIP_DECOMPRESS
319//kbuild:lib-$(CONFIG_ZCAT) += bbunzip.o
320#if ENABLE_GUNZIP || ENABLE_ZCAT
321static 321static
322char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) 322char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM)
323{ 323{
@@ -385,7 +385,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
385 385
386 return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL); 386 return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL);
387} 387}
388#endif 388#endif /* FEATURE_GZIP_DECOMPRESS */
389 389
390 390
391/* 391/*
@@ -408,6 +408,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
408//config:config BUNZIP2 408//config:config BUNZIP2
409//config: bool "bunzip2" 409//config: bool "bunzip2"
410//config: default y 410//config: default y
411//config: select FEATURE_BZIP2_DECOMPRESS
411//config: help 412//config: help
412//config: bunzip2 is a compression utility using the Burrows-Wheeler block 413//config: bunzip2 is a compression utility using the Burrows-Wheeler block
413//config: sorting text compression algorithm, and Huffman coding. Compression 414//config: sorting text compression algorithm, and Huffman coding. Compression
@@ -421,14 +422,13 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
421//config:config BZCAT 422//config:config BZCAT
422//config: bool "bzcat" 423//config: bool "bzcat"
423//config: default y 424//config: default y
425//config: select FEATURE_BZIP2_DECOMPRESS
424//config: help 426//config: help
425//config: Alias to "bunzip2 -c". 427//config: Alias to "bunzip2 -c".
426 428
427//applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) 429//applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP))
428//applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) 430//applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat))
429//kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o 431#if ENABLE_FEATURE_BZIP2_DECOMPRESS
430//kbuild:lib-$(CONFIG_BZCAT) += bbunzip.o
431#if ENABLE_BUNZIP2 || ENABLE_BZCAT
432int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 432int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
433int bunzip2_main(int argc UNUSED_PARAM, char **argv) 433int bunzip2_main(int argc UNUSED_PARAM, char **argv)
434{ 434{