diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2010-01-06 08:54:49 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-06 08:54:49 +0100 |
commit | 839fd71077d457c9e86afc56ba5cc54a0e1fcfb8 (patch) | |
tree | 51b8111117dea3718156c318fcf3c6f9c3acdfc6 | |
parent | 251912443ce1dade4e6e457e47b4be6d274302ce (diff) | |
download | busybox-w32-839fd71077d457c9e86afc56ba5cc54a0e1fcfb8.tar.gz busybox-w32-839fd71077d457c9e86afc56ba5cc54a0e1fcfb8.tar.bz2 busybox-w32-839fd71077d457c9e86afc56ba5cc54a0e1fcfb8.zip |
gzip: add optional support for --long-opts
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | archival/Config.in | 7 | ||||
-rw-r--r-- | archival/gzip.c | 21 |
2 files changed, 27 insertions, 1 deletions
diff --git a/archival/Config.in b/archival/Config.in index cae7f20bb..17d5c411b 100644 --- a/archival/Config.in +++ b/archival/Config.in | |||
@@ -165,6 +165,13 @@ config GZIP | |||
165 | gzip is used to compress files. | 165 | gzip is used to compress files. |
166 | It's probably the most widely used UNIX compression program. | 166 | It's probably the most widely used UNIX compression program. |
167 | 167 | ||
168 | config FEATURE_GZIP_LONG_OPTIONS | ||
169 | bool "Enable long options" | ||
170 | default n | ||
171 | depends on GZIP && LONG_OPTS | ||
172 | help | ||
173 | Enable use of long options, increases size by about 106 Bytes | ||
174 | |||
168 | config LZOP | 175 | config LZOP |
169 | bool "lzop" | 176 | bool "lzop" |
170 | default n | 177 | default n |
diff --git a/archival/gzip.c b/archival/gzip.c index 71505698c..139eaacea 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -2043,6 +2043,23 @@ IF_DESKTOP(long long) int pack_gzip(unpack_info_t *info UNUSED_PARAM) | |||
2043 | return 0; | 2043 | return 0; |
2044 | } | 2044 | } |
2045 | 2045 | ||
2046 | #if ENABLE_FEATURE_GZIP_LONG_OPTIONS | ||
2047 | static const char gzip_longopts[] ALIGN1 = | ||
2048 | "stdout\0" No_argument "c" | ||
2049 | "to-stdout\0" No_argument "c" | ||
2050 | "force\0" No_argument "f" | ||
2051 | "verbose\0" No_argument "v" | ||
2052 | #if ENABLE_GUNZIP | ||
2053 | "decompress\0" No_argument "d" | ||
2054 | "uncompress\0" No_argument "d" | ||
2055 | "test\0" No_argument "t" | ||
2056 | #endif | ||
2057 | "quiet\0" No_argument "q" | ||
2058 | "fast\0" No_argument "1" | ||
2059 | "best\0" No_argument "9" | ||
2060 | ; | ||
2061 | #endif | ||
2062 | |||
2046 | /* | 2063 | /* |
2047 | * Linux kernel build uses gzip -d -n. We accept and ignore it. | 2064 | * Linux kernel build uses gzip -d -n. We accept and ignore it. |
2048 | * Man page says: | 2065 | * Man page says: |
@@ -2066,6 +2083,9 @@ int gzip_main(int argc UNUSED_PARAM, char **argv) | |||
2066 | { | 2083 | { |
2067 | unsigned opt; | 2084 | unsigned opt; |
2068 | 2085 | ||
2086 | #if ENABLE_FEATURE_GZIP_LONG_OPTIONS | ||
2087 | applet_long_options = gzip_longopts; | ||
2088 | #endif | ||
2069 | /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ | 2089 | /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ |
2070 | opt = getopt32(argv, "cfv" IF_GUNZIP("dt") "q123456789n"); | 2090 | opt = getopt32(argv, "cfv" IF_GUNZIP("dt") "q123456789n"); |
2071 | #if ENABLE_GUNZIP /* gunzip_main may not be visible... */ | 2091 | #if ENABLE_GUNZIP /* gunzip_main may not be visible... */ |
@@ -2080,7 +2100,6 @@ int gzip_main(int argc UNUSED_PARAM, char **argv) | |||
2080 | 2100 | ||
2081 | SET_PTR_TO_GLOBALS((char *)xzalloc(sizeof(struct globals)+sizeof(struct globals2)) | 2101 | SET_PTR_TO_GLOBALS((char *)xzalloc(sizeof(struct globals)+sizeof(struct globals2)) |
2082 | + sizeof(struct globals)); | 2102 | + sizeof(struct globals)); |
2083 | barrier(); | ||
2084 | 2103 | ||
2085 | /* Allocate all global buffers (for DYN_ALLOC option) */ | 2104 | /* Allocate all global buffers (for DYN_ALLOC option) */ |
2086 | ALLOC(uch, G1.l_buf, INBUFSIZ); | 2105 | ALLOC(uch, G1.l_buf, INBUFSIZ); |