aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2015-10-26 23:42:32 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2015-10-27 21:28:50 +0100
commitfbe50cf6bc685f7cf4fbcb9c0c425fc93575a085 (patch)
tree6a7c495bc254e20881924508e137c7f616a11e9c
parent1de25a6e87e0e627aa34298105a3d17c60a1f44e (diff)
downloadbusybox-w32-fbe50cf6bc685f7cf4fbcb9c0c425fc93575a085.tar.gz
busybox-w32-fbe50cf6bc685f7cf4fbcb9c0c425fc93575a085.tar.bz2
busybox-w32-fbe50cf6bc685f7cf4fbcb9c0c425fc93575a085.zip
gunzip: add support for long options
Add support for long options. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/bbunzip.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 548882f53..e10372e14 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -290,6 +290,13 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
290//config: gunzip is used to decompress archives created by gzip. 290//config: gunzip is used to decompress archives created by gzip.
291//config: You can use the `-t' option to test the integrity of 291//config: You can use the `-t' option to test the integrity of
292//config: an archive, without decompressing it. 292//config: an archive, without decompressing it.
293//config:
294//config:config FEATURE_GUNZIP_LONG_OPTIONS
295//config: bool "Enable long options"
296//config: default y
297//config: depends on GUNZIP && LONG_OPTS
298//config: help
299//config: Enable use of long options.
293 300
294//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP)) 301//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP))
295//applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) 302//applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat))
@@ -321,6 +328,16 @@ char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UN
321 } 328 }
322 return filename; 329 return filename;
323} 330}
331
332#if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS
333static const char gunzip_longopts[] ALIGN1 =
334 "stdout\0" No_argument "c"
335 "to-stdout\0" No_argument "c"
336 "force\0" No_argument "f"
337 "test\0" No_argument "t"
338 ;
339#endif
340
324/* 341/*
325 * Linux kernel build uses gzip -d -n. We accept and ignore it. 342 * Linux kernel build uses gzip -d -n. We accept and ignore it.
326 * Man page says: 343 * Man page says:
@@ -337,6 +354,9 @@ char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UN
337int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 354int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
338int gunzip_main(int argc UNUSED_PARAM, char **argv) 355int gunzip_main(int argc UNUSED_PARAM, char **argv)
339{ 356{
357#if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS
358 applet_long_options = gunzip_longopts;
359#endif
340 getopt32(argv, "cfvqdtn"); 360 getopt32(argv, "cfvqdtn");
341 argv += optind; 361 argv += optind;
342 362