aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/bbunzip.c5
-rw-r--r--archival/cpio.c7
-rw-r--r--archival/dpkg.c3
-rw-r--r--archival/gzip.c7
-rw-r--r--archival/tar.c11
5 files changed, 18 insertions, 15 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 9b9fdc87b..20ab893da 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -389,9 +389,10 @@ 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
+ getopt32long(argv, "cfkvqdtn", gunzip_longopts);
+#else
getopt32(argv, "cfkvqdtn");
+#endif
argv += optind;
/* If called as zcat...
diff --git a/archival/cpio.c b/archival/cpio.c
index 38bab8257..f2165be3a 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -360,9 +360,8 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
char *cpio_owner;
IF_FEATURE_CPIO_O(const char *cpio_fmt = "";)
unsigned opt;
-
#if ENABLE_LONG_OPTS
- applet_long_options =
+ const char *long_opts =
"extract\0" No_argument "i"
"list\0" No_argument "t"
#if ENABLE_FEATURE_CPIO_O
@@ -390,9 +389,9 @@ int cpio_main(int argc UNUSED_PARAM, char **argv)
/* -L makes sense only with -o or -p */
#if !ENABLE_FEATURE_CPIO_O
- opt = getopt32(argv, OPTION_STR, &cpio_filename, &cpio_owner);
+ opt = getopt32long(argv, OPTION_STR, long_opts, &cpio_filename, &cpio_owner);
#else
- opt = getopt32(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"),
+ opt = getopt32long(argv, OPTION_STR "oH:" IF_FEATURE_CPIO_P("p"), long_opts,
&cpio_filename, &cpio_owner, &cpio_fmt);
#endif
argv += optind;
diff --git a/archival/dpkg.c b/archival/dpkg.c
index 90ad8766c..852e0cac2 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1766,8 +1766,7 @@ int dpkg_main(int argc UNUSED_PARAM, char **argv)
INIT_G();
- IF_LONG_OPTS(applet_long_options = dpkg_longopts);
- opt = getopt32(argv, "CilPruF:", &str_f);
+ opt = getopt32long(argv, "CilPruF:", dpkg_longopts, &str_f);
argv += optind;
//if (opt & OPT_configure) ... // -C
if (opt & OPT_force) { // -F (--force in official dpkg)
diff --git a/archival/gzip.c b/archival/gzip.c
index 4cf34ac28..9c53895e9 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -2216,11 +2216,12 @@ int gzip_main(int argc UNUSED_PARAM, char **argv)
SET_PTR_TO_GLOBALS((char *)xzalloc(sizeof(struct globals)+sizeof(struct globals2))
+ sizeof(struct globals));
-#if ENABLE_FEATURE_GZIP_LONG_OPTIONS
- applet_long_options = gzip_longopts;
-#endif
/* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
+#if ENABLE_FEATURE_GZIP_LONG_OPTIONS
+ opt = getopt32long(argv, "cfkv" IF_FEATURE_GZIP_DECOMPRESS("dt") "qn123456789", gzip_longopts);
+#else
opt = getopt32(argv, "cfkv" IF_FEATURE_GZIP_DECOMPRESS("dt") "qn123456789");
+#endif
#if ENABLE_FEATURE_GZIP_DECOMPRESS /* gunzip_main may not be visible... */
if (opt & 0x30) // -d and/or -t
return gunzip_main(argc, argv);
diff --git a/archival/tar.c b/archival/tar.c
index f62b33005..44ab246c0 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -940,6 +940,11 @@ static const char tar_longopts[] ALIGN1 =
"exclude\0" Required_argument "\xff"
# endif
;
+# define GETOPT32 getopt32long
+# define LONGOPTS ,tar_longopts
+#else
+# define GETOPT32 getopt32
+# define LONGOPTS
#endif
int tar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -980,9 +985,6 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
":\xf9+" // --strip-components=NUM
#endif
;
-#if ENABLE_FEATURE_TAR_LONG_OPTIONS
- applet_long_options = tar_longopts;
-#endif
#if ENABLE_DESKTOP
/* Lie to buildroot when it starts asking stupid questions. */
if (argv[1] && strcmp(argv[1], "--version") == 0) {
@@ -1019,7 +1021,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
}
}
#endif
- opt = getopt32(argv,
+ opt = GETOPT32(argv,
"txC:f:Oopvk"
IF_FEATURE_TAR_CREATE( "ch" )
IF_FEATURE_SEAMLESS_BZ2( "j" )
@@ -1030,6 +1032,7 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
IF_FEATURE_SEAMLESS_Z( "Z" )
IF_FEATURE_TAR_NOPRESERVE_TIME("m")
IF_FEATURE_TAR_LONG_OPTIONS("\xf9:") // --strip-components
+ LONGOPTS
, &base_dir // -C dir
, &tar_filename // -f filename
IF_FEATURE_TAR_FROM(, &(tar_handle->accept)) // T