svn commit: trunk/busybox: archival console-tools coreutils debian etc...

aldot at busybox.net aldot at busybox.net
Fri May 26 20:19:25 UTC 2006


Author: aldot
Date: 2006-05-26 13:19:22 -0700 (Fri, 26 May 2006)
New Revision: 15195

Log:
- 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


Modified:
   trunk/busybox/Config.in
   trunk/busybox/Rules.mak
   trunk/busybox/archival/Config.in
   trunk/busybox/console-tools/Config.in
   trunk/busybox/console-tools/setconsole.c
   trunk/busybox/coreutils/Config.in
   trunk/busybox/coreutils/env.c
   trunk/busybox/coreutils/install.c
   trunk/busybox/coreutils/mkdir.c
   trunk/busybox/coreutils/mv.c
   trunk/busybox/debianutils/Config.in
   trunk/busybox/debianutils/start_stop_daemon.c
   trunk/busybox/miscutils/Config.in
   trunk/busybox/networking/Config.in
   trunk/busybox/networking/ftpgetput.c
   trunk/busybox/networking/ipcalc.c
   trunk/busybox/util-linux/Config.in
   trunk/busybox/util-linux/hwclock.c


Changeset:
Modified: trunk/busybox/Config.in
===================================================================
--- trunk/busybox/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -80,6 +80,21 @@
 	  Enable this if your system has locale support and you would like
 	  busybox to support locale settings.
 
+config CONFIG_GETOPT_LONG
+	bool "Enable getopt long (system needs struct option for this to work)"
+	default n
+	depends on !CONFIG_NO_GETOPT_LONG
+	help
+	  EXPERIMENTAL!
+	  Enable this if your system support long options for getopt and
+	  you want to use them in busybox.
+
+# remove this comment to disable getopt_long per default.
+#config CONFIG_NO_GETOPT_LONG
+#	bool
+#	default y
+#	depends on !CONFIG_GETOPT_LONG
+
 config CONFIG_FEATURE_DEVFS
 	bool "Use devfs names for devices"
 	default n

Modified: trunk/busybox/Rules.mak
===================================================================
--- trunk/busybox/Rules.mak	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/Rules.mak	2006-05-26 20:19:22 UTC (rev 15195)
@@ -308,9 +308,9 @@
     PREFIX:=`pwd`/_install
 endif
 
-#ifneq ($(strip $(CONFIG_GETOPT_LONG)),y)
-#    CFLAGS += -D__need_getopt
-#endif
+ifneq ($(strip $(CONFIG_GETOPT_LONG)),y)
+    CFLAGS += -D__need_getopt
+endif
 
 # Additional complications due to support for pristine source dir.
 # Include files in the build directory should take precedence over

Modified: trunk/busybox/archival/Config.in
===================================================================
--- trunk/busybox/archival/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/archival/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -209,7 +209,7 @@
 config CONFIG_FEATURE_TAR_LONG_OPTIONS
 	bool "Enable long options"
 	default n
-	depends on CONFIG_TAR
+	depends on CONFIG_TAR && CONFIG_GETOPT_LONG
 	help
 		Enable use of long options, increases size by about 400 Bytes
 

Modified: trunk/busybox/console-tools/Config.in
===================================================================
--- trunk/busybox/console-tools/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/console-tools/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -65,6 +65,13 @@
 	  This program redirects the system console to another device,
 	  like the current tty while logged in via telnet.
 
+config CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_SET_CONSOLE && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the setconsole applet.
+
 config CONFIG_SETKEYCODES
 	bool "setkeycodes"
 	default n

Modified: trunk/busybox/console-tools/setconsole.c
===================================================================
--- trunk/busybox/console-tools/setconsole.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/console-tools/setconsole.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -16,10 +16,12 @@
 
 #include "busybox.h"
 
+#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
 static const struct option setconsole_long_options[] = {
 	{ "reset", 0, NULL, 'r' },
 	{ 0, 0, 0, 0 }
 };
+#endif
 
 #define OPT_SETCONS_RESET 1
 
@@ -28,7 +30,9 @@
 	unsigned long flags;
 	const char *device = CURRENT_TTY;
 
+#if ENABLE_FEATURE_SETCONSOLE_LONG_OPTIONS
 	bb_applet_long_options = setconsole_long_options;
