svn commit: trunk/busybox: archival coreutils include networking n etc...

vda at busybox.net vda at busybox.net
Wed Nov 29 11:09:44 UTC 2006


Author: vda
Date: 2006-11-29 03:09:43 -0800 (Wed, 29 Nov 2006)
New Revision: 16715

Log:
fix support for globally disabling --long-options.
(disabling them saves ~4K on fully configured bbox)


Modified:
   trunk/busybox/Config.in
   trunk/busybox/archival/tar.c
   trunk/busybox/coreutils/ls.c
   trunk/busybox/coreutils/od_bloaty.c
   trunk/busybox/include/libbb.h
   trunk/busybox/networking/ftpgetput.c
   trunk/busybox/networking/ipcalc.c
   trunk/busybox/networking/udhcp/dhcpc.c
   trunk/busybox/scripts/kconfig/zconf.tab.c_shipped
   trunk/busybox/scripts/kconfig/zconf.y


Changeset:
Modified: trunk/busybox/Config.in
===================================================================
--- trunk/busybox/Config.in	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/Config.in	2006-11-29 11:09:43 UTC (rev 16715)
@@ -112,13 +112,11 @@
 	  busybox to support locale settings.
 
 config GETOPT_LONG
-	bool
+	bool "Enable support for --long-options"
 	default y
-#	bool "Enable support for --long-options"
-#	default n
-#	help
-#	  Enable this if you want busybox applets to use the gnu --long-option
-#	  style, in addition to single character -a -b -c style options.
+	help
+	  Enable this if you want busybox applets to use the gnu --long-option
+	  style, in addition to single character -a -b -c style options.
 
 config FEATURE_DEVPTS
 	bool "Use the devpts filesystem for Unix98 PTYs"

Modified: trunk/busybox/archival/tar.c
===================================================================
--- trunk/busybox/archival/tar.c	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/archival/tar.c	2006-11-29 11:09:43 UTC (rev 16715)
@@ -721,8 +721,6 @@
 # endif
 	{ 0,                    0, 0, 0 }
 };
-#else
-#define tar_long_options	0
 #endif
 
 int tar_main(int argc, char **argv)
@@ -750,8 +748,9 @@
 		USE_FEATURE_TAR_CREATE("c:") "t:x:" // at least one of these is reqd
 		USE_FEATURE_TAR_CREATE("c--tx:t--cx:x--ct") // mutually exclusive
 		SKIP_FEATURE_TAR_CREATE("t--x:x--t"); // mutually exclusive
-	if (ENABLE_FEATURE_TAR_LONG_OPTIONS)
-		applet_long_options = tar_long_options;
+#if ENABLE_FEATURE_TAR_LONG_OPTIONS
+	applet_long_options = tar_long_options;
+#endif
 	opt = getopt32(argc, argv,
 		"txC:f:Opvk"
 		USE_FEATURE_TAR_CREATE(  "ch"  )

Modified: trunk/busybox/coreutils/ls.c
===================================================================
--- trunk/busybox/coreutils/ls.c	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/coreutils/ls.c	2006-11-29 11:09:43 UTC (rev 16715)
@@ -648,10 +648,12 @@
 #endif
 		case LIST_FILENAME:
 			errno = 0;
+#if ENABLE_FEATURE_LS_COLOR
 			if (show_color && !lstat(dn->fullname, &info)) {
 				printf("\033[%d;%dm", bgcolor(info.st_mode),
 						fgcolor(info.st_mode));
 			}
+#endif
 			column += printf("%s", dn->name);
 			if (show_color) {
 				printf("\033[0m");
@@ -667,11 +669,13 @@
 					append = append_char(info.st_mode);
 				}
 #endif
+#if ENABLE_FEATURE_LS_COLOR
 				if (show_color) {
 					errno = 0;
 					printf("\033[%d;%dm", bgcolor(info.st_mode),
 						   fgcolor(info.st_mode));
 				}
+#endif
 				column += printf("%s", lpath) + 4;
 				if (show_color) {
 					printf("\033[0m");

Modified: trunk/busybox/coreutils/od_bloaty.c
===================================================================
--- trunk/busybox/coreutils/od_bloaty.c	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/coreutils/od_bloaty.c	2006-11-29 11:09:43 UTC (rev 16715)
@@ -858,6 +858,8 @@
 	printf(address_fmt, address_pad_len, address);
 }
 
+#if ENABLE_GETOPT_LONG
+/* only used with --traditional */
 static void
 format_address_paren(off_t address, char c)
 {
@@ -872,8 +874,8 @@
 	format_address_std(address, ' ');
 	format_address_paren(address + pseudo_offset, c);
 }
+#endif
 
-
 static void
 dump_hexl_mode_trailer(size_t n_bytes, const char *block)
 {
@@ -978,6 +980,7 @@
 	return l_c_m;
 }
 
+#if ENABLE_GETOPT_LONG
 /* If S is a valid traditional offset specification with an optional
    leading '+' return nonzero and set *OFFSET to the offset it denotes.  */
 
@@ -1011,6 +1014,7 @@
 
 	return (*offset >= 0);
 }
