diff options
author | Ron Yorston <rmy@pobox.com> | 2014-01-02 10:25:11 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2014-01-02 10:25:11 +0000 |
commit | b8f278ee745778806118f57fb7884d205eba05ad (patch) | |
tree | fef237f6dd302c59918cf389a60c120e58d3e086 /archival/bbunzip.c | |
parent | 3fd34651ea72ea1c335d3170f234cb0517fd897f (diff) | |
parent | 57434022cefde87133b8ad39fb3b79c1274e7684 (diff) | |
download | busybox-w32-b8f278ee745778806118f57fb7884d205eba05ad.tar.gz busybox-w32-b8f278ee745778806118f57fb7884d205eba05ad.tar.bz2 busybox-w32-b8f278ee745778806118f57fb7884d205eba05ad.zip |
Merge branch 'busybox' into merge
Conflicts:
archival/Config.src
shell/ash.c
Diffstat (limited to 'archival/bbunzip.c')
-rw-r--r-- | archival/bbunzip.c | 96 |
1 files changed, 90 insertions, 6 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 9d1cd9485..3de8e1d48 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -7,6 +7,9 @@ | |||
7 | #include "libbb.h" | 7 | #include "libbb.h" |
8 | #include "bb_archive.h" | 8 | #include "bb_archive.h" |
9 | 9 | ||
10 | /* lzop_main() uses bbunpack(), need this: */ | ||
11 | //kbuild:lib-$(CONFIG_LZOP) += bbunzip.o | ||
12 | |||
10 | /* Note: must be kept in sync with archival/lzop.c */ | 13 | /* Note: must be kept in sync with archival/lzop.c */ |
11 | enum { | 14 | enum { |
12 | OPT_STDOUT = 1 << 0, | 15 | OPT_STDOUT = 1 << 0, |
@@ -207,7 +210,6 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) | |||
207 | * | 210 | * |
208 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 211 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
209 | */ | 212 | */ |
210 | |||
211 | //usage:#define uncompress_trivial_usage | 213 | //usage:#define uncompress_trivial_usage |
212 | //usage: "[-cf] [FILE]..." | 214 | //usage: "[-cf] [FILE]..." |
213 | //usage:#define uncompress_full_usage "\n\n" | 215 | //usage:#define uncompress_full_usage "\n\n" |
@@ -215,6 +217,15 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext) | |||
215 | //usage: "\n -c Write to stdout" | 217 | //usage: "\n -c Write to stdout" |
216 | //usage: "\n -f Overwrite" | 218 | //usage: "\n -f Overwrite" |
217 | 219 | ||
220 | //config:config UNCOMPRESS | ||
221 | //config: bool "uncompress" | ||
222 | //config: default n | ||
223 | //config: help | ||
224 | //config: uncompress is used to decompress archives created by compress. | ||
225 | //config: Not much used anymore, replaced by gzip/gunzip. | ||
226 | |||
227 | //applet:IF_UNCOMPRESS(APPLET(uncompress, BB_DIR_BIN, BB_SUID_DROP)) | ||
228 | //kbuild:lib-$(CONFIG_UNCOMPRESS) += bbunzip.o | ||
218 | #if ENABLE_UNCOMPRESS | 229 | #if ENABLE_UNCOMPRESS |
219 | static | 230 | static |
220 | IF_DESKTOP(long long) int FAST_FUNC unpack_uncompress(transformer_aux_data_t *aux) | 231 | IF_DESKTOP(long long) int FAST_FUNC unpack_uncompress(transformer_aux_data_t *aux) |
@@ -255,11 +266,7 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv) | |||
255 | * Portions of the lzw code are derived from the public domain 'compress' | 266 | * Portions of the lzw code are derived from the public domain 'compress' |
256 | * written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies, | 267 | * written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies, |
257 | * Ken Turkowski, Dave Mack and Peter Jannesen. | 268 | * Ken Turkowski, Dave Mack and Peter Jannesen. |
258 | * | ||
259 | * See the license_msg below and the file COPYING for the software license. | ||
260 | * See the file algorithm.doc for the compression algorithms and file formats. | ||
261 | */ | 269 | */ |
262 | |||
263 | //usage:#define gunzip_trivial_usage | 270 | //usage:#define gunzip_trivial_usage |
264 | //usage: "[-cft] [FILE]..." | 271 | //usage: "[-cft] [FILE]..." |
265 | //usage:#define gunzip_full_usage "\n\n" | 272 | //usage:#define gunzip_full_usage "\n\n" |
@@ -280,6 +287,18 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv) | |||
280 | //usage:#define zcat_full_usage "\n\n" | 287 | //usage:#define zcat_full_usage "\n\n" |
281 | //usage: "Decompress to stdout" | 288 | //usage: "Decompress to stdout" |
282 | 289 | ||
290 | //config:config GUNZIP | ||
291 | //config: bool "gunzip" | ||
292 | //config: default y | ||
293 | //config: help | ||
294 | //config: gunzip is used to decompress archives created by gzip. | ||
295 | //config: You can use the `-t' option to test the integrity of | ||
296 | //config: an archive, without decompressing it. | ||
297 | |||
298 | //applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP)) | ||
299 | //applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) | ||
300 | //kbuild:lib-$(CONFIG_GZIP) += bbunzip.o | ||
301 | //kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o | ||
283 | #if ENABLE_GUNZIP | 302 | #if ENABLE_GUNZIP |
284 | static | 303 | static |
285 | char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) | 304 | char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) |
@@ -358,8 +377,24 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) | |||
358 | //usage: "[FILE]..." | 377 | //usage: "[FILE]..." |
359 | //usage:#define bzcat_full_usage "\n\n" | 378 | //usage:#define bzcat_full_usage "\n\n" |
360 | //usage: "Decompress to stdout" | 379 | //usage: "Decompress to stdout" |
380 | |||
381 | //config:config BUNZIP2 | ||
382 | //config: bool "bunzip2" | ||
383 | //config: default y | ||
384 | //config: help | ||
385 | //config: bunzip2 is a compression utility using the Burrows-Wheeler block | ||
386 | //config: sorting text compression algorithm, and Huffman coding. Compression | ||
387 | //config: is generally considerably better than that achieved by more | ||
388 | //config: conventional LZ77/LZ78-based compressors, and approaches the | ||
389 | //config: performance of the PPM family of statistical compressors. | ||
390 | //config: | ||
391 | //config: Unless you have a specific application which requires bunzip2, you | ||
392 | //config: should probably say N here. | ||
393 | |||
361 | //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) | 394 | //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) |
362 | //applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) | 395 | //applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) |
396 | //kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o | ||
397 | //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o | ||
363 | #if ENABLE_BUNZIP2 | 398 | #if ENABLE_BUNZIP2 |
364 | static | 399 | static |
365 | IF_DESKTOP(long long) int FAST_FUNC unpack_bunzip2(transformer_aux_data_t *aux) | 400 | IF_DESKTOP(long long) int FAST_FUNC unpack_bunzip2(transformer_aux_data_t *aux) |
@@ -387,7 +422,6 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) | |||
387 | * | 422 | * |
388 | * Licensed under GPLv2, see file LICENSE in this source tree. | 423 | * Licensed under GPLv2, see file LICENSE in this source tree. |
389 | */ | 424 | */ |
390 | |||
391 | //usage:#define unlzma_trivial_usage | 425 | //usage:#define unlzma_trivial_usage |
392 | //usage: "[-cf] [FILE]..." | 426 | //usage: "[-cf] [FILE]..." |
393 | //usage:#define unlzma_full_usage "\n\n" | 427 | //usage:#define unlzma_full_usage "\n\n" |
@@ -428,6 +462,38 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) | |||
428 | //usage:#define xzcat_full_usage "\n\n" | 462 | //usage:#define xzcat_full_usage "\n\n" |
429 | //usage: "Decompress to stdout" | 463 | //usage: "Decompress to stdout" |
430 | 464 | ||
465 | //config:config UNLZMA | ||
466 | //config: bool "unlzma" | ||
467 | //config: default y | ||
468 | //config: help | ||
469 | //config: unlzma is a compression utility using the Lempel-Ziv-Markov chain | ||
470 | //config: compression algorithm, and range coding. Compression | ||
471 | //config: is generally considerably better than that achieved by the bzip2 | ||
472 | //config: compressors. | ||
473 | //config: | ||
474 | //config: The BusyBox unlzma applet is limited to decompression only. | ||
475 | //config: On an x86 system, this applet adds about 4K. | ||
476 | //config: | ||
477 | //config:config FEATURE_LZMA_FAST | ||
478 | //config: bool "Optimize unlzma for speed" | ||
479 | //config: default n | ||
480 | //config: depends on UNLZMA | ||
481 | //config: help | ||
482 | //config: This option reduces decompression time by about 25% at the cost of | ||
483 | //config: a 1K bigger binary. | ||
484 | //config: | ||
485 | //config:config LZMA | ||
486 | //config: bool "Provide lzma alias which supports only unpacking" | ||
487 | //config: default y | ||
488 | //config: depends on UNLZMA | ||
489 | //config: help | ||
490 | //config: Enable this option if you want commands like "lzma -d" to work. | ||
491 | //config: IOW: you'll get lzma applet, but it will always require -d option. | ||
492 | |||
493 | //applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP)) | ||
494 | //applet:IF_UNLZMA(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat)) | ||
495 | //applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma)) | ||
496 | //kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o | ||
431 | #if ENABLE_UNLZMA | 497 | #if ENABLE_UNLZMA |
432 | static | 498 | static |
433 | IF_DESKTOP(long long) int FAST_FUNC unpack_unlzma(transformer_aux_data_t *aux) | 499 | IF_DESKTOP(long long) int FAST_FUNC unpack_unlzma(transformer_aux_data_t *aux) |
@@ -453,6 +519,24 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) | |||
453 | #endif | 519 | #endif |
454 | 520 | ||
455 | 521 | ||
522 | //config:config UNXZ | ||
523 | //config: bool "unxz" | ||
524 | //config: default y | ||
525 | //config: help | ||
526 | //config: unxz is a unlzma successor. | ||
527 | //config: | ||
528 | //config:config XZ | ||
529 | //config: bool "Provide xz alias which supports only unpacking" | ||
530 | //config: default y | ||
531 | //config: depends on UNXZ | ||
532 | //config: help | ||
533 | //config: Enable this option if you want commands like "xz -d" to work. | ||
534 | //config: IOW: you'll get xz applet, but it will always require -d option. | ||
535 | |||
536 | //applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP)) | ||
537 | //applet:IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat)) | ||
538 | //applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz)) | ||
539 | //kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o | ||
456 | #if ENABLE_UNXZ | 540 | #if ENABLE_UNXZ |
457 | static | 541 | static |
458 | IF_DESKTOP(long long) int FAST_FUNC unpack_unxz(transformer_aux_data_t *aux) | 542 | IF_DESKTOP(long long) int FAST_FUNC unpack_unxz(transformer_aux_data_t *aux) |