+#endif
 	flags = bb_getopt_ulflags(argc, argv, "r");
 
 	if (argc - optind > 1)

Modified: trunk/busybox/coreutils/Config.in
===================================================================
--- trunk/busybox/coreutils/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/coreutils/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -232,6 +232,13 @@
 	  a command; without options it displays the current
 	  environment.
 
+config CONFIG_FEATURE_ENV_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_ENV && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the env applet.
+
 config CONFIG_EXPR
 	bool "expr"
 	default n
@@ -293,6 +300,13 @@
 	help
 	  Copy files and set attributes.
 
+config CONFIG_FEATURE_INSTALL_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_INSTALL && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the install applet.
+
 config CONFIG_LENGTH
 	bool "length"
 	default n
@@ -362,7 +376,7 @@
 config CONFIG_FEATURE_LS_COLOR
 	bool "Allow use of color to identify file types"
 	default y
-	depends on CONFIG_LS
+	depends on CONFIG_LS && CONFIG_GETOPT_LONG
 	help
 	  This enables the --color option to ls.
 
@@ -389,6 +403,13 @@
 	help
 	  mkdir is used to create directories with the specified names.
 
+config CONFIG_FEATURE_MKDIR_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_MKDIR && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the mkdir applet.
+
 config CONFIG_MKFIFO
 	bool "mkfifo"
 	default n
@@ -409,6 +430,13 @@
 	help
 	  mv is used to move or rename files or directories.
 
+config CONFIG_FEATURE_MV_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_MV && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the mv applet.
+
 config CONFIG_NICE
 	bool "nice"
 	default n

Modified: trunk/busybox/coreutils/env.c
===================================================================
--- trunk/busybox/coreutils/env.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/coreutils/env.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -50,12 +50,13 @@
 #include <getopt.h> /* struct option */
 #include "busybox.h"
 
-
+#if ENABLE_FEATURE_ENV_LONG_OPTIONS
 static const struct option env_long_options[] = {
 	{ "ignore-environment", 0, NULL, 'i' },
 	{ "unset", 1, NULL, 'u' },
 	{ 0, 0, 0, 0 }
 };
