diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-19 12:10:38 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-06-19 12:10:38 +0200 |
commit | f3b92d385695aecefd93d5f199be1f64270c2687 (patch) | |
tree | 5d6b2308ceafea6040bd78ea8401a91eb65d376b | |
parent | e2e4cc249dc1bd4b280846f55a36208674eadd55 (diff) | |
download | busybox-w32-f3b92d385695aecefd93d5f199be1f64270c2687.tar.gz busybox-w32-f3b92d385695aecefd93d5f199be1f64270c2687.tar.bz2 busybox-w32-f3b92d385695aecefd93d5f199be1f64270c2687.zip |
getopt: FEATURE_GETOPT_LONG for -l; rename GETOPT_LONG to LONG_OPTS
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | Config.in | 2 | ||||
-rw-r--r-- | TODO_config_nommu | 2 | ||||
-rw-r--r-- | archival/Config.in | 2 | ||||
-rw-r--r-- | archival/cpio.c | 2 | ||||
-rw-r--r-- | console-tools/Config.in | 2 | ||||
-rw-r--r-- | coreutils/Config.in | 16 | ||||
-rw-r--r-- | coreutils/od_bloaty.c | 12 | ||||
-rw-r--r-- | coreutils/touch.c | 4 | ||||
-rw-r--r-- | coreutils/uname.c | 4 | ||||
-rw-r--r-- | debianutils/Config.in | 4 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | include/usage.h | 30 | ||||
-rw-r--r-- | libbb/getopt32.c | 10 | ||||
-rw-r--r-- | loginutils/Config.in | 4 | ||||
-rw-r--r-- | loginutils/chpasswd.c | 4 | ||||
-rw-r--r-- | loginutils/cryptpw.c | 2 | ||||
-rw-r--r-- | networking/Config.in | 6 | ||||
-rw-r--r-- | networking/ifenslave.c | 2 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 4 | ||||
-rw-r--r-- | networking/udhcp/dumpleases.c | 2 | ||||
-rw-r--r-- | scripts/defconfig | 3 | ||||
-rw-r--r-- | selinux/Config.in | 4 | ||||
-rw-r--r-- | util-linux/Config.in | 9 | ||||
-rw-r--r-- | util-linux/getopt.c | 20 | ||||
-rw-r--r-- | util-linux/rtcwake.c | 2 | ||||
-rw-r--r-- | util-linux/script.c | 2 |
26 files changed, 82 insertions, 74 deletions
@@ -114,7 +114,7 @@ config LOCALE_SUPPORT | |||
114 | Enable this if your system has locale support and you would like | 114 | Enable this if your system has locale support and you would like |
115 | busybox to support locale settings. | 115 | busybox to support locale settings. |
116 | 116 | ||
117 | config GETOPT_LONG | 117 | config LONG_OPTS |
118 | bool "Support for --long-options" | 118 | bool "Support for --long-options" |
119 | default y | 119 | default y |
120 | help | 120 | help |
diff --git a/TODO_config_nommu b/TODO_config_nommu index 2061bfd1c..9c3e86445 100644 --- a/TODO_config_nommu +++ b/TODO_config_nommu | |||
@@ -23,7 +23,7 @@ CONFIG_FEATURE_VERBOSE_USAGE=y | |||
23 | CONFIG_FEATURE_COMPRESS_USAGE=y | 23 | CONFIG_FEATURE_COMPRESS_USAGE=y |
24 | CONFIG_FEATURE_INSTALLER=y | 24 | CONFIG_FEATURE_INSTALLER=y |
25 | # CONFIG_LOCALE_SUPPORT is not set | 25 | # CONFIG_LOCALE_SUPPORT is not set |
26 | CONFIG_GETOPT_LONG=y | 26 | CONFIG_LONG_OPTS=y |
27 | CONFIG_FEATURE_DEVPTS=y | 27 | CONFIG_FEATURE_DEVPTS=y |
28 | # CONFIG_FEATURE_CLEAN_UP is not set | 28 | # CONFIG_FEATURE_CLEAN_UP is not set |
29 | CONFIG_FEATURE_PIDFILE=y | 29 | CONFIG_FEATURE_PIDFILE=y |
diff --git a/archival/Config.in b/archival/Config.in index 1ea6f3d16..cae7f20bb 100644 --- a/archival/Config.in +++ b/archival/Config.in | |||
@@ -256,7 +256,7 @@ config FEATURE_TAR_GNU_EXTENSIONS | |||
256 | config FEATURE_TAR_LONG_OPTIONS | 256 | config FEATURE_TAR_LONG_OPTIONS |
257 | bool "Enable long options" | 257 | bool "Enable long options" |
258 | default n | 258 | default n |
259 | depends on TAR && GETOPT_LONG | 259 | depends on TAR && LONG_OPTS |
260 | help | 260 | help |
261 | Enable use of long options, increases size by about 400 Bytes | 261 | Enable use of long options, increases size by about 400 Bytes |
262 | 262 | ||
diff --git a/archival/cpio.c b/archival/cpio.c index 4cf3c2c50..a6484e5c0 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
@@ -273,7 +273,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) | |||
273 | IF_FEATURE_CPIO_O(const char *cpio_fmt = "";) | 273 | IF_FEATURE_CPIO_O(const char *cpio_fmt = "";) |
274 | unsigned opt; | 274 | unsigned opt; |
275 | 275 | ||
276 | #if ENABLE_GETOPT_LONG | 276 | #if ENABLE_LONG_OPTS |
277 | applet_long_options = | 277 | applet_long_options = |
278 | "extract\0" No_argument "i" | 278 | "extract\0" No_argument "i" |
279 | "list\0" No_argument "t" | 279 | "list\0" No_argument "t" |
diff --git a/console-tools/Config.in b/console-tools/Config.in index 994140b79..cd0a9310e 100644 --- a/console-tools/Config.in +++ b/console-tools/Config.in | |||
@@ -91,7 +91,7 @@ config SETCONSOLE | |||
91 | config FEATURE_SETCONSOLE_LONG_OPTIONS | 91 | config FEATURE_SETCONSOLE_LONG_OPTIONS |
92 | bool "Enable long options" | 92 | bool "Enable long options" |
93 | default n | 93 | default n |
94 | depends on SETCONSOLE && GETOPT_LONG | 94 | depends on SETCONSOLE && LONG_OPTS |
95 | help | 95 | help |
96 | Support long options for the setconsole applet. | 96 | Support long options for the setconsole applet. |
97 | 97 | ||
diff --git a/coreutils/Config.in b/coreutils/Config.in index 88642d71e..f9db0671d 100644 --- a/coreutils/Config.in +++ b/coreutils/Config.in | |||
@@ -204,7 +204,7 @@ config ENV | |||
204 | config FEATURE_ENV_LONG_OPTIONS | 204 | config FEATURE_ENV_LONG_OPTIONS |
205 | bool "Enable long options" | 205 | bool "Enable long options" |
206 | default n | 206 | default n |
207 | depends on ENV && GETOPT_LONG | 207 | depends on ENV && LONG_OPTS |
208 | help | 208 | help |
209 | Support long options for the env applet. | 209 | Support long options for the env applet. |
210 | 210 | ||
@@ -217,7 +217,7 @@ config EXPAND | |||
217 | config FEATURE_EXPAND_LONG_OPTIONS | 217 | config FEATURE_EXPAND_LONG_OPTIONS |
218 | bool "Enable long options" | 218 | bool "Enable long options" |
219 | default n | 219 | default n |
220 | depends on EXPAND && GETOPT_LONG | 220 | depends on EXPAND && LONG_OPTS |
221 | help | 221 | help |
222 | Support long options for the expand applet. | 222 | Support long options for the expand applet. |
223 | 223 | ||
@@ -291,7 +291,7 @@ config INSTALL | |||
291 | config FEATURE_INSTALL_LONG_OPTIONS | 291 | config FEATURE_INSTALL_LONG_OPTIONS |
292 | bool "Enable long options" | 292 | bool "Enable long options" |
293 | default n | 293 | default n |
294 | depends on INSTALL && GETOPT_LONG | 294 | depends on INSTALL && LONG_OPTS |
295 | help | 295 | help |
296 | Support long options for the install applet. | 296 | Support long options for the install applet. |
297 | 297 | ||
@@ -364,7 +364,7 @@ config FEATURE_LS_USERNAME | |||
364 | config FEATURE_LS_COLOR | 364 | config FEATURE_LS_COLOR |
365 | bool "Allow use of color to identify file types" | 365 | bool "Allow use of color to identify file types" |
366 | default y | 366 | default y |
367 | depends on LS && GETOPT_LONG | 367 | depends on LS && LONG_OPTS |
368 | help | 368 | help |
369 | This enables the --color option to ls. | 369 | This enables the --color option to ls. |
370 | 370 | ||
@@ -394,7 +394,7 @@ config MKDIR | |||
394 | config FEATURE_MKDIR_LONG_OPTIONS | 394 | config FEATURE_MKDIR_LONG_OPTIONS |
395 | bool "Enable long options" | 395 | bool "Enable long options" |
396 | default n | 396 | default n |
397 | depends on MKDIR && GETOPT_LONG | 397 | depends on MKDIR && LONG_OPTS |
398 | help | 398 | help |
399 | Support long options for the mkdir applet. | 399 | Support long options for the mkdir applet. |
400 | 400 | ||
@@ -421,7 +421,7 @@ config MV | |||
421 | config FEATURE_MV_LONG_OPTIONS | 421 | config FEATURE_MV_LONG_OPTIONS |
422 | bool "Enable long options" | 422 | bool "Enable long options" |
423 | default n | 423 | default n |
424 | depends on MV && GETOPT_LONG | 424 | depends on MV && LONG_OPTS |
425 | help | 425 | help |
426 | Support long options for the mv applet. | 426 | Support long options for the mv applet. |
427 | 427 | ||
@@ -498,7 +498,7 @@ config RMDIR | |||
498 | config FEATURE_RMDIR_LONG_OPTIONS | 498 | config FEATURE_RMDIR_LONG_OPTIONS |
499 | bool "Enable long options" | 499 | bool "Enable long options" |
500 | default n | 500 | default n |
501 | depends on RMDIR && GETOPT_LONG | 501 | depends on RMDIR && LONG_OPTS |
502 | help | 502 | help |
503 | Support long options for the rmdir applet, including | 503 | Support long options for the rmdir applet, including |
504 | --ignore-fail-on-non-empty for compatibility with GNU rmdir. | 504 | --ignore-fail-on-non-empty for compatibility with GNU rmdir. |
@@ -732,7 +732,7 @@ config UNEXPAND | |||
732 | config FEATURE_UNEXPAND_LONG_OPTIONS | 732 | config FEATURE_UNEXPAND_LONG_OPTIONS |
733 | bool "Enable long options" | 733 | bool "Enable long options" |
734 | default n | 734 | default n |
735 | depends on UNEXPAND && GETOPT_LONG | 735 | depends on UNEXPAND && LONG_OPTS |
736 | help | 736 | help |
737 | Support long options for the unexpand applet. | 737 | Support long options for the unexpand applet. |
738 | 738 | ||
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index eb4579857..00efec51c 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -832,7 +832,7 @@ format_address_std(off_t address, char c) | |||
832 | printf(address_fmt, address); | 832 | printf(address_fmt, address); |
833 | } | 833 | } |
834 | 834 | ||
835 | #if ENABLE_GETOPT_LONG | 835 | #if ENABLE_LONG_OPTS |
836 | /* only used with --traditional */ | 836 | /* only used with --traditional */ |
837 | static void | 837 | static void |
838 | format_address_paren(off_t address, char c) | 838 | format_address_paren(off_t address, char c) |
@@ -953,7 +953,7 @@ get_lcm(void) | |||
953 | return l_c_m; | 953 | return l_c_m; |
954 | } | 954 | } |
955 | 955 | ||
956 | #if ENABLE_GETOPT_LONG | 956 | #if ENABLE_LONG_OPTS |
957 | /* If S is a valid traditional offset specification with an optional | 957 | /* If S is a valid traditional offset specification with an optional |
958 | leading '+' return nonzero and set *OFFSET to the offset it denotes. */ | 958 | leading '+' return nonzero and set *OFFSET to the offset it denotes. */ |
959 | 959 | ||
@@ -1199,9 +1199,9 @@ int od_main(int argc, char **argv) | |||
1199 | OPT_s = 1 << 15, | 1199 | OPT_s = 1 << 15, |
1200 | OPT_S = 1 << 16, | 1200 | OPT_S = 1 << 16, |
1201 | OPT_w = 1 << 17, | 1201 | OPT_w = 1 << 17, |
1202 | OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG, | 1202 | OPT_traditional = (1 << 18) * ENABLE_LONG_OPTS, |
1203 | }; | 1203 | }; |
1204 | #if ENABLE_GETOPT_LONG | 1204 | #if ENABLE_LONG_OPTS |
1205 | static const char od_longopts[] ALIGN1 = | 1205 | static const char od_longopts[] ALIGN1 = |
1206 | "skip-bytes\0" Required_argument "j" | 1206 | "skip-bytes\0" Required_argument "j" |
1207 | "address-radix\0" Required_argument "A" | 1207 | "address-radix\0" Required_argument "A" |
@@ -1235,7 +1235,7 @@ int od_main(int argc, char **argv) | |||
1235 | 1235 | ||
1236 | /* Parse command line */ | 1236 | /* Parse command line */ |
1237 | opt_complementary = "w+:t::"; /* -w N, -t is a list */ | 1237 | opt_complementary = "w+:t::"; /* -w N, -t is a list */ |
1238 | #if ENABLE_GETOPT_LONG | 1238 | #if ENABLE_LONG_OPTS |
1239 | applet_long_options = od_longopts; | 1239 | applet_long_options = od_longopts; |
1240 | #endif | 1240 | #endif |
1241 | opt = getopt32(argv, "A:N:abcdfhij:lot:vxsS:" | 1241 | opt = getopt32(argv, "A:N:abcdfhij:lot:vxsS:" |
@@ -1306,7 +1306,7 @@ int od_main(int argc, char **argv) | |||
1306 | * FIXME: POSIX 1003.1-2001 with XSI requires support for the | 1306 | * FIXME: POSIX 1003.1-2001 with XSI requires support for the |
1307 | * traditional syntax even if --traditional is not given. */ | 1307 | * traditional syntax even if --traditional is not given. */ |
1308 | 1308 | ||
1309 | #if ENABLE_GETOPT_LONG | 1309 | #if ENABLE_LONG_OPTS |
1310 | if (opt & OPT_traditional) { | 1310 | if (opt & OPT_traditional) { |
1311 | off_t o1, o2; | 1311 | off_t o1, o2; |
1312 | 1312 | ||
diff --git a/coreutils/touch.c b/coreutils/touch.c index 1d5541710..7d434a233 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -41,7 +41,7 @@ int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | |||
41 | int touch_main(int argc UNUSED_PARAM, char **argv) | 41 | int touch_main(int argc UNUSED_PARAM, char **argv) |
42 | { | 42 | { |
43 | #if ENABLE_DESKTOP | 43 | #if ENABLE_DESKTOP |
44 | #if ENABLE_GETOPT_LONG | 44 | #if ENABLE_LONG_OPTS |
45 | static const char longopts[] ALIGN1 = | 45 | static const char longopts[] ALIGN1 = |
46 | /* name, has_arg, val */ | 46 | /* name, has_arg, val */ |
47 | "no-create\0" No_argument "c" | 47 | "no-create\0" No_argument "c" |
@@ -59,7 +59,7 @@ int touch_main(int argc UNUSED_PARAM, char **argv) | |||
59 | int opts; | 59 | int opts; |
60 | 60 | ||
61 | #if ENABLE_DESKTOP | 61 | #if ENABLE_DESKTOP |
62 | #if ENABLE_GETOPT_LONG | 62 | #if ENABLE_LONG_OPTS |
63 | applet_long_options = longopts; | 63 | applet_long_options = longopts; |
64 | #endif | 64 | #endif |
65 | #endif | 65 | #endif |
diff --git a/coreutils/uname.c b/coreutils/uname.c index 5a790fb70..df4566063 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c | |||
@@ -73,7 +73,7 @@ static const unsigned short utsname_offset[] = { | |||
73 | int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 73 | int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
74 | int uname_main(int argc UNUSED_PARAM, char **argv) | 74 | int uname_main(int argc UNUSED_PARAM, char **argv) |
75 | { | 75 | { |
76 | #if ENABLE_GETOPT_LONG | 76 | #if ENABLE_LONG_OPTS |
77 | static const char longopts[] ALIGN1 = | 77 | static const char longopts[] ALIGN1 = |
78 | /* name, has_arg, val */ | 78 | /* name, has_arg, val */ |
79 | "all\0" No_argument "a" | 79 | "all\0" No_argument "a" |
@@ -97,7 +97,7 @@ int uname_main(int argc UNUSED_PARAM, char **argv) | |||
97 | const unsigned short *delta; | 97 | const unsigned short *delta; |
98 | unsigned toprint; | 98 | unsigned toprint; |
99 | 99 | ||
100 | IF_GETOPT_LONG(applet_long_options = longopts); | 100 | IF_LONG_OPTS(applet_long_options = longopts); |
101 | toprint = getopt32(argv, options); | 101 | toprint = getopt32(argv, options); |
102 | 102 | ||
103 | if (argv[optind]) { /* coreutils-6.9 compat */ | 103 | if (argv[optind]) { /* coreutils-6.9 compat */ |
diff --git a/debianutils/Config.in b/debianutils/Config.in index 8deb38f37..9146f3ef4 100644 --- a/debianutils/Config.in +++ b/debianutils/Config.in | |||
@@ -35,7 +35,7 @@ config RUN_PARTS | |||
35 | config FEATURE_RUN_PARTS_LONG_OPTIONS | 35 | config FEATURE_RUN_PARTS_LONG_OPTIONS |
36 | bool "Enable long options" | 36 | bool "Enable long options" |
37 | default n | 37 | default n |
38 | depends on RUN_PARTS && GETOPT_LONG | 38 | depends on RUN_PARTS && LONG_OPTS |
39 | help | 39 | help |
40 | Support long options for the run-parts applet. | 40 | Support long options for the run-parts applet. |
41 | 41 | ||
@@ -69,7 +69,7 @@ config FEATURE_START_STOP_DAEMON_FANCY | |||
69 | config FEATURE_START_STOP_DAEMON_LONG_OPTIONS | 69 | config FEATURE_START_STOP_DAEMON_LONG_OPTIONS |
70 | bool "Enable long options" | 70 | bool "Enable long options" |
71 | default n | 71 | default n |
72 | depends on START_STOP_DAEMON && GETOPT_LONG | 72 | depends on START_STOP_DAEMON && LONG_OPTS |
73 | help | 73 | help |
74 | Support long options for the start-stop-daemon applet. | 74 | Support long options for the start-stop-daemon applet. |
75 | 75 | ||
diff --git a/include/libbb.h b/include/libbb.h index 62a60f9f4..e1c36a57b 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -835,7 +835,7 @@ int sanitize_env_if_suid(void) FAST_FUNC; | |||
835 | 835 | ||
836 | extern const char *const bb_argv_dash[]; /* "-", NULL */ | 836 | extern const char *const bb_argv_dash[]; /* "-", NULL */ |
837 | extern const char *opt_complementary; | 837 | extern const char *opt_complementary; |
838 | #if ENABLE_GETOPT_LONG | 838 | #if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG |
839 | #define No_argument "\0" | 839 | #define No_argument "\0" |
840 | #define Required_argument "\001" | 840 | #define Required_argument "\001" |
841 | #define Optional_argument "\002" | 841 | #define Optional_argument "\002" |
diff --git a/include/usage.h b/include/usage.h index c6006aa65..ad6ee8319 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -610,13 +610,13 @@ | |||
610 | #define cryptpw_full_usage "\n\n" \ | 610 | #define cryptpw_full_usage "\n\n" \ |
611 | "Crypt the PASSWORD using crypt(3)\n" \ | 611 | "Crypt the PASSWORD using crypt(3)\n" \ |
612 | "\nOptions:" \ | 612 | "\nOptions:" \ |
613 | IF_GETOPT_LONG( \ | 613 | IF_LONG_OPTS( \ |
614 | "\n -P,--password-fd=NUM Read password from fd NUM" \ | 614 | "\n -P,--password-fd=NUM Read password from fd NUM" \ |
615 | /* "\n -s,--stdin Use stdin; like -P0" */ \ | 615 | /* "\n -s,--stdin Use stdin; like -P0" */ \ |
616 | "\n -m,--method=TYPE Encryption method TYPE" \ | 616 | "\n -m,--method=TYPE Encryption method TYPE" \ |
617 | "\n -S,--salt=SALT" \ | 617 | "\n -S,--salt=SALT" \ |
618 | ) \ | 618 | ) \ |
619 | IF_NOT_GETOPT_LONG( \ | 619 | IF_NOT_LONG_OPTS( \ |
620 | "\n -P NUM Read password from fd NUM" \ | 620 | "\n -P NUM Read password from fd NUM" \ |
621 | /* "\n -s Use stdin; like -P0" */ \ | 621 | /* "\n -s Use stdin; like -P0" */ \ |
622 | "\n -m TYPE Encryption method TYPE" \ | 622 | "\n -m TYPE Encryption method TYPE" \ |
@@ -631,13 +631,13 @@ | |||
631 | #define mkpasswd_full_usage "\n\n" \ | 631 | #define mkpasswd_full_usage "\n\n" \ |
632 | "Crypt the PASSWORD using crypt(3)\n" \ | 632 | "Crypt the PASSWORD using crypt(3)\n" \ |
633 | "\nOptions:" \ | 633 | "\nOptions:" \ |
634 | IF_GETOPT_LONG( \ | 634 | IF_LONG_OPTS( \ |
635 | "\n -P,--password-fd=NUM Read password from fd NUM" \ | 635 | "\n -P,--password-fd=NUM Read password from fd NUM" \ |
636 | /* "\n -s,--stdin Use stdin; like -P0" */ \ | 636 | /* "\n -s,--stdin Use stdin; like -P0" */ \ |
637 | "\n -m,--method=TYPE Encryption method TYPE" \ | 637 | "\n -m,--method=TYPE Encryption method TYPE" \ |
638 | "\n -S,--salt=SALT" \ | 638 | "\n -S,--salt=SALT" \ |
639 | ) \ | 639 | ) \ |
640 | IF_NOT_GETOPT_LONG( \ | 640 | IF_NOT_LONG_OPTS( \ |
641 | "\n -P NUM Read password from fd NUM" \ | 641 | "\n -P NUM Read password from fd NUM" \ |
642 | /* "\n -s Use stdin; like -P0" */ \ | 642 | /* "\n -s Use stdin; like -P0" */ \ |
643 | "\n -m TYPE Encryption method TYPE" \ | 643 | "\n -m TYPE Encryption method TYPE" \ |
@@ -969,12 +969,12 @@ | |||
969 | #define dumpleases_full_usage "\n\n" \ | 969 | #define dumpleases_full_usage "\n\n" \ |
970 | "Display DHCP leases granted by udhcpd\n" \ | 970 | "Display DHCP leases granted by udhcpd\n" \ |
971 | "\nOptions:" \ | 971 | "\nOptions:" \ |
972 | IF_GETOPT_LONG( \ | 972 | IF_LONG_OPTS( \ |
973 | "\n -f,--file=FILE Leases file to load" \ | 973 | "\n -f,--file=FILE Leases file to load" \ |
974 | "\n -r,--remaining Interpret lease times as time remaining" \ | 974 | "\n -r,--remaining Interpret lease times as time remaining" \ |
975 | "\n -a,--absolute Interpret lease times as expire time" \ | 975 | "\n -a,--absolute Interpret lease times as expire time" \ |
976 | ) \ | 976 | ) \ |
977 | IF_NOT_GETOPT_LONG( \ | 977 | IF_NOT_LONG_OPTS( \ |
978 | "\n -f FILE Leases file to load" \ | 978 | "\n -f FILE Leases file to load" \ |
979 | "\n -r Interpret lease times as time remaining" \ | 979 | "\n -r Interpret lease times as time remaining" \ |
980 | "\n -a Interpret lease times as expire time" \ | 980 | "\n -a Interpret lease times as expire time" \ |
@@ -1396,7 +1396,7 @@ | |||
1396 | "[OPTIONS]..." | 1396 | "[OPTIONS]..." |
1397 | #define getopt_full_usage "\n\n" \ | 1397 | #define getopt_full_usage "\n\n" \ |
1398 | "Parse command options\n" \ | 1398 | "Parse command options\n" \ |
1399 | IF_GETOPT_LONG( \ | 1399 | IF_LONG_OPTS( \ |
1400 | "\n -a,--alternative Allow long options starting with single -" \ | 1400 | "\n -a,--alternative Allow long options starting with single -" \ |
1401 | "\n -l,--longoptions=longopts Long options to be recognized" \ | 1401 | "\n -l,--longoptions=longopts Long options to be recognized" \ |
1402 | "\n -n,--name=progname The name under which errors are reported" \ | 1402 | "\n -n,--name=progname The name under which errors are reported" \ |
@@ -1407,7 +1407,7 @@ | |||
1407 | "\n -T,--test Test for getopt(1) version" \ | 1407 | "\n -T,--test Test for getopt(1) version" \ |
1408 | "\n -u,--unquoted Don't quote the output" \ | 1408 | "\n -u,--unquoted Don't quote the output" \ |
1409 | ) \ | 1409 | ) \ |
1410 | IF_NOT_GETOPT_LONG( \ | 1410 | IF_NOT_LONG_OPTS( \ |
1411 | "\n -a Allow long options starting with single -" \ | 1411 | "\n -a Allow long options starting with single -" \ |
1412 | "\n -l longopts Long options to be recognized" \ | 1412 | "\n -l longopts Long options to be recognized" \ |
1413 | "\n -n progname The name under which errors are reported" \ | 1413 | "\n -n progname The name under which errors are reported" \ |
@@ -3184,16 +3184,16 @@ | |||
3184 | "\n -u Unlock (re-enable) account" \ | 3184 | "\n -u Unlock (re-enable) account" \ |
3185 | 3185 | ||
3186 | #define chpasswd_trivial_usage \ | 3186 | #define chpasswd_trivial_usage \ |
3187 | IF_GETOPT_LONG("[--md5|--encrypted]") IF_NOT_GETOPT_LONG("[-m|-e]") | 3187 | IF_LONG_OPTS("[--md5|--encrypted]") IF_NOT_LONG_OPTS("[-m|-e]") |
3188 | #define chpasswd_full_usage "\n\n" \ | 3188 | #define chpasswd_full_usage "\n\n" \ |
3189 | "Read user:password information from stdin " \ | 3189 | "Read user:password information from stdin " \ |
3190 | "and update /etc/passwd accordingly.\n" \ | 3190 | "and update /etc/passwd accordingly.\n" \ |
3191 | "\nOptions:" \ | 3191 | "\nOptions:" \ |
3192 | IF_GETOPT_LONG( \ | 3192 | IF_LONG_OPTS( \ |
3193 | "\n -e,--encrypted Supplied passwords are in encrypted form" \ | 3193 | "\n -e,--encrypted Supplied passwords are in encrypted form" \ |
3194 | "\n -m,--md5 Use MD5 encryption instead of DES" \ | 3194 | "\n -m,--md5 Use MD5 encryption instead of DES" \ |
3195 | ) \ | 3195 | ) \ |
3196 | IF_NOT_GETOPT_LONG( \ | 3196 | IF_NOT_LONG_OPTS( \ |
3197 | "\n -e Supplied passwords are in encrypted form" \ | 3197 | "\n -e Supplied passwords are in encrypted form" \ |
3198 | "\n -m Use MD5 encryption instead of DES" \ | 3198 | "\n -m Use MD5 encryption instead of DES" \ |
3199 | ) | 3199 | ) |
@@ -3632,7 +3632,7 @@ | |||
3632 | "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" | 3632 | "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" |
3633 | #define rtcwake_full_usage "\n\n" \ | 3633 | #define rtcwake_full_usage "\n\n" \ |
3634 | "Enter a system sleep state until specified wakeup time\n" \ | 3634 | "Enter a system sleep state until specified wakeup time\n" \ |
3635 | IF_GETOPT_LONG( \ | 3635 | IF_LONG_OPTS( \ |
3636 | "\n -a,--auto Read clock mode from adjtime" \ | 3636 | "\n -a,--auto Read clock mode from adjtime" \ |
3637 | "\n -l,--local Clock is set to local time" \ | 3637 | "\n -l,--local Clock is set to local time" \ |
3638 | "\n -u,--utc Clock is set to UTC time" \ | 3638 | "\n -u,--utc Clock is set to UTC time" \ |
@@ -3641,7 +3641,7 @@ | |||
3641 | "\n -s,--seconds=SEC Set the timeout in SEC seconds from now" \ | 3641 | "\n -s,--seconds=SEC Set the timeout in SEC seconds from now" \ |
3642 | "\n -t,--time=TIME Set the timeout to TIME seconds from epoch" \ | 3642 | "\n -t,--time=TIME Set the timeout to TIME seconds from epoch" \ |
3643 | ) \ | 3643 | ) \ |
3644 | IF_NOT_GETOPT_LONG( \ | 3644 | IF_NOT_LONG_OPTS( \ |
3645 | "\n -a Read clock mode from adjtime" \ | 3645 | "\n -a Read clock mode from adjtime" \ |
3646 | "\n -l Clock is set to local time" \ | 3646 | "\n -l Clock is set to local time" \ |
3647 | "\n -u Clock is set to UTC time" \ | 3647 | "\n -u Clock is set to UTC time" \ |
@@ -4640,7 +4640,7 @@ IF_FEATURE_TUNCTL_UG( \ | |||
4640 | "[-Cfbnqtvo] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n" \ | 4640 | "[-Cfbnqtvo] [-c CID] [-V VCLS] [-H HOSTNAME] [-i INTERFACE]\n" \ |
4641 | " [-p pidfile] [-r IP] [-s script] [-O dhcp-option]..." IF_FEATURE_UDHCP_PORT(" [-P N]") | 4641 | " [-p pidfile] [-r IP] [-s script] [-O dhcp-option]..." IF_FEATURE_UDHCP_PORT(" [-P N]") |
4642 | #define udhcpc_full_usage "\n\n" \ | 4642 | #define udhcpc_full_usage "\n\n" \ |
4643 | IF_GETOPT_LONG( \ | 4643 | IF_LONG_OPTS( \ |
4644 | " -V,--vendorclass=CLASSID Vendor class identifier" \ | 4644 | " -V,--vendorclass=CLASSID Vendor class identifier" \ |
4645 | "\n -i,--interface=INTERFACE Interface to use (default eth0)" \ | 4645 | "\n -i,--interface=INTERFACE Interface to use (default eth0)" \ |
4646 | "\n -H,-h,--hostname=HOSTNAME Client hostname" \ | 4646 | "\n -H,-h,--hostname=HOSTNAME Client hostname" \ |
@@ -4669,7 +4669,7 @@ IF_FEATURE_TUNCTL_UG( \ | |||
4669 | "\n -a,--arping Use arping to validate offered address" \ | 4669 | "\n -a,--arping Use arping to validate offered address" \ |
4670 | ) \ | 4670 | ) \ |
4671 | ) \ | 4671 | ) \ |
4672 | IF_NOT_GETOPT_LONG( \ | 4672 | IF_NOT_LONG_OPTS( \ |
4673 | " -V CLASSID Vendor class identifier" \ | 4673 | " -V CLASSID Vendor class identifier" \ |
4674 | "\n -i INTERFACE Interface to use (default: eth0)" \ | 4674 | "\n -i INTERFACE Interface to use (default: eth0)" \ |
4675 | "\n -H,-h HOSTNAME Client hostname" \ | 4675 | "\n -H,-h HOSTNAME Client hostname" \ |
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index 1eb868c97..17b8dd1a4 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c | |||
@@ -314,7 +314,7 @@ typedef struct { | |||
314 | } t_complementary; | 314 | } t_complementary; |
315 | 315 | ||
316 | /* You can set applet_long_options for parse called long options */ | 316 | /* You can set applet_long_options for parse called long options */ |
317 | #if ENABLE_GETOPT_LONG | 317 | #if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG |
318 | static const struct option bb_null_long_options[1] = { | 318 | static const struct option bb_null_long_options[1] = { |
319 | { 0, 0, 0, 0 } | 319 | { 0, 0, 0, 0 } |
320 | }; | 320 | }; |
@@ -335,7 +335,7 @@ getopt32(char **argv, const char *applet_opts, ...) | |||
335 | const unsigned char *s; | 335 | const unsigned char *s; |
336 | t_complementary *on_off; | 336 | t_complementary *on_off; |
337 | va_list p; | 337 | va_list p; |
338 | #if ENABLE_GETOPT_LONG | 338 | #if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG |
339 | const struct option *l_o; | 339 | const struct option *l_o; |
340 | struct option *long_options = (struct option *) &bb_null_long_options; | 340 | struct option *long_options = (struct option *) &bb_null_long_options; |
341 | #endif | 341 | #endif |
@@ -384,7 +384,7 @@ getopt32(char **argv, const char *applet_opts, ...) | |||
384 | c++; | 384 | c++; |
385 | } | 385 | } |
386 | 386 | ||
387 | #if ENABLE_GETOPT_LONG | 387 | #if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG |
388 | if (applet_long_options) { | 388 | if (applet_long_options) { |
389 | const char *optstr; | 389 | const char *optstr; |
390 | unsigned i, count; | 390 | unsigned i, count; |
@@ -424,7 +424,7 @@ getopt32(char **argv, const char *applet_opts, ...) | |||
424 | next_long: ; | 424 | next_long: ; |
425 | } | 425 | } |
426 | } | 426 | } |
427 | #endif /* ENABLE_GETOPT_LONG */ | 427 | #endif /* ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG */ |
428 | for (s = (const unsigned char *)opt_complementary; s && *s; s++) { | 428 | for (s = (const unsigned char *)opt_complementary; s && *s; s++) { |
429 | t_complementary *pair; | 429 | t_complementary *pair; |
430 | unsigned *pair_switch; | 430 | unsigned *pair_switch; |
@@ -543,7 +543,7 @@ getopt32(char **argv, const char *applet_opts, ...) | |||
543 | * "fake" short options, like this one: | 543 | * "fake" short options, like this one: |
544 | * wget $'-\203' "Test: test" http://kernel.org/ | 544 | * wget $'-\203' "Test: test" http://kernel.org/ |
545 | * (supposed to act as --header, but doesn't) */ | 545 | * (supposed to act as --header, but doesn't) */ |
546 | #if ENABLE_GETOPT_LONG | 546 | #if ENABLE_LONG_OPTS || ENABLE_FEATURE_GETOPT_LONG |
547 | while ((c = getopt_long(argc, argv, applet_opts, | 547 | while ((c = getopt_long(argc, argv, applet_opts, |
548 | long_options, NULL)) != -1) { | 548 | long_options, NULL)) != -1) { |
549 | #else | 549 | #else |
diff --git a/loginutils/Config.in b/loginutils/Config.in index e11503665..f6c0e2e64 100644 --- a/loginutils/Config.in +++ b/loginutils/Config.in | |||
@@ -100,7 +100,7 @@ config ADDGROUP | |||
100 | config FEATURE_ADDGROUP_LONG_OPTIONS | 100 | config FEATURE_ADDGROUP_LONG_OPTIONS |
101 | bool "Enable long options" | 101 | bool "Enable long options" |
102 | default n | 102 | default n |
103 | depends on ADDGROUP && GETOPT_LONG | 103 | depends on ADDGROUP && LONG_OPTS |
104 | help | 104 | help |
105 | Support long options for the addgroup applet. | 105 | Support long options for the addgroup applet. |
106 | 106 | ||
@@ -148,7 +148,7 @@ config ADDUSER | |||
148 | config FEATURE_ADDUSER_LONG_OPTIONS | 148 | config FEATURE_ADDUSER_LONG_OPTIONS |
149 | bool "Enable long options" | 149 | bool "Enable long options" |
150 | default n | 150 | default n |
151 | depends on ADDUSER && GETOPT_LONG | 151 | depends on ADDUSER && LONG_OPTS |
152 | help | 152 | help |
153 | Support long options for the adduser applet. | 153 | Support long options for the adduser applet. |
154 | 154 | ||
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index 68b398068..181723169 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #include "libbb.h" | 8 | #include "libbb.h" |
9 | 9 | ||
10 | #if ENABLE_GETOPT_LONG | 10 | #if ENABLE_LONG_OPTS |
11 | static const char chpasswd_longopts[] ALIGN1 = | 11 | static const char chpasswd_longopts[] ALIGN1 = |
12 | "encrypted\0" No_argument "e" | 12 | "encrypted\0" No_argument "e" |
13 | "md5\0" No_argument "m" | 13 | "md5\0" No_argument "m" |
@@ -29,7 +29,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) | |||
29 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); | 29 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); |
30 | 30 | ||
31 | opt_complementary = "m--e:e--m"; | 31 | opt_complementary = "m--e:e--m"; |
32 | IF_GETOPT_LONG(applet_long_options = chpasswd_longopts;) | 32 | IF_LONG_OPTS(applet_long_options = chpasswd_longopts;) |
33 | opt = getopt32(argv, "em"); | 33 | opt = getopt32(argv, "em"); |
34 | 34 | ||
35 | while ((name = xmalloc_fgetline(stdin)) != NULL) { | 35 | while ((name = xmalloc_fgetline(stdin)) != NULL) { |
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c index 47212e18a..b44993f06 100644 --- a/loginutils/cryptpw.c +++ b/loginutils/cryptpw.c | |||
@@ -60,7 +60,7 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv) | |||
60 | int len; | 60 | int len; |
61 | int fd; | 61 | int fd; |
62 | 62 | ||
63 | #if ENABLE_GETOPT_LONG | 63 | #if ENABLE_LONG_OPTS |
64 | static const char mkpasswd_longopts[] ALIGN1 = | 64 | static const char mkpasswd_longopts[] ALIGN1 = |
65 | "stdin\0" No_argument "s" | 65 | "stdin\0" No_argument "s" |
66 | "password-fd\0" Required_argument "P" | 66 | "password-fd\0" Required_argument "P" |
diff --git a/networking/Config.in b/networking/Config.in index 861d96346..83522ffb1 100644 --- a/networking/Config.in +++ b/networking/Config.in | |||
@@ -132,7 +132,7 @@ config FTPPUT | |||
132 | config FEATURE_FTPGETPUT_LONG_OPTIONS | 132 | config FEATURE_FTPGETPUT_LONG_OPTIONS |
133 | bool "Enable long options in ftpget/ftpput" | 133 | bool "Enable long options in ftpget/ftpput" |
134 | default n | 134 | default n |
135 | depends on GETOPT_LONG && (FTPGET || FTPPUT) | 135 | depends on LONG_OPTS && (FTPGET || FTPPUT) |
136 | help | 136 | help |
137 | Support long options for the ftpget/ftpput applet. | 137 | Support long options for the ftpget/ftpput applet. |
138 | 138 | ||
@@ -578,7 +578,7 @@ config FEATURE_IPCALC_FANCY | |||
578 | config FEATURE_IPCALC_LONG_OPTIONS | 578 | config FEATURE_IPCALC_LONG_OPTIONS |
579 | bool "Enable long options" | 579 | bool "Enable long options" |
580 | default n | 580 | default n |
581 | depends on IPCALC && GETOPT_LONG | 581 | depends on IPCALC && LONG_OPTS |
582 | help | 582 | help |
583 | Support long options for the ipcalc applet. | 583 | Support long options for the ipcalc applet. |
584 | 584 | ||
@@ -910,7 +910,7 @@ config FEATURE_WGET_AUTHENTICATION | |||
910 | config FEATURE_WGET_LONG_OPTIONS | 910 | config FEATURE_WGET_LONG_OPTIONS |
911 | bool "Enable long options" | 911 | bool "Enable long options" |
912 | default n | 912 | default n |
913 | depends on WGET && GETOPT_LONG | 913 | depends on WGET && LONG_OPTS |
914 | help | 914 | help |
915 | Support long options for the wget applet. | 915 | Support long options for the wget applet. |
916 | 916 | ||
diff --git a/networking/ifenslave.c b/networking/ifenslave.c index fa226425a..16fcd54f1 100644 --- a/networking/ifenslave.c +++ b/networking/ifenslave.c | |||
@@ -457,7 +457,7 @@ int ifenslave_main(int argc UNUSED_PARAM, char **argv) | |||
457 | OPT_d = (1 << 1), | 457 | OPT_d = (1 << 1), |
458 | OPT_f = (1 << 2), | 458 | OPT_f = (1 << 2), |
459 | }; | 459 | }; |
460 | #if ENABLE_GETOPT_LONG | 460 | #if ENABLE_LONG_OPTS |
461 | static const char ifenslave_longopts[] ALIGN1 = | 461 | static const char ifenslave_longopts[] ALIGN1 = |
462 | "change-active\0" No_argument "c" | 462 | "change-active\0" No_argument "c" |
463 | "detach\0" No_argument "d" | 463 | "detach\0" No_argument "d" |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 2f8cee3b5..fca5c2a03 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -152,7 +152,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
152 | struct dhcp_packet packet; | 152 | struct dhcp_packet packet; |
153 | fd_set rfds; | 153 | fd_set rfds; |
154 | 154 | ||
155 | #if ENABLE_GETOPT_LONG | 155 | #if ENABLE_LONG_OPTS |
156 | static const char udhcpc_longopts[] ALIGN1 = | 156 | static const char udhcpc_longopts[] ALIGN1 = |
157 | "clientid\0" Required_argument "c" | 157 | "clientid\0" Required_argument "c" |
158 | "clientid-none\0" No_argument "C" | 158 | "clientid-none\0" No_argument "C" |
@@ -223,7 +223,7 @@ int udhcpc_main(int argc UNUSED_PARAM, char **argv) | |||
223 | ":vv" | 223 | ":vv" |
224 | #endif | 224 | #endif |
225 | ; | 225 | ; |
226 | IF_GETOPT_LONG(applet_long_options = udhcpc_longopts;) | 226 | IF_LONG_OPTS(applet_long_options = udhcpc_longopts;) |
227 | opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:SA:O:of" | 227 | opt = getopt32(argv, "c:CV:H:h:F:i:np:qRr:s:T:t:SA:O:of" |
228 | USE_FOR_MMU("b") | 228 | USE_FOR_MMU("b") |
229 | IF_FEATURE_UDHCPC_ARPING("a") | 229 | IF_FEATURE_UDHCPC_ARPING("a") |
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index d6176fb6b..cbf9f587a 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c | |||
@@ -33,7 +33,7 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv) | |||
33 | OPT_r = 0x2, // -r | 33 | OPT_r = 0x2, // -r |
34 | OPT_f = 0x4, // -f | 34 | OPT_f = 0x4, // -f |
35 | }; | 35 | }; |
36 | #if ENABLE_GETOPT_LONG | 36 | #if ENABLE_LONG_OPTS |
37 | static const char dumpleases_longopts[] ALIGN1 = | 37 | static const char dumpleases_longopts[] ALIGN1 = |
38 | "absolute\0" No_argument "a" | 38 | "absolute\0" No_argument "a" |
39 | "remaining\0" No_argument "r" | 39 | "remaining\0" No_argument "r" |
diff --git a/scripts/defconfig b/scripts/defconfig index a863ecad5..078b8641b 100644 --- a/scripts/defconfig +++ b/scripts/defconfig | |||
@@ -23,7 +23,7 @@ CONFIG_FEATURE_VERBOSE_USAGE=y | |||
23 | CONFIG_FEATURE_COMPRESS_USAGE=y | 23 | CONFIG_FEATURE_COMPRESS_USAGE=y |
24 | CONFIG_FEATURE_INSTALLER=y | 24 | CONFIG_FEATURE_INSTALLER=y |
25 | CONFIG_LOCALE_SUPPORT=y | 25 | CONFIG_LOCALE_SUPPORT=y |
26 | CONFIG_GETOPT_LONG=y | 26 | CONFIG_LONG_OPTS=y |
27 | CONFIG_FEATURE_DEVPTS=y | 27 | CONFIG_FEATURE_DEVPTS=y |
28 | # CONFIG_FEATURE_CLEAN_UP is not set | 28 | # CONFIG_FEATURE_CLEAN_UP is not set |
29 | CONFIG_FEATURE_PIDFILE=y | 29 | CONFIG_FEATURE_PIDFILE=y |
@@ -485,6 +485,7 @@ CONFIG_MKFS_MINIX=y | |||
485 | CONFIG_FEATURE_MINIX2=y | 485 | CONFIG_FEATURE_MINIX2=y |
486 | CONFIG_MKFS_VFAT=y | 486 | CONFIG_MKFS_VFAT=y |
487 | CONFIG_GETOPT=y | 487 | CONFIG_GETOPT=y |
488 | CONFIG_FEATURE_GETOPT_LONG=y | ||
488 | CONFIG_HEXDUMP=y | 489 | CONFIG_HEXDUMP=y |
489 | CONFIG_FEATURE_HEXDUMP_REVERSE=y | 490 | CONFIG_FEATURE_HEXDUMP_REVERSE=y |
490 | CONFIG_HD=y | 491 | CONFIG_HD=y |
diff --git a/selinux/Config.in b/selinux/Config.in index e795e73d0..e46030adf 100644 --- a/selinux/Config.in +++ b/selinux/Config.in | |||
@@ -16,7 +16,7 @@ config CHCON | |||
16 | config FEATURE_CHCON_LONG_OPTIONS | 16 | config FEATURE_CHCON_LONG_OPTIONS |
17 | bool "Enable long options" | 17 | bool "Enable long options" |
18 | default y | 18 | default y |
19 | depends on CHCON && GETOPT_LONG | 19 | depends on CHCON && LONG_OPTS |
20 | help | 20 | help |
21 | Support long options for the chcon applet. | 21 | Support long options for the chcon applet. |
22 | 22 | ||
@@ -67,7 +67,7 @@ config RUNCON | |||
67 | config FEATURE_RUNCON_LONG_OPTIONS | 67 | config FEATURE_RUNCON_LONG_OPTIONS |
68 | bool "Enable long options" | 68 | bool "Enable long options" |
69 | default y | 69 | default y |
70 | depends on RUNCON && GETOPT_LONG | 70 | depends on RUNCON && LONG_OPTS |
71 | help | 71 | help |
72 | Support long options for the runcon applet. | 72 | Support long options for the runcon applet. |
73 | 73 | ||
diff --git a/util-linux/Config.in b/util-linux/Config.in index 024550172..bfd51bc7b 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in | |||
@@ -250,6 +250,13 @@ config GETOPT | |||
250 | written by others, this utility may be for you. Most people will | 250 | written by others, this utility may be for you. Most people will |
251 | wisely leave this disabled. | 251 | wisely leave this disabled. |
252 | 252 | ||
253 | config FEATURE_GETOPT_LONG | ||
254 | bool "Support option -l" | ||
255 | default y if LONG_OPTS | ||
256 | help | ||
257 | Enable support for recognising long options using the -l option to | ||
258 | getopt. | ||
259 | |||
253 | config HEXDUMP | 260 | config HEXDUMP |
254 | bool "hexdump" | 261 | bool "hexdump" |
255 | default n | 262 | default n |
@@ -286,7 +293,7 @@ config HWCLOCK | |||
286 | config FEATURE_HWCLOCK_LONG_OPTIONS | 293 | config FEATURE_HWCLOCK_LONG_OPTIONS |
287 | bool "Support long options (--hctosys,...)" | 294 | bool "Support long options (--hctosys,...)" |
288 | default n | 295 | default n |
289 | depends on HWCLOCK && GETOPT_LONG | 296 | depends on HWCLOCK && LONG_OPTS |
290 | help | 297 | help |
291 | By default, the hwclock utility only uses short options. If you | 298 | By default, the hwclock utility only uses short options. If you |
292 | are overly fond of its long options, such as --hctosys, --utc, etc) | 299 | are overly fond of its long options, such as --hctosys, --utc, etc) |
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index fd6728731..adb96751f 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -38,7 +38,7 @@ | |||
38 | mode */ | 38 | mode */ |
39 | enum { | 39 | enum { |
40 | NON_OPT = 1, | 40 | NON_OPT = 1, |
41 | #if ENABLE_GETOPT_LONG | 41 | #if ENABLE_FEATURE_GETOPT_LONG |
42 | /* LONG_OPT is the code that is returned when a long option is found. */ | 42 | /* LONG_OPT is the code that is returned when a long option is found. */ |
43 | LONG_OPT = 2 | 43 | LONG_OPT = 2 |
44 | #endif | 44 | #endif |
@@ -53,7 +53,7 @@ enum { | |||
53 | OPT_s = 0x10, // -s | 53 | OPT_s = 0x10, // -s |
54 | OPT_T = 0x20, // -T | 54 | OPT_T = 0x20, // -T |
55 | OPT_u = 0x40, // -u | 55 | OPT_u = 0x40, // -u |
56 | #if ENABLE_GETOPT_LONG | 56 | #if ENABLE_FEATURE_GETOPT_LONG |
57 | OPT_a = 0x80, // -a | 57 | OPT_a = 0x80, // -a |
58 | OPT_l = 0x100, // -l | 58 | OPT_l = 0x100, // -l |
59 | #endif | 59 | #endif |
@@ -141,7 +141,7 @@ static const char *normalize(const char *arg) | |||
141 | * optstr must contain the short options, and longopts the long options. | 141 | * optstr must contain the short options, and longopts the long options. |
142 | * Other settings are found in global variables. | 142 | * Other settings are found in global variables. |
143 | */ | 143 | */ |
144 | #if !ENABLE_GETOPT_LONG | 144 | #if !ENABLE_FEATURE_GETOPT_LONG |
145 | #define generate_output(argv,argc,optstr,longopts) \ | 145 | #define generate_output(argv,argc,optstr,longopts) \ |
146 | generate_output(argv,argc,optstr) | 146 | generate_output(argv,argc,optstr) |
147 | #endif | 147 | #endif |
@@ -149,7 +149,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru | |||
149 | { | 149 | { |
150 | int exit_code = 0; /* We assume everything will be OK */ | 150 | int exit_code = 0; /* We assume everything will be OK */ |
151 | int opt; | 151 | int opt; |
152 | #if ENABLE_GETOPT_LONG | 152 | #if ENABLE_FEATURE_GETOPT_LONG |
153 | int longindex; | 153 | int longindex; |
154 | #endif | 154 | #endif |
155 | const char *charptr; | 155 | const char *charptr; |
@@ -168,7 +168,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru | |||
168 | 168 | ||
169 | while (1) { | 169 | while (1) { |
170 | opt = | 170 | opt = |
171 | #if ENABLE_GETOPT_LONG | 171 | #if ENABLE_FEATURE_GETOPT_LONG |
172 | alternative ? | 172 | alternative ? |
173 | getopt_long_only(argc, argv, optstr, longopts, &longindex) : | 173 | getopt_long_only(argc, argv, optstr, longopts, &longindex) : |
174 | getopt_long(argc, argv, optstr, longopts, &longindex); | 174 | getopt_long(argc, argv, optstr, longopts, &longindex); |
@@ -180,7 +180,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru | |||
180 | if (opt == '?' || opt == ':' ) | 180 | if (opt == '?' || opt == ':' ) |
181 | exit_code = 1; | 181 | exit_code = 1; |
182 | else if (!quiet_output) { | 182 | else if (!quiet_output) { |
183 | #if ENABLE_GETOPT_LONG | 183 | #if ENABLE_FEATURE_GETOPT_LONG |
184 | if (opt == LONG_OPT) { | 184 | if (opt == LONG_OPT) { |
185 | printf(" --%s", longopts[longindex].name); | 185 | printf(" --%s", longopts[longindex].name); |
186 | if (longopts[longindex].has_arg) | 186 | if (longopts[longindex].has_arg) |
@@ -209,7 +209,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru | |||
209 | return exit_code; | 209 | return exit_code; |
210 | } | 210 | } |
211 | 211 | ||
212 | #if ENABLE_GETOPT_LONG | 212 | #if ENABLE_FEATURE_GETOPT_LONG |
213 | /* | 213 | /* |
214 | * Register several long options. options is a string of long options, | 214 | * Register several long options. options is a string of long options, |
215 | * separated by commas or whitespace. | 215 | * separated by commas or whitespace. |
@@ -273,7 +273,7 @@ static void set_shell(const char *new_shell) | |||
273 | * 4) Returned for -T | 273 | * 4) Returned for -T |
274 | */ | 274 | */ |
275 | 275 | ||
276 | #if ENABLE_GETOPT_LONG | 276 | #if ENABLE_FEATURE_GETOPT_LONG |
277 | static const char getopt_longopts[] ALIGN1 = | 277 | static const char getopt_longopts[] ALIGN1 = |
278 | "options\0" Required_argument "o" | 278 | "options\0" Required_argument "o" |
279 | "longoptions\0" Required_argument "l" | 279 | "longoptions\0" Required_argument "l" |
@@ -295,7 +295,7 @@ int getopt_main(int argc, char **argv) | |||
295 | unsigned opt; | 295 | unsigned opt; |
296 | const char *compatible; | 296 | const char *compatible; |
297 | char *s_arg; | 297 | char *s_arg; |
298 | #if ENABLE_GETOPT_LONG | 298 | #if ENABLE_FEATURE_GETOPT_LONG |
299 | struct option *long_options = NULL; | 299 | struct option *long_options = NULL; |
300 | llist_t *l_arg = NULL; | 300 | llist_t *l_arg = NULL; |
301 | #endif | 301 | #endif |
@@ -321,7 +321,7 @@ int getopt_main(int argc, char **argv) | |||
321 | return generate_output(argv+1, argc-1, s, long_options); | 321 | return generate_output(argv+1, argc-1, s, long_options); |
322 | } | 322 | } |
323 | 323 | ||
324 | #if !ENABLE_GETOPT_LONG | 324 | #if !ENABLE_FEATURE_GETOPT_LONG |
325 | opt = getopt32(argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg); | 325 | opt = getopt32(argv, "+o:n:qQs:Tu", &optstr, &name, &s_arg); |
326 | #else | 326 | #else |
327 | applet_long_options = getopt_longopts; | 327 | applet_long_options = getopt_longopts; |
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c index 9a73ba29c..278acf347 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c | |||
@@ -114,7 +114,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) | |||
114 | int utc = -1; | 114 | int utc = -1; |
115 | int fd; | 115 | int fd; |
116 | 116 | ||
117 | #if ENABLE_GETOPT_LONG | 117 | #if ENABLE_LONG_OPTS |
118 | static const char rtcwake_longopts[] ALIGN1 = | 118 | static const char rtcwake_longopts[] ALIGN1 = |
119 | "auto\0" No_argument "a" | 119 | "auto\0" No_argument "a" |
120 | "local\0" No_argument "l" | 120 | "local\0" No_argument "l" |
diff --git a/util-linux/script.c b/util-linux/script.c index 2e2be33e7..d9a62fbfe 100644 --- a/util-linux/script.c +++ b/util-linux/script.c | |||
@@ -36,7 +36,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
36 | OPT_t = (1 << 4), | 36 | OPT_t = (1 << 4), |
37 | }; | 37 | }; |
38 | 38 | ||
39 | #if ENABLE_GETOPT_LONG | 39 | #if ENABLE_LONG_OPTS |
40 | static const char getopt_longopts[] ALIGN1 = | 40 | static const char getopt_longopts[] ALIGN1 = |
41 | "append\0" No_argument "a" | 41 | "append\0" No_argument "a" |
42 | "command\0" Required_argument "c" | 42 | "command\0" Required_argument "c" |