diff options
Diffstat (limited to 'archival/gzip.c')
-rw-r--r-- | archival/gzip.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index 9e0bee815..63bf76053 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -72,19 +72,29 @@ aa: 85.1% -- replaced with aa.gz | |||
72 | //config: is 6. If levels 1-3 are specified, 4 is used. | 72 | //config: is 6. If levels 1-3 are specified, 4 is used. |
73 | //config: If this option is not selected, -N options are ignored and -9 | 73 | //config: If this option is not selected, -N options are ignored and -9 |
74 | //config: is used. | 74 | //config: is used. |
75 | //config: | ||
76 | //config:config FEATURE_GZIP_DECOMPRESS | ||
77 | //config: bool "Enable decompression" | ||
78 | //config: default y | ||
79 | //config: depends on GZIP || GUNZIP || ZCAT | ||
80 | //config: help | ||
81 | //config: Enable -d (--decompress) and -t (--test) options for gzip. | ||
82 | //config: This will be automatically selected if gunzip or zcat is | ||
83 | //config: enabled. | ||
75 | 84 | ||
76 | //applet:IF_GZIP(APPLET(gzip, BB_DIR_BIN, BB_SUID_DROP)) | 85 | //applet:IF_GZIP(APPLET(gzip, BB_DIR_BIN, BB_SUID_DROP)) |
77 | //kbuild:lib-$(CONFIG_GZIP) += gzip.o | 86 | //kbuild:lib-$(CONFIG_GZIP) += gzip.o |
78 | 87 | ||
79 | //usage:#define gzip_trivial_usage | 88 | //usage:#define gzip_trivial_usage |
80 | //usage: "[-cf" IF_GUNZIP("d") IF_FEATURE_GZIP_LEVELS("123456789") "] [FILE]..." | 89 | //usage: "[-cf" IF_FEATURE_GZIP_DECOMPRESS("dt") IF_FEATURE_GZIP_LEVELS("123456789") "] [FILE]..." |
81 | //usage:#define gzip_full_usage "\n\n" | 90 | //usage:#define gzip_full_usage "\n\n" |
82 | //usage: "Compress FILEs (or stdin)\n" | 91 | //usage: "Compress FILEs (or stdin)\n" |
83 | //usage: IF_FEATURE_GZIP_LEVELS( | 92 | //usage: IF_FEATURE_GZIP_LEVELS( |
84 | //usage: "\n -1..9 Compression level" | 93 | //usage: "\n -1..9 Compression level" |
85 | //usage: ) | 94 | //usage: ) |
86 | //usage: IF_GUNZIP( | 95 | //usage: IF_FEATURE_GZIP_DECOMPRESS( |
87 | //usage: "\n -d Decompress" | 96 | //usage: "\n -d Decompress" |
97 | //usage: "\n -t Test file integrity" | ||
88 | //usage: ) | 98 | //usage: ) |
89 | //usage: "\n -c Write to stdout" | 99 | //usage: "\n -c Write to stdout" |
90 | //usage: "\n -f Force" | 100 | //usage: "\n -f Force" |
@@ -2154,7 +2164,7 @@ static const char gzip_longopts[] ALIGN1 = | |||
2154 | "to-stdout\0" No_argument "c" | 2164 | "to-stdout\0" No_argument "c" |
2155 | "force\0" No_argument "f" | 2165 | "force\0" No_argument "f" |
2156 | "verbose\0" No_argument "v" | 2166 | "verbose\0" No_argument "v" |
2157 | #if ENABLE_GUNZIP | 2167 | #if ENABLE_FEATURE_GZIP_DECOMPRESS |
2158 | "decompress\0" No_argument "d" | 2168 | "decompress\0" No_argument "d" |
2159 | "uncompress\0" No_argument "d" | 2169 | "uncompress\0" No_argument "d" |
2160 | "test\0" No_argument "t" | 2170 | "test\0" No_argument "t" |
@@ -2181,7 +2191,7 @@ static const char gzip_longopts[] ALIGN1 = | |||
2181 | */ | 2191 | */ |
2182 | 2192 | ||
2183 | int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 2193 | int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
2184 | #if ENABLE_GUNZIP | 2194 | #if ENABLE_FEATURE_GZIP_DECOMPRESS |
2185 | int gzip_main(int argc, char **argv) | 2195 | int gzip_main(int argc, char **argv) |
2186 | #else | 2196 | #else |
2187 | int gzip_main(int argc UNUSED_PARAM, char **argv) | 2197 | int gzip_main(int argc UNUSED_PARAM, char **argv) |
@@ -2211,13 +2221,13 @@ int gzip_main(int argc UNUSED_PARAM, char **argv) | |||
2211 | applet_long_options = gzip_longopts; | 2221 | applet_long_options = gzip_longopts; |
2212 | #endif | 2222 | #endif |
2213 | /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ | 2223 | /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */ |
2214 | opt = getopt32(argv, "cfv" IF_GUNZIP("dt") "qn123456789"); | 2224 | opt = getopt32(argv, "cfv" IF_FEATURE_GZIP_DECOMPRESS("dt") "qn123456789"); |
2215 | #if ENABLE_GUNZIP /* gunzip_main may not be visible... */ | 2225 | #if ENABLE_FEATURE_GZIP_DECOMPRESS /* gunzip_main may not be visible... */ |
2216 | if (opt & 0x18) // -d and/or -t | 2226 | if (opt & 0x18) // -d and/or -t |
2217 | return gunzip_main(argc, argv); | 2227 | return gunzip_main(argc, argv); |
2218 | #endif | 2228 | #endif |
2219 | #ifdef ENABLE_FEATURE_GZIP_LEVELS | 2229 | #ifdef ENABLE_FEATURE_GZIP_LEVELS |
2220 | opt >>= ENABLE_GUNZIP ? 7 : 5; /* drop cfv[dt]qn bits */ | 2230 | opt >>= ENABLE_FEATURE_GZIP_DECOMPRESS ? 7 : 5; /* drop cfv[dt]qn bits */ |
2221 | if (opt == 0) | 2231 | if (opt == 0) |
2222 | opt = 1 << 6; /* default: 6 */ | 2232 | opt = 1 << 6; /* default: 6 */ |
2223 | opt = ffs(opt >> 4); /* Maps -1..-4 to [0], -5 to [1] ... -9 to [5] */ | 2233 | opt = ffs(opt >> 4); /* Maps -1..-4 to [0], -5 to [1] ... -9 to [5] */ |