+#endif
 
 int env_main(int argc, char** argv)
 {
@@ -67,7 +68,9 @@
 	extern char **environ;
 
 	bb_opt_complementally = "u::";
+#if ENABLE_FEATURE_ENV_LONG_OPTIONS
 	bb_applet_long_options = env_long_options;
+#endif
 
 	opt = bb_getopt_ulflags(argc, argv, "+iu:", &unset_env);
 

Modified: trunk/busybox/coreutils/install.c
===================================================================
--- trunk/busybox/coreutils/install.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/coreutils/install.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -39,6 +39,7 @@
 #define INSTALL_OPT_MODE  32
 #define INSTALL_OPT_OWNER  64
 
+#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
 static const struct option install_long_options[] = {
 	{ "directory",	0,	NULL,	'd' },
 	{ "preserve-timestamps",	0,	NULL,	'p' },
@@ -48,6 +49,7 @@
 	{ "owner",	0,	NULL,	'o' },
 	{ 0,	0,	0,	0 }
 };
+#endif
 
 int install_main(int argc, char **argv)
 {
@@ -60,7 +62,9 @@
 	int copy_flags = FILEUTILS_DEREFERENCE | FILEUTILS_FORCE;
 	int ret = EXIT_SUCCESS, flags, i, isdir;
 
+#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
 	bb_applet_long_options = install_long_options;
+#endif
 	bb_opt_complementally = "?:s--d:d--s";
 	/* -c exists for backwards compatibility, its needed */
 	flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str);	/* 'a' must be 2nd */

Modified: trunk/busybox/coreutils/mkdir.c
===================================================================
--- trunk/busybox/coreutils/mkdir.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/coreutils/mkdir.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -34,11 +34,13 @@
 #include <getopt.h> /* struct option */
 #include "busybox.h"
 
+#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
 static const struct option mkdir_long_options[] = {
 	{ "mode", 1, NULL, 'm' },
 	{ "parents", 0, NULL, 'p' },
 	{ 0, 0, 0, 0 }
 };
+#endif
 
 int mkdir_main (int argc, char **argv)
 {
@@ -48,7 +50,9 @@
 	unsigned long opt;
 	char *smode;
 
+#if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
 	bb_applet_long_options = mkdir_long_options;
+#endif
 	opt = bb_getopt_ulflags(argc, argv, "m:p", &smode);
 	if(opt & 1) {
 			mode = 0777;

Modified: trunk/busybox/coreutils/mv.c
===================================================================
--- trunk/busybox/coreutils/mv.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/coreutils/mv.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -35,11 +35,13 @@
 #include "busybox.h"
 #include "libcoreutils/coreutils.h"
 
+#if ENABLE_FEATURE_MV_LONG_OPTIONS
 static const struct option mv_long_options[] = {
 	{ "interactive", 0, NULL, 'i' },
 	{ "force", 0, NULL, 'f' },
 	{ 0, 0, 0, 0 }
 };
+#endif
 
 #define OPT_FILEUTILS_FORCE       1
 #define OPT_FILEUTILS_INTERACTIVE 2
@@ -55,7 +57,9 @@
 	int dest_exists;
 	int status = 0;
 
+#if ENABLE_FEATURE_MV_LONG_OPTIONS
 	bb_applet_long_options = mv_long_options;
+#endif
 	bb_opt_complementally = "f-i:i-f";
 	flags = bb_getopt_ulflags(argc, argv, "fi");
 	if (optind + 2 > argc) {

Modified: trunk/busybox/debianutils/Config.in
===================================================================
--- trunk/busybox/debianutils/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/debianutils/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -46,6 +46,13 @@
 	  Unless you know that run-parts is used in some of your scripts
 	  you can safely say N here.
 
+config CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_RUN_PARTS && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the run-parts applet.
+
 config CONFIG_START_STOP_DAEMON
 	bool "start-stop-daemon"
 	default y
@@ -54,6 +61,13 @@
 	  termination of system-level processes, usually the ones
 	  started during the startup of the system.
 
+config CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_START_STOP_DAEMON && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the start-stop-daemon applet.
+
 config CONFIG_WHICH
 	bool "which"
 	default n

Modified: trunk/busybox/debianutils/start_stop_daemon.c
===================================================================
--- trunk/busybox/debianutils/start_stop_daemon.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/debianutils/start_stop_daemon.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -200,7 +200,7 @@
 	}
 }
 
-
+#if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
 static const struct option ssd_long_options[] = {
 	{ "stop",			0,		NULL,		'K' },
 	{ "start",			0,		NULL,		'S' },
@@ -215,6 +215,7 @@
 	{ "pidfile",			1,		NULL,		'p' },
 	{ 0,				0,		0,		0 }
 };
+#endif
 
 #define SSD_CTX_STOP		1
 #define SSD_CTX_START		2
@@ -229,7 +230,9 @@
 	char *signame = NULL;
 	char *startas = NULL;
 
+#if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
 	bb_applet_long_options = ssd_long_options;
+#endif
 
 	/* Check required one context option was given */
 	bb_opt_complementally = "K:S:?:K--S:S--K";

Modified: trunk/busybox/miscutils/Config.in
===================================================================
--- trunk/busybox/miscutils/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/miscutils/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -169,7 +169,7 @@
 config CONFIG_FEATURE_HDPARM_GET_IDENTITY
 	bool "Support obtaining detailed information directly from drives"
 	default y
-	depends on CONFIG_HDPARM
+	depends on CONFIG_HDPARM && CONFIG_GETOPT_LONG
 	help
 	  Enables the -I and -Istdin options to obtain detailed information
 	  directly from drives about their capabilities and supported ATA

Modified: trunk/busybox/networking/Config.in
===================================================================
--- trunk/busybox/networking/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/networking/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -49,6 +49,13 @@
 	help
 	  Store a remote file via FTP.
 
+config CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS
+	bool "Enable long options in ftpget/ftpput"
+	default n
+	depends on CONFIG_GETOPT_LONG && (CONFIG_FTPGET || CONFIG_FTPPUT)
+	help
+	  Support long options for the ftpget/ftpput applet.
+
 config CONFIG_HOSTNAME
 	bool "hostname"
 	default n
@@ -411,6 +418,13 @@
 	help
 	  Adds the options hostname, prefix and silent to the output of "ipcalc".
 
+config CONFIG_FEATURE_IPCALC_LONG_OPTIONS
+	bool "Enable long options"
+	default n
+	depends on CONFIG_IPCALC && CONFIG_GETOPT_LONG
+	help
+	  Support long options for the ipcalc applet.
+
 config CONFIG_NAMEIF
 	bool "nameif"
 	default n

Modified: trunk/busybox/networking/ftpgetput.c
===================================================================
--- trunk/busybox/networking/ftpgetput.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/networking/ftpgetput.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -278,6 +278,7 @@
 #define FTPGETPUT_OPT_PASSWORD	8
 #define FTPGETPUT_OPT_PORT	16
 
+#if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
 static const struct option ftpgetput_long_options[] = {
 	{"continue", 1, NULL, 'c'},
 	{"verbose", 0, NULL, 'v'},
@@ -286,6 +287,7 @@
 	{"port", 1, NULL, 'P'},
 	{0, 0, 0, 0}
 };
+#endif
 
 int ftpgetput_main(int argc, char **argv)
 {
@@ -319,7 +321,9 @@
 	/*
 	 * Decipher the command line
 	 */
+#if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
 	bb_applet_long_options = ftpgetput_long_options;
+#endif
 	opt = bb_getopt_ulflags(argc, argv, "cvu:p:P:", &server->user, &server->password, &port);
 
 	/* Process the non-option command line arguments */

Modified: trunk/busybox/networking/ipcalc.c
===================================================================
--- trunk/busybox/networking/ipcalc.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/networking/ipcalc.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -82,6 +82,7 @@
 	char *ipstr, *prefixstr;
 #endif
 
+#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
 	static const struct option long_options[] = {
 		{"netmask",		no_argument, NULL, 'm'},
 		{"broadcast",	no_argument, NULL, 'b'},
@@ -95,6 +96,7 @@
 	};
 
 	bb_applet_long_options = long_options;
+#endif
 	mode = bb_getopt_ulflags(argc, argv,
 #ifdef CONFIG_FEATURE_IPCALC_FANCY
 			"mbnphs"

Modified: trunk/busybox/util-linux/Config.in
===================================================================
--- trunk/busybox/util-linux/Config.in	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/util-linux/Config.in	2006-05-26 20:19:22 UTC (rev 15195)
@@ -199,10 +199,10 @@
 	  shutdown in the hardware clock, so the hardware will keep the
 	  correct time when Linux is _not_ running.
 
-config CONFIG_FEATURE_HWCLOCK_LONGOPTIONS
+config CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS
 	bool "Support long options (--hctosys,...)"
 	default n
-	depends on CONFIG_HWCLOCK
+	depends on CONFIG_HWCLOCK && CONFIG_GETOPT_LONG
 	help
 	  By default, the hwclock utility only uses short options.  If you
 	  are overly fond of its long options, such as --hctosys, --utc, etc)

Modified: trunk/busybox/util-linux/hwclock.c
===================================================================
--- trunk/busybox/util-linux/hwclock.c	2006-05-26 19:58:58 UTC (rev 15194)
+++ trunk/busybox/util-linux/hwclock.c	2006-05-26 20:19:22 UTC (rev 15195)
@@ -37,7 +37,7 @@
 #define RTC_SET_TIME   _IOW('p', 0x0a, struct linux_rtc_time) /* Set RTC time    */
 #define RTC_RD_TIME    _IOR('p', 0x09, struct linux_rtc_time) /* Read RTC time   */
 
-#ifdef CONFIG_FEATURE_HWCLOCK_LONGOPTIONS
+#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
 # ifndef _GNU_SOURCE
 #  define _GNU_SOURCE
 # endif
@@ -186,7 +186,7 @@
 	unsigned long opt;
 	int utc;
 
-#ifdef CONFIG_FEATURE_HWCLOCK_LONGOPTIONS
+#if ENABLE_FEATURE_HWCLOCK_LONG_OPTIONS
 static const struct option hwclock_long_options[] = {
 		{ "localtime", 0, 0, 'l' },
 		{ "utc",       0, 0, 'u' },




More information about the busybox-cvs mailing list