diff options
author | Denis Vlasenko | 2007-03-14 00:07:51 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-03-14 00:07:51 +0000 |
commit | 75605788ff6be5a766a7e41da583d5e8f47d9ac4 (patch) | |
tree | 36853bddc7322d7a30c3dab2f064b8da7efe481e /archival/bbunzip.c | |
parent | 07766bb0e7adcefa5dd5a373986176a5cd42ed23 (diff) | |
download | busybox-75605788ff6be5a766a7e41da583d5e8f47d9ac4.zip busybox-75605788ff6be5a766a7e41da583d5e8f47d9ac4.tar.gz |
gzip: use common bbunzip infrastructure - ~700 bytes code less
Diffstat (limited to 'archival/bbunzip.c')
-rw-r--r-- | archival/bbunzip.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index f7c8612..e16e6b0 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -9,12 +9,12 @@ #include "unarchive.h" enum { - OPT_STDOUT = 1, - OPT_FORCE = 2, + OPT_STDOUT = 0x1, + OPT_FORCE = 0x2, /* gunzip only: */ - OPT_TEST = 4, - OPT_DECOMPRESS = 8, - OPT_VERBOSE = 0x10, + OPT_VERBOSE = 0x4, + OPT_DECOMPRESS = 0x8, + OPT_TEST = 0x10, }; static @@ -33,8 +33,7 @@ int open_to_or_warn(int to_fd, const char *filename, int flags, int mode) return 0; } -static -int unpack(char **argv, +int bbunpack(char **argv, char* (*make_new_name)(char *filename), USE_DESKTOP(long long) int (*unpacker)(void) ) @@ -173,7 +172,7 @@ int bunzip2_main(int argc, char **argv) if (applet_name[2] == 'c') option_mask32 |= OPT_STDOUT; - return unpack(argv, make_new_name_bunzip2, unpack_bunzip2); + return bbunpack(argv, make_new_name_bunzip2, unpack_bunzip2); } #endif @@ -267,13 +266,13 @@ USE_DESKTOP(long long) int unpack_gunzip(void) int gunzip_main(int argc, char **argv); int gunzip_main(int argc, char **argv) { - getopt32(argc, argv, "cftdv"); + getopt32(argc, argv, "cfvdt"); argv += optind; /* if called as zcat */ if (applet_name[1] == 'c') option_mask32 |= OPT_STDOUT; - return unpack(argv, make_new_name_gunzip, unpack_gunzip); + return bbunpack(argv, make_new_name_gunzip, unpack_gunzip); } #endif @@ -311,7 +310,7 @@ int unlzma_main(int argc, char **argv) if (applet_name[4] == 'c') option_mask32 |= OPT_STDOUT; - return unpack(argv, make_new_name_unlzma, unpack_unlzma); + return bbunpack(argv, make_new_name_unlzma, unpack_unlzma); } #endif @@ -350,7 +349,7 @@ int uncompress_main(int argc, char **argv) getopt32(argc, argv, "cf"); argv += optind; - return unpack(argv, make_new_name_uncompress, unpack_uncompress); + return bbunpack(argv, make_new_name_uncompress, unpack_uncompress); } #endif |