aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 20:19:22 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-26 20:19:22 +0000
commit01d23ade577b94a1ab1fde54f69a3ce5f7399f3c (patch)
tree4071ca983cbd5a3912501bd1467dc063b3592aa9
parentd29337580e6ad49ca3353a22b9099e9e47a4bd17 (diff)
downloadbusybox-w32-01d23ade577b94a1ab1fde54f69a3ce5f7399f3c.tar.gz
busybox-w32-01d23ade577b94a1ab1fde54f69a3ce5f7399f3c.tar.bz2
busybox-w32-01d23ade577b94a1ab1fde54f69a3ce5f7399f3c.zip
- add central knob to turn off getopt_long everywhere. EXPERIMENTAL!
Adds "Enable getopt long" under "General options", default y. Send patches to fix getopt_ulflags and run_parts.c if you turn this off.. See http://busybox.net/lists/busybox/2006-May/021828.html for a start to run-parts
-rw-r--r--Config.in15
-rw-r--r--Rules.mak6
-rw-r--r--archival/Config.in2
-rw-r--r--console-tools/Config.in7
-rw-r--r--console-tools/setconsole.c4
-rw-r--r--coreutils/Config.in30
-rw-r--r--coreutils/env.c5
-rw-r--r--coreutils/install.c4
-rw-r--r--coreutils/mkdir.c4
-rw-r--r--coreutils/mv.c4
-rw-r--r--debianutils/Config.in14
-rw-r--r--debianutils/start_stop_daemon.c5
-rw-r--r--miscutils/Config.in2
-rw-r--r--networking/Config.in14
-rw-r--r--networking/ftpgetput.c4
-rw-r--r--networking/ipcalc.c2
-rw-r--r--util-linux/Config.in4
-rw-r--r--util-linux/hwclock.c4
18 files changed, 118 insertions, 12 deletions
diff --git a/Config.in b/Config.in
index bd94f493c..b299ee730 100644
--- a/Config.in
+++ b/Config.in
@@ -80,6 +80,21 @@ config CONFIG_LOCALE_SUPPORT
80 Enable this if your system has locale support and you would like 80 Enable this if your system has locale support and you would like
81 busybox to support locale settings. 81 busybox to support locale settings.
82 82
83config CONFIG_GETOPT_LONG
84 bool "Enable getopt long (system needs struct option for this to work)"
85 default n
86 depends on !CONFIG_NO_GETOPT_LONG
87 help
88 EXPERIMENTAL!
89 Enable this if your system support long options for getopt and
90 you want to use them in busybox.
91
92# remove this comment to disable getopt_long per default.
93#config CONFIG_NO_GETOPT_LONG
94# bool
95# default y
96# depends on !CONFIG_GETOPT_LONG
97
83config CONFIG_FEATURE_DEVFS 98config CONFIG_FEATURE_DEVFS
84 bool "Use devfs names for devices" 99 bool "Use devfs names for devices"
85 default n 100 default n
diff --git a/Rules.mak b/Rules.mak
index cce41dcb9..8e03a0a12 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -308,9 +308,9 @@ ifeq ($(strip $(PREFIX)),)
308 PREFIX:=`pwd`/_install 308 PREFIX:=`pwd`/_install
309endif 309endif
310 310
311#ifneq ($(strip $(CONFIG_GETOPT_LONG)),y) 311ifneq ($(strip $(CONFIG_GETOPT_LONG)),y)
312# CFLAGS += -D__need_getopt 312 CFLAGS += -D__need_getopt
313#endif 313endif
314 314
315# Additional complications due to support for pristine source dir. 315# Additional complications due to support for pristine source dir.
316# Include files in the build directory should take precedence over 316# Include files in the build directory should take precedence over
diff --git a/archival/Config.in b/archival/Config.in
index be0dc7779..22e7ec458 100644
--- a/archival/Config.in
+++ b/archival/Config.in
@@ -209,7 +209,7 @@ config CONFIG_FEATURE_TAR_GNU_EXTENSIONS
209config CONFIG_FEATURE_TAR_LONG_OPTIONS 209config CONFIG_FEATURE_TAR_LONG_OPTIONS
210 bool "Enable long options" 210 bool "Enable long options"
211 default n 211 default n
212 depends on CONFIG_TAR 212 depends on CONFIG_TAR && CONFIG_GETOPT_LONG
213 help 213 help
214 Enable use of long options, increases size by about 400 Bytes 214 Enable use of long options, increases size by about 400 Bytes
215 215
diff --git a/console-tools/Config.in b/console-tools/Config.in
index 34e83e194..ec2273c35 100644
--- a/console-tools/Config.in
+++ b/console-tools/Config.in
@@ -65,6 +65,13 @@ config CONFIG_SETCONSOLE
65 This program redirects the system console to another device, 65 This program redirects the system console to another device,
66 like the current tty while logged in via telnet. 66 like the current tty while logged in via telnet.
67 67
68config CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS
69 bool "Enable long options"
70 default n
71 depends on CONFIG_SET_CONSOLE && CONFIG_GETOPT_LONG
72 help
73 Support long options for the setconsole applet.
74
68config CONFIG_SETKEYCODES 75config CONFIG_SETKEYCODES
69 bool "setkeycodes" 76 bool "setkeycodes"
70 default n 77 default n
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index bf06cc530..79a4313f0 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -16,10 +16,12 @@
16 16
17#include "busybox.h" 17#include "busybox.h"
18 18
19#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
19static const struct option setconsole_long_options[] = { 20static const struct option setconsole_long_options[] = {
20 { "reset", 0, NULL, 'r' }, 21 { "reset", 0, NULL, 'r' },
21 { 0, 0, 0, 0 } 22 { 0, 0, 0, 0 }
22}; 23};
24#endif
23 25
24#define OPT_SETCONS_RESET 1 26#define OPT_SETCONS_RESET 1
25 27
@@ -28,7 +30,9 @@ int setconsole_main(int argc, char **argv)
28 unsigned long flags; 30 unsigned long flags;
29 const char *device = CURRENT_TTY; 31 const char *device = CURRENT_TTY;
30 32
33#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
31 bb_applet_long_options = setconsole_long_options; 34 bb_applet_long_options = setconsole_long_options;
35#endif
32 flags = bb_getopt_ulflags(argc, argv, "r"); 36 flags = bb_getopt_ulflags(argc, argv, "r");
33 37
34 if (argc - optind > 1) 38 if (argc - optind > 1)
diff --git a/coreutils/Config.in b/coreutils/Config.in
index d7e31e868..818854cb1 100644
--- a/coreutils/Config.in
+++ b/coreutils/Config.in
@@ -232,6 +232,13 @@ config CONFIG_ENV
232 a command; without options it displays the current 232 a command; without options it displays the current
233 environment. 233 environment.
234 234
235config CONFIG_FEATURE_ENV_LONG_OPTIONS
236 bool "Enable long options"
237 default n
238 depends on CONFIG_ENV && CONFIG_GETOPT_LONG
239 help
240 Support long options for the env applet.
241
235config CONFIG_EXPR 242config CONFIG_EXPR
236 bool "expr" 243 bool "expr"
237 default n 244 default n
@@ -293,6 +300,13 @@ config CONFIG_INSTALL
293 help 300 help
294 Copy files and set attributes. 301 Copy files and set attributes.
295 302
303config CONFIG_FEATURE_INSTALL_LONG_OPTIONS
304 bool "Enable long options"
305 default n
306 depends on CONFIG_INSTALL && CONFIG_GETOPT_LONG
307 help
308 Support long options for the install applet.
309
296config CONFIG_LENGTH 310config CONFIG_LENGTH
297 bool "length" 311 bool "length"
298 default n 312 default n
@@ -362,7 +376,7 @@ config CONFIG_FEATURE_LS_USERNAME
362config CONFIG_FEATURE_LS_COLOR 376config CONFIG_FEATURE_LS_COLOR
363 bool "Allow use of color to identify file types" 377 bool "Allow use of color to identify file types"
364 default y 378 default y
365 depends on CONFIG_LS 379 depends on CONFIG_LS && CONFIG_GETOPT_LONG
366 help 380 help
367 This enables the --color option to ls. 381 This enables the --color option to ls.
368 382
@@ -389,6 +403,13 @@ config CONFIG_MKDIR
389 help 403 help
390 mkdir is used to create directories with the specified names. 404 mkdir is used to create directories with the specified names.
391 405
406config CONFIG_FEATURE_MKDIR_LONG_OPTIONS
407 bool "Enable long options"
408 default n
409 depends on CONFIG_MKDIR && CONFIG_GETOPT_LONG
410 help
411 Support long options for the mkdir applet.
412
392config CONFIG_MKFIFO 413config CONFIG_MKFIFO
393 bool "mkfifo" 414 bool "mkfifo"
394 default n 415 default n
@@ -409,6 +430,13 @@ config CONFIG_MV
409 help 430 help
410 mv is used to move or rename files or directories. 431 mv is used to move or rename files or directories.
411 432
433config CONFIG_FEATURE_MV_LONG_OPTIONS
434 bool "Enable long options"
435 default n
436 depends on CONFIG_MV && CONFIG_GETOPT_LONG
437 help
438 Support long options for the mv applet.
439
412config CONFIG_NICE 440config CONFIG_NICE
413 bool "nice" 441 bool "nice"
414 default n 442 default n
diff --git a/coreutils/env.c b/coreutils/env.c
index fd58a23da..a07c0c617 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -50,12 +50,13 @@
50#include <getopt.h> /* struct option */ 50#include <getopt.h> /* struct option */
51#include "busybox.h" 51#include "busybox.h"
52 52
53 53#if ENABLE_FEATURE_ENV_LONG_OPTIONS
54static const struct option env_long_options[] = { 54static const struct option env_long_options[] = {
55 { "ignore-environment", 0, NULL, 'i' }, 55 { "ignore-environment", 0, NULL, 'i' },
56 { "unset", 1, NULL, 'u' }, 56 { "unset", 1, NULL, 'u' },
57 { 0, 0, 0, 0 } 57 { 0, 0, 0, 0 }
58}; 58};
59#endif
59 60
60int env_main(int argc, char** argv) 61int env_main(int argc, char** argv)
61{ 62{
@@ -67,7 +68,9 @@ int env_main(int argc, char** argv)
67 extern char **environ; 68 extern char **environ;
68 69
69 bb_opt_complementally = "u::"; 70 bb_opt_complementally = "u::";
71#if ENABLE_FEATURE_ENV_LONG_OPTIONS
70 bb_applet_long_options = env_long_options; 72 bb_applet_long_options = env_long_options;
73#endif
71 74
72 opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env); 75 opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env);
73 76
diff --git a/coreutils/install.c b/coreutils/install.c
index 7739fb615..90b3ef31b 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -39,6 +39,7 @@
39#define INSTALL_OPT_MODE 32 39#define INSTALL_OPT_MODE 32
40#define INSTALL_OPT_OWNER 64 40#define INSTALL_OPT_OWNER 64
41 41
42#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
42static const struct option install_long_options[] = { 43static const struct option install_long_options[] = {
43 { "directory", 0, NULL, 'd' }, 44 { "directory", 0, NULL, 'd' },
44 { "preserve-timestamps", 0, NULL, 'p' }, 45 { "preserve-timestamps", 0, NULL, 'p' },
@@ -48,6 +49,7 @@ static const struct option install_long_options[] = {
48 { "owner", 0, NULL, 'o' }, 49 { "owner", 0, NULL, 'o' },
49 { 0, 0, 0, 0 } 50 { 0, 0, 0, 0 }
50}; 51};
52#endif
51 53
52int install_main(int argc, char **argv) 54int install_main(int argc, char **argv)
53{ 55{
@@ -60,7 +62,9 @@ int install_main(int argc, char **argv)
60 int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE; 62 int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE;
61 int ret = EXIT_SUCCESS, flags, i, isdir; 63 int ret = EXIT_SUCCESS, flags, i, isdir;
62 64
65#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
63 bb_applet_long_options = install_long_options; 66 bb_applet_long_options = install_long_options;
67#endif
64 bb_opt_complementally = "?:s--d:d--s"; 68 bb_opt_complementally = "?:s--d:d--s";
65 /* -c exists for backwards compatibility, its needed */ 69 /* -c exists for backwards compatibility, its needed */
66 flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */ 70 flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 48a95badb..47f4cc843 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -34,11 +34,13 @@
34#include <getopt.h> /* struct option */ 34#include <getopt.h> /* struct option */
35#include "busybox.h" 35#include "busybox.h"
36 36
37#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
37static const struct option mkdir_long_options[] = { 38static const struct option mkdir_long_options[] = {
38 { "mode", 1, NULL, 'm' }, 39 { "mode", 1, NULL, 'm' },
39 { "parents", 0, NULL, 'p' }, 40 { "parents", 0, NULL, 'p' },
40 { 0, 0, 0, 0 } 41 { 0, 0, 0, 0 }
41}; 42};
43#endif
42 44
43int mkdir_main (int argc, char **argv) 45int mkdir_main (int argc, char **argv)
44{ 46{
@@ -48,7 +50,9 @@ int mkdir_main (int argc, char **argv)
48 unsigned long opt; 50 unsigned long opt;
49 char *smode; 51 char *smode;
50 52
53#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
51 bb_applet_long_options = mkdir_long_options; 54 bb_applet_long_options = mkdir_long_options;
55#endif
52 opt = bb_getopt_ulflags(argc, argv, "m:p", &smode); 56 opt = bb_getopt_ulflags(argc, argv, "m:p", &smode);
53 if(opt & 1) { 57 if(opt & 1) {
54 mode = 0777; 58 mode = 0777;
diff --git a/coreutils/mv.c b/coreutils/mv.c
index 1c0dc3d72..02252c7ef 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -35,11 +35,13 @@
35#include "busybox.h" 35#include "busybox.h"
36#include "libcoreutils/coreutils.h" 36#include "libcoreutils/coreutils.h"
37 37
38#if ENABLE_FEATURE_MV_LONG_OPTIONS
38static const struct option mv_long_options[] = { 39static const struct option mv_long_options[] = {
39 { "interactive", 0, NULL, 'i' }, 40 { "interactive", 0, NULL, 'i' },
40 { "force", 0, NULL, 'f' }, 41 { "force", 0, NULL, 'f' },
41 { 0, 0, 0, 0 } 42 { 0, 0, 0, 0 }
42}; 43};
44#endif
43 45
44#define OPT_FILEUTILS_FORCE 1 46#define OPT_FILEUTILS_FORCE 1
45#define OPT_FILEUTILS_INTERACTIVE 2 47#define OPT_FILEUTILS_INTERACTIVE 2
@@ -55,7 +57,9 @@ int mv_main(int argc, char **argv)
55 int dest_exists; 57 int dest_exists;
56 int status = 0; 58 int status = 0;
57 59
60#if ENABLE_FEATURE_MV_LONG_OPTIONS
58 bb_applet_long_options = mv_long_options; 61 bb_applet_long_options = mv_long_options;
62#endif
59 bb_opt_complementally = "f-i:i-f"; 63 bb_opt_complementally = "f-i:i-f";
60 flags = bb_getopt_ulflags(argc, argv, "fi"); 64 flags = bb_getopt_ulflags(argc, argv, "fi");
61 if (optind + 2 > argc) { 65 if (optind + 2 > argc) {
diff --git a/debianutils/Config.in b/debianutils/Config.in
index 146a24e61..626272474 100644
--- a/debianutils/Config.in
+++ b/debianutils/Config.in
@@ -46,6 +46,13 @@ config CONFIG_RUN_PARTS
46 Unless you know that run-parts is used in some of your scripts 46 Unless you know that run-parts is used in some of your scripts
47 you can safely say N here. 47 you can safely say N here.
48 48
49config CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS
50 bool "Enable long options"
51 default n
52 depends on CONFIG_RUN_PARTS && CONFIG_GETOPT_LONG
53 help
54 Support long options for the run-parts applet.
55
49config CONFIG_START_STOP_DAEMON 56config CONFIG_START_STOP_DAEMON
50 bool "start-stop-daemon" 57 bool "start-stop-daemon"
51 default y 58 default y
@@ -54,6 +61,13 @@ config CONFIG_START_STOP_DAEMON
54 termination of system-level processes, usually the ones 61 termination of system-level processes, usually the ones
55 started during the startup of the system. 62 started during the startup of the system.
56 63
64config CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
65 bool "Enable long options"
66 default n
67 depends on CONFIG_START_STOP_DAEMON && CONFIG_GETOPT_LONG
68 help
69 Support long options for the start-stop-daemon applet.
70
57config CONFIG_WHICH 71config CONFIG_WHICH
58 bool "which" 72 bool "which"
59 default n 73 default n
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index b44a23b4b..5c596c40a 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -200,7 +200,7 @@ do_stop(void)
200 } 200 }
201} 201}
202 202
203 203#if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
204static const struct option ssd_long_options[] = { 204static const struct option ssd_long_options[] = {
205 { "stop", 0, NULL, 'K' }, 205 { "stop", 0, NULL, 'K' },
206 { "start", 0, NULL, 'S' }, 206 { "start", 0, NULL, 'S' },
@@ -215,6 +215,7 @@ static const struct option ssd_long_options[] = {
215 { "pidfile", 1, NULL, 'p' }, 215 { "pidfile", 1, NULL, 'p' },
216 { 0, 0, 0, 0 } 216 { 0, 0, 0, 0 }
217}; 217};
218#endif
218 219
219#define SSD_CTX_STOP 1 220#define SSD_CTX_STOP 1
220#define SSD_CTX_START 2 221#define SSD_CTX_START 2
@@ -229,7 +230,9 @@ start_stop_daemon_main(int argc, char **argv)
229 char *signame = NULL; 230 char *signame = NULL;
230 char *startas = NULL; 231 char *startas = NULL;
231 232
233#if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
232 bb_applet_long_options = ssd_long_options; 234 bb_applet_long_options = ssd_long_options;
235#endif
233 236
234 /* Check required one context option was given */ 237 /* Check required one context option was given */
235 bb_opt_complementally = "K:S:?:K--S:S--K"; 238 bb_opt_complementally = "K:S:?:K--S:S--K";
diff --git a/miscutils/Config.in b/miscutils/Config.in
index 637d4b9c2..eae977fac 100644
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
@@ -169,7 +169,7 @@ config CONFIG_HDPARM
169config CONFIG_FEATURE_HDPARM_GET_IDENTITY 169config CONFIG_FEATURE_HDPARM_GET_IDENTITY
170 bool "Support obtaining detailed information directly from drives" 170 bool "Support obtaining detailed information directly from drives"
171 default y 171 default y
172 depends on CONFIG_HDPARM 172 depends on CONFIG_HDPARM && CONFIG_GETOPT_LONG
173 help 173 help
174 Enables the -I and -Istdin options to obtain detailed information 174 Enables the -I and -Istdin options to obtain detailed information
175 directly from drives about their capabilities and supported ATA 175 directly from drives about their capabilities and supported ATA
diff --git a/networking/Config.in b/networking/Config.in
index e76002c0d..c718af0e9 100644
--- a/networking/Config.in
+++ b/networking/Config.in
@@ -49,6 +49,13 @@ config CONFIG_FTPPUT
49 help 49 help
50 Store a remote file via FTP. 50 Store a remote file via FTP.
51 51
52config CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS
53 bool "Enable long options in ftpget/ftpput"
54 default n
55 depends on CONFIG_GETOPT_LONG && (CONFIG_FTPGET || CONFIG_FTPPUT)
56 help
57 Support long options for the ftpget/ftpput applet.
58
52config CONFIG_HOSTNAME 59config CONFIG_HOSTNAME
53 bool "hostname" 60 bool "hostname"
54 default n 61 default n
@@ -411,6 +418,13 @@ config CONFIG_FEATURE_IPCALC_FANCY
411 help 418 help
412 Adds the options hostname, prefix and silent to the output of "ipcalc". 419 Adds the options hostname, prefix and silent to the output of "ipcalc".
413 420
421config CONFIG_FEATURE_IPCALC_LONG_OPTIONS
422 bool "Enable long options"
423 default n
424 depends on CONFIG_IPCALC && CONFIG_GETOPT_LONG
425 help
426 Support long options for the ipcalc applet.
427
414config CONFIG_NAMEIF 428config CONFIG_NAMEIF
415 bool "nameif" 429 bool "nameif"
416 default n 430 default n
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 40e1328a9..a401ec50a 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -278,6 +278,7 @@ static int ftp_send(ftp_host_info_t *server, FILE *control_stream,
278#define FTPGETPUT_OPT_PASSWORD 8 278#define FTPGETPUT_OPT_PASSWORD 8
279#define FTPGETPUT_OPT_PORT 16 279#define FTPGETPUT_OPT_PORT 16
280 280
281#if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
281static const struct option ftpgetput_long_options[] = { 282static const struct option ftpgetput_long_options[] = {
282 {"continue", 1, NULL, 'c'}, 283 {"continue", 1, NULL, 'c'},
283 {"verbose", 0, NULL, 'v'}, 284 {"verbose", 0, NULL, 'v'},
@@ -286,6 +287,7 @@ static const struct option ftpgetput_long_options[] = {
286 {"port", 1, NULL, 'P'}, 287 {"port", 1, NULL, 'P'},
287 {0, 0, 0, 0} 288 {0, 0, 0, 0}
288}; 289};
290#endif
289 291
290int ftpgetput_main(int argc, char **argv) 292int ftpgetput_main(int argc, char **argv)
291{ 293{
@@ -319,7 +321,9 @@ int ftpgetput_main(int argc, char **argv)
319 /* 321 /*
320 * Decipher the command line 322 * Decipher the command line
321 */ 323 */
324#if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
322 bb_applet_long_options = ftpgetput_long_options; 325 bb_applet_long_options = ftpgetput_long_options;
326#endif
323 opt = bb_getopt_ulflags(argc, argv, "cvu:p:P:", &server->user, &server->password, &port); 327 opt = bb_getopt_ulflags(argc, argv, "cvu:p:P:", &server->user, &server->password, &port);
324 328
325 /* Process the non-option command line arguments */ 329 /* Process the non-option command line arguments */
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index a24629a9d..ade4ed101 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -82,6 +82,7 @@ int ipcalc_main(int argc, char **argv)
82 char *ipstr, *prefixstr; 82 char *ipstr, *prefixstr;
83#endif 83#endif
84 84
85#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
85 static const struct option long_options[] = { 86 static const struct option long_options[] = {
86 {"netmask", no_argument, NULL, 'm'}, 87 {"netmask", no_argument, NULL, 'm'},
87 {"broadcast", no_argument, NULL, 'b'}, 88 {"broadcast", no_argument, NULL, 'b'},
@@ -95,6 +96,7 @@ int ipcalc_main(int argc, char **argv)
95 }; 96 };
96 97
97 bb_applet_long_options = long_options; 98 bb_applet_long_options = long_options;
99#endif
98 mode = bb_getopt_ulflags(argc, argv, 100 mode = bb_getopt_ulflags(argc, argv,
99#ifdef CONFIG_FEATURE_IPCALC_FANCY 101#ifdef CONFIG_FEATURE_IPCALC_FANCY
100 "mbnphs" 102 "mbnphs"
diff --git a/util-linux/Config.in b/util-linux/Config.in
index 6bc366531..a493fbfb4 100644
--- a/util-linux/Config.in
+++ b/util-linux/Config.in
@@ -199,10 +199,10 @@ config CONFIG_HWCLOCK
199 shutdown in the hardware clock, so the hardware will keep the 199 shutdown in the hardware clock, so the hardware will keep the
200 correct time when Linux is _not_ running. 200 correct time when Linux is _not_ running.
201 201
202config CONFIG_FEATURE_HWCLOCK_LONGOPTIONS 202config CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS
203 bool "Support long options (--hctosys,...)" 203 bool "Support long options (--hctosys,...)"
204 default n 204 default n
205 depends on CONFIG_HWCLOCK 205 depends on CONFIG_HWCLOCK && CONFIG_GETOPT_LONG
206 help 206 help
207 By default, the hwclock utility only uses short options. If you 207 By default, the hwclock utility only uses short options. If you
208 are overly fond of its long options, such as --hctosys, --utc, etc) 208 are overly fond of its long options, such as --hctosys, --utc, etc)
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 2fe57b2fc..3d7f40026 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -37,7 +37,7 @@ struct linux_rtc_time {
37#define RTC_SET_TIME _IOW('p', 0x0a, struct linux_rtc_time) /* Set RTC time */ 37#define RTC_SET_TIME _IOW('p', 0x0a, struct linux_rtc_time) /* Set RTC time */
38#define RTC_RD_TIME _IOR('p', 0x09, struct linux_rtc_time) /* Read RTC time */ 38#define RTC_RD_TIME _IOR('p', 0x09, struct linux_rtc_time) /* Read RTC time */
39 39
40#ifdef CONFIG_FEATURE_HWCLOCK_LONGOPTIONS 40#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
41# ifndef _GNU_SOURCE 41# ifndef _GNU_SOURCE
42# define _GNU_SOURCE 42# define _GNU_SOURCE
43# endif 43# endif
@@ -186,7 +186,7 @@ int hwclock_main ( int argc, char **argv )
186 unsigned long opt; 186 unsigned long opt;
187 int utc; 187 int utc;
188 188
189#ifdef CONFIG_FEATURE_HWCLOCK_LONGOPTIONS 189#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
190static const struct option hwclock_long_options[] = { 190static const struct option hwclock_long_options[] = {
191 { "localtime", 0, 0, 'l' }, 191 { "localtime", 0, 0, 'l' },
192 { "utc", 0, 0, 'u' }, 192 { "utc", 0, 0, 'u' },