+#endif
 
 /* Read a chunk of size BYTES_PER_BLOCK from the input files, write the
    formatted block to standard output, and repeat until the specified
@@ -1235,8 +1239,9 @@
 		OPT_s = 1 << 15,
 		OPT_S = 1 << 16,
 		OPT_w = 1 << 17,
-		OPT_traditional = 1 << 18,
+		OPT_traditional = (1 << 18) * ENABLE_GETOPT_LONG,
 	};
+#if ENABLE_GETOPT_LONG
 	static const struct option long_options[] = {
 		{ "skip-bytes",    required_argument, NULL, 'j' },
 		{ "address-radix", required_argument, NULL, 'A' },
@@ -1248,6 +1253,7 @@
 		{ "traditional",   no_argument,       NULL, 0xff },
 		{ NULL, 0, NULL, 0 }
 	};
+#endif
 	char *str_A, *str_N, *str_j, *str_S;
 	char *str_w = NULL;
 	llist_t *lst_t = NULL;
@@ -1260,7 +1266,9 @@
 
 	/* Parse command line */
 	opt_complementary = "t::"; // list
+#if ENABLE_GETOPT_LONG
 	applet_long_options = long_options;
+#endif
 	opt = getopt32(argc, argv, "A:N:abcdfhij:lot:vxsS:"
 		"w::", // -w with optional param
 		// -S was -s and also had optional parameter
@@ -1333,6 +1341,7 @@
 	 * FIXME: POSIX 1003.1-2001 with XSI requires support for the
 	 * traditional syntax even if --traditional is not given.  */
 
+#if ENABLE_GETOPT_LONG
 	if (opt & OPT_traditional) {
 		off_t o1, o2;
 
@@ -1388,6 +1397,7 @@
 			}
 		}
 	}
