summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorAaro Koskinen2015-10-26 23:42:32 +0200
committerDenys Vlasenko2015-10-27 21:28:50 +0100
commitfbe50cf6bc685f7cf4fbcb9c0c425fc93575a085 (patch)
tree6a7c495bc254e20881924508e137c7f616a11e9c /archival
parent1de25a6e87e0e627aa34298105a3d17c60a1f44e (diff)
downloadbusybox-fbe50cf6bc685f7cf4fbcb9c0c425fc93575a085.zip
busybox-fbe50cf6bc685f7cf4fbcb9c0c425fc93575a085.tar.gz
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>
Diffstat (limited to 'archival')
-rw-r--r--archival/bbunzip.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 548882f..e10372e 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -290,6 +290,13 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
//config: gunzip is used to decompress archives created by gzip.
//config: You can use the `-t' option to test the integrity of
//config: an archive, without decompressing it.
+//config:
+//config:config FEATURE_GUNZIP_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on GUNZIP && LONG_OPTS
+//config: help
+//config: Enable use of long options.
//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP))
//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
}
return filename;
}
+
+#if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS
+static const char gunzip_longopts[] ALIGN1 =
+ "stdout\0" No_argument "c"
+ "to-stdout\0" No_argument "c"
+ "force\0" No_argument "f"
+ "test\0" No_argument "t"
+ ;
+#endif
+
/*
* Linux kernel build uses gzip -d -n. We accept and ignore it.
* Man page says:
@@ -337,6 +354,9 @@ char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UN
int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int gunzip_main(int argc UNUSED_PARAM, char **argv)
{
+#if ENABLE_FEATURE_GUNZIP_LONG_OPTIONS
+ applet_long_options = gunzip_longopts;
+#endif
getopt32(argv, "cfvqdtn");
argv += optind;