summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/ar.c11
-rw-r--r--archival/bzip2.c8
-rw-r--r--archival/dpkg_deb.c5
-rw-r--r--archival/lzop.c2
-rw-r--r--archival/tar.c25
5 files changed, 28 insertions, 23 deletions
diff --git a/archival/ar.c b/archival/ar.c
index 46c10aa..027cd6b 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -243,10 +243,13 @@ int ar_main(int argc UNUSED_PARAM, char **argv)
/* prepend '-' to the first argument if required */
if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0')
argv[1] = xasprintf("-%s", argv[1]);
- /* -1: at least one param is reqd */
- /* one of p,t,x[,r] is required */
- opt_complementary = "-1:p:t:x"IF_FEATURE_AR_CREATE(":r");
- opt = getopt32(argv, "voc""ptx"IF_FEATURE_AR_CREATE("r"));
+ opt = getopt32(argv, "^"
+ "voc""ptx"IF_FEATURE_AR_CREATE("r")
+ "\0"
+ /* -1: at least one arg is reqd */
+ /* one of p,t,x[,r] is required */
+ "-1:p:t:x"IF_FEATURE_AR_CREATE(":r")
+ );
argv += optind;
t = opt / FIRST_CMD;
diff --git a/archival/bzip2.c b/archival/bzip2.c
index 0b9c508..d578eb7 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -195,9 +195,11 @@ int bzip2_main(int argc UNUSED_PARAM, char **argv)
* --best alias for -9
*/
- opt_complementary = "s2"; /* -s means -2 (compatibility) */
- /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
- opt = getopt32(argv, "cfkv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs");
+ opt = getopt32(argv, "^"
+ /* Must match bbunzip's constants OPT_STDOUT, OPT_FORCE! */
+ "cfkv" IF_FEATURE_BZIP2_DECOMPRESS("dt") "123456789qzs"
+ "\0" "s2" /* -s means -2 (compatibility) */
+ );
#if ENABLE_FEATURE_BZIP2_DECOMPRESS /* bunzip2_main may not be visible... */
if (opt & 0x30) // -d and/or -t
return bunzip2_main(argc, argv);
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 029bc4a..f6bf9eb 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -80,8 +80,9 @@ int dpkg_deb_main(int argc UNUSED_PARAM, char **argv)
#endif
/* Must have 1 or 2 args */
- opt_complementary = "-1:?2:c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
- opt = getopt32(argv, "cefXx");
+ opt = getopt32(argv, "^" "cefXx"
+ "\0" "-1:?2:c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"
+ );
argv += optind;
//argc -= optind;
diff --git a/archival/lzop.c b/archival/lzop.c
index df18ff1..1bf954f 100644
--- a/archival/lzop.c
+++ b/archival/lzop.c
@@ -1138,7 +1138,7 @@ int lzop_main(int argc UNUSED_PARAM, char **argv)
/* -U is "anti -k", invert bit for bbunpack(): */
option_mask32 ^= OPT_KEEP;
/* -k disables -U (if any): */
- /* opt_complementary = "k-U"; - nope, only handles -Uk, not -kU */
+ /* opt_complementary "k-U"? - nope, only handles -Uk, not -kU */
if (option_mask32 & OPT_k)
option_mask32 |= OPT_KEEP;
diff --git a/archival/tar.c b/archival/tar.c
index 44ab246..73c14ca 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -973,18 +973,6 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
/* Prepend '-' to the first argument if required */
if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0')
argv[1] = xasprintf("-%s", argv[1]);
- opt_complementary =
- "tt:vv:" // count -t,-v
-#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
- "\xff::" // --exclude=PATTERN is a list
-#endif
- IF_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
- IF_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
- IF_NOT_FEATURE_TAR_CREATE("t--x:x--t") // mutually exclusive
-#if ENABLE_FEATURE_TAR_LONG_OPTIONS
- ":\xf9+" // --strip-components=NUM
-#endif
- ;
#if ENABLE_DESKTOP
/* Lie to buildroot when it starts asking stupid questions. */
if (argv[1] && strcmp(argv[1], "--version") == 0) {
@@ -1021,7 +1009,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" )
@@ -1032,6 +1020,17 @@ 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
+ "\0"
+ "tt:vv:" // count -t,-v
+#if ENABLE_FEATURE_TAR_LONG_OPTIONS && ENABLE_FEATURE_TAR_FROM
+ "\xff::" // --exclude=PATTERN is a list
+#endif
+ IF_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
+ IF_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
+ IF_NOT_FEATURE_TAR_CREATE("t--x:x--t") // mutually exclusive
+#if ENABLE_FEATURE_TAR_LONG_OPTIONS
+ ":\xf9+" // --strip-components=NUM
+#endif
LONGOPTS
, &base_dir // -C dir
, &tar_filename // -f filename