+#endif
 
 	if (limit_bytes_to_format) {
 		end_offset = n_bytes_to_skip + max_bytes_to_format;

Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/include/libbb.h	2006-11-29 11:09:43 UTC (rev 16715)
@@ -333,7 +333,9 @@
 
 enum { BB_GETOPT_ERROR = 0x80000000 };
 extern const char *opt_complementary;
+#if ENABLE_GETOPT_LONG
 extern const struct option *applet_long_options;
+#endif
 extern uint32_t option_mask32;
 extern uint32_t getopt32(int argc, char **argv, const char *applet_opts, ...);
 
@@ -369,7 +371,7 @@
 extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
 extern void bb_perror_nomsg(void);
 extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
-/* These two are used internally -- you shouldn't need to use them */
+/* These are used internally -- you shouldn't need to use them */
 extern void bb_verror_msg(const char *s, va_list p, const char *strerr);
 extern void bb_vperror_msg(const char *s, va_list p);
 extern void bb_vinfo_msg(const char *s, va_list p);

Modified: trunk/busybox/networking/ftpgetput.c
===================================================================
--- trunk/busybox/networking/ftpgetput.c	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/networking/ftpgetput.c	2006-11-29 11:09:43 UTC (rev 16715)
@@ -264,15 +264,13 @@
 
 #if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
 static const struct option ftpgetput_long_options[] = {
-	{"continue", 1, NULL, 'c'},
-	{"verbose", 0, NULL, 'v'},
-	{"username", 1, NULL, 'u'},
-	{"password", 1, NULL, 'p'},
-	{"port", 1, NULL, 'P'},
-	{0, 0, 0, 0}
+	{ "continue", 1, NULL, 'c' },
+	{ "verbose", 0, NULL, 'v' },
+	{ "username", 1, NULL, 'u' },
+	{ "password", 1, NULL, 'p' },
+	{ "port", 1, NULL, 'P' },
+	{ 0, 0, 0, 0 }
 };
-#else
-#define ftpgetput_long_options 0
 #endif
 
 int ftpgetput_main(int argc, char **argv)
@@ -307,9 +305,9 @@
 	/*
 	 * Decipher the command line
 	 */
-	if (ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS)
-		applet_long_options = ftpgetput_long_options;
-
+#if ENABLE_FEATURE_FTPGETPUT_LONG_OPTIONS
+	applet_long_options = ftpgetput_long_options;
+#endif
 	opt = getopt32(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-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/networking/ipcalc.c	2006-11-29 11:09:43 UTC (rev 16715)
@@ -64,19 +64,18 @@
 
 #if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
 	static const struct option long_options[] = {
-		{"netmask",		no_argument, NULL, 'm'},
-		{"broadcast",	no_argument, NULL, 'b'},
-		{"network",		no_argument, NULL, 'n'},
-#ifdef CONFIG_FEATURE_IPCALC_FANCY
-		{"prefix",		no_argument, NULL, 'p'},
-		{"hostname",	no_argument, NULL, 'h'},
-		{"silent",		no_argument, NULL, 's'},
-#endif
-		{NULL, 0, NULL, 0}
+		{ "netmask",     no_argument, NULL, 'm' },
+		{ "broadcast",   no_argument, NULL, 'b' },
+		{ "network",     no_argument, NULL, 'n' },
+# if ENABLE_FEATURE_IPCALC_FANCY
+		{ "prefix",      no_argument, NULL, 'p' },
+		{ "hostname",	 no_argument, NULL, 'h' },
+		{ "silent",      no_argument, NULL, 's' },
+# endif
+		{ NULL, 0, NULL, 0 }
 	};
-#else
-#define long_options 0
 #endif
+
 int ipcalc_main(int argc, char **argv)
 {
 	unsigned opt;
@@ -85,9 +84,9 @@
 	struct in_addr a;
 	char *ipstr;
 
-	if (ENABLE_FEATURE_IPCALC_LONG_OPTIONS)
-		applet_long_options = long_options;
-
+#if ENABLE_FEATURE_IPCALC_LONG_OPTIONS
+	applet_long_options = long_options;
+#endif
 	opt = getopt32(argc, argv, "mbn" USE_FEATURE_IPCALC_FANCY("phs"));
 	argc -= optind;
 	argv += optind;

Modified: trunk/busybox/networking/udhcp/dhcpc.c
===================================================================
--- trunk/busybox/networking/udhcp/dhcpc.c	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/networking/udhcp/dhcpc.c	2006-11-29 11:09:43 UTC (rev 16715)
@@ -160,6 +160,7 @@
 		OPT_t = 1 << 16,
 		OPT_v = 1 << 17,
 	};
+#if ENABLE_GETOPT_LONG
 	static const struct option arg_options[] = {
 		{ "clientid",   required_argument,      0, 'c' },
 		{ "clientid-none", no_argument,         0, 'C' },
@@ -181,7 +182,7 @@
 		{ "retries",    required_argument,      0, 't' },
 		{ 0, 0, 0, 0 }
 	};
-
+#endif
 	/* Default options. */
 	client_config.interface = "eth0";
 	client_config.script = DEFAULT_SCRIPT;
@@ -191,7 +192,9 @@
 	/* Parse command line */
 	opt_complementary = "?:c--C:C--c" // mutually exclusive
 	                    ":hH:Hh"; // -h and -H are the same
+#if ENABLE_GETOPT_LONG
 	applet_long_options = arg_options;
+#endif
 	opt = getopt32(argc, argv, "c:CV:fbH:h:F:i:np:qRr:s:T:t:v",
 		&str_c, &str_V, &str_h, &str_h, &str_F,
 		&client_config.interface, &client_config.pidfile, &str_r,

Modified: trunk/busybox/scripts/kconfig/zconf.tab.c_shipped
===================================================================
--- trunk/busybox/scripts/kconfig/zconf.tab.c_shipped	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/scripts/kconfig/zconf.tab.c_shipped	2006-11-29 11:09:43 UTC (rev 16715)
@@ -1949,7 +1949,7 @@
 	sym_init();
 	menu_init();
 	modules_sym = sym_lookup("MODULES", 0);
-	rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
+	rootmenu.prompt = menu_add_prompt(P_MENU, "Busybox Configuration", NULL);
 
 #if YYDEBUG
 	if (getenv("ZCONF_DEBUG"))

Modified: trunk/busybox/scripts/kconfig/zconf.y
===================================================================
--- trunk/busybox/scripts/kconfig/zconf.y	2006-11-29 10:39:30 UTC (rev 16714)
+++ trunk/busybox/scripts/kconfig/zconf.y	2006-11-29 11:09:43 UTC (rev 16715)
@@ -459,7 +459,7 @@
 	sym_init();
 	menu_init();
 	modules_sym = sym_lookup("MODULES", 0);
-	rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
+	rootmenu.prompt = menu_add_prompt(P_MENU, "Busybox Configuration", NULL);
 
 #if YYDEBUG
 	if (getenv("ZCONF_DEBUG"))




More information about the busybox-cvs mailing list