diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-27 02:22:54 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-27 02:22:54 +0200 |
commit | ccb88a689e0f603f8d94255a7d9cb8128b6e620d (patch) | |
tree | ebd35745219fbb246b605826a147e6ec031d891e /archival | |
parent | c5f30c0df8f0ce5e94ca22a5100496233067708a (diff) | |
download | busybox-w32-ccb88a689e0f603f8d94255a7d9cb8128b6e620d.tar.gz busybox-w32-ccb88a689e0f603f8d94255a7d9cb8128b6e620d.tar.bz2 busybox-w32-ccb88a689e0f603f8d94255a7d9cb8128b6e620d.zip |
unlzma: add "lzma -d" alias, add -t support, rename lzmacat->lzcat
Also coalesce some common strings
text data bss dec hex filename
844110 453 6812 851375 cfdaf busybox_old
844061 453 6812 851326 cfd7e busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r-- | archival/Config.in | 8 | ||||
-rw-r--r-- | archival/bbunzip.c | 27 | ||||
-rw-r--r-- | archival/libunarchive/decompress_uncompress.c | 2 | ||||
-rw-r--r-- | archival/lzop.c | 6 |
4 files changed, 28 insertions, 15 deletions
diff --git a/archival/Config.in b/archival/Config.in index deacc2822..428398377 100644 --- a/archival/Config.in +++ b/archival/Config.in | |||
@@ -327,6 +327,14 @@ config FEATURE_LZMA_FAST | |||
327 | This option reduces decompression time by about 25% at the cost of | 327 | This option reduces decompression time by about 25% at the cost of |
328 | a 1K bigger binary. | 328 | a 1K bigger binary. |
329 | 329 | ||
330 | config FEATURE_LZMA_ALIAS | ||
331 | bool "Provide lzma alias which supports only unpacking" | ||
332 | default n | ||
333 | depends on UNLZMA | ||
334 | help | ||
335 | Enable this option if you want commands like "lzma -d" to work. | ||
336 | IOW: you'll get lzma applet, but it will always require -d option. | ||
337 | |||
330 | config UNZIP | 338 | config UNZIP |
331 | bool "unzip" | 339 | bool "unzip" |
332 | default n | 340 | default n |
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index df674bc6c..1e775f425 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -9,12 +9,12 @@ | |||
9 | #include "unarchive.h" | 9 | #include "unarchive.h" |
10 | 10 | ||
11 | enum { | 11 | enum { |
12 | OPT_STDOUT = 0x1, | 12 | OPT_STDOUT = 1 << 0, |
13 | OPT_FORCE = 0x2, | 13 | OPT_FORCE = 1 << 1, |
14 | /* gunzip and bunzip2 only: */ | 14 | /* only some decompressors: */ |
15 | OPT_VERBOSE = 0x4, | 15 | OPT_VERBOSE = 1 << 2, |
16 | OPT_DECOMPRESS = 0x8, | 16 | OPT_DECOMPRESS = 1 << 3, |
17 | OPT_TEST = 0x10, | 17 | OPT_TEST = 1 << 4, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | static | 20 | static |
@@ -333,12 +333,17 @@ IF_DESKTOP(long long) int unpack_unlzma(unpack_info_t *info UNUSED_PARAM) | |||
333 | int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 333 | int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
334 | int unlzma_main(int argc UNUSED_PARAM, char **argv) | 334 | int unlzma_main(int argc UNUSED_PARAM, char **argv) |
335 | { | 335 | { |
336 | getopt32(argv, "cf"); | 336 | int opts = getopt32(argv, "cfvdt"); |
337 | argv += optind; | 337 | # if ENABLE_FEATURE_LZMA_ALIAS |
338 | /* lzmacat? */ | 338 | /* lzma without -d or -t? */ |
339 | if (applet_name[4] == 'c') | 339 | if (applet_name[2] == 'm' && !(opts & (OPT_DECOMPRESS|OPT_TEST))) |
340 | bb_show_usage(); | ||
341 | # endif | ||
342 | /* lzcat? */ | ||
343 | if (applet_name[2] == 'c') | ||
340 | option_mask32 |= OPT_STDOUT; | 344 | option_mask32 |= OPT_STDOUT; |
341 | 345 | ||
346 | argv += optind; | ||
342 | return bbunpack(argv, make_new_name_unlzma, unpack_unlzma); | 347 | return bbunpack(argv, make_new_name_unlzma, unpack_unlzma); |
343 | } | 348 | } |
344 | 349 | ||
@@ -346,7 +351,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) | |||
346 | 351 | ||
347 | 352 | ||
348 | /* | 353 | /* |
349 | * Uncompress applet for busybox (c) 2002 Glenn McGrath | 354 | * Uncompress applet for busybox (c) 2002 Glenn McGrath |
350 | * | 355 | * |
351 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 356 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
352 | */ | 357 | */ |
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c index 2877c8981..1ff89ce3c 100644 --- a/archival/libunarchive/decompress_uncompress.c +++ b/archival/libunarchive/decompress_uncompress.c | |||
@@ -229,7 +229,7 @@ unpack_Z_stream(int fd_in, int fd_out) | |||
229 | ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", | 229 | ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", |
230 | insize, posbits, p[-1], p[0], p[1], p[2], p[3], | 230 | insize, posbits, p[-1], p[0], p[1], p[2], p[3], |
231 | (posbits & 07)); | 231 | (posbits & 07)); |
232 | bb_error_msg("uncompress: corrupt input"); | 232 | bb_error_msg("corrupted data"); |
233 | goto err; | 233 | goto err; |
234 | } | 234 | } |
235 | 235 | ||
diff --git a/archival/lzop.c b/archival/lzop.c index 0a15c51aa..d6cf6f4f5 100644 --- a/archival/lzop.c +++ b/archival/lzop.c | |||
@@ -738,12 +738,12 @@ static NOINLINE smallint lzo_decompress(const header_t *h) | |||
738 | bb_error_msg_and_die("this file is a split lzop file"); | 738 | bb_error_msg_and_die("this file is a split lzop file"); |
739 | 739 | ||
740 | if (dst_len > MAX_BLOCK_SIZE) | 740 | if (dst_len > MAX_BLOCK_SIZE) |
741 | bb_error_msg_and_die("lzop file corrupted"); | 741 | bb_error_msg_and_die("corrupted data"); |
742 | 742 | ||
743 | /* read compressed block size */ | 743 | /* read compressed block size */ |
744 | src_len = read32(); | 744 | src_len = read32(); |
745 | if (src_len <= 0 || src_len > dst_len) | 745 | if (src_len <= 0 || src_len > dst_len) |
746 | bb_error_msg_and_die("lzop file corrupted"); | 746 | bb_error_msg_and_die("corrupted data"); |
747 | 747 | ||
748 | if (dst_len > block_size) { | 748 | if (dst_len > block_size) { |
749 | if (b2) { | 749 | if (b2) { |
@@ -797,7 +797,7 @@ static NOINLINE smallint lzo_decompress(const header_t *h) | |||
797 | r = lzo1x_decompress_safe(b1, src_len, b2, &d, NULL); | 797 | r = lzo1x_decompress_safe(b1, src_len, b2, &d, NULL); |
798 | 798 | ||
799 | if (r != 0 /*LZO_E_OK*/ || dst_len != d) { | 799 | if (r != 0 /*LZO_E_OK*/ || dst_len != d) { |
800 | bb_error_msg_and_die("corrupted compressed data"); | 800 | bb_error_msg_and_die("corrupted data"); |
801 | } | 801 | } |
802 | dst = b2; | 802 | dst = b2; |
803 | } else { | 803 | } else { |