svn commit: trunk/busybox: coreutils include sysdeps/linux

bug1 at busybox.net bug1 at busybox.net
Sun Dec 11 03:09:08 UTC 2005


Author: bug1
Date: 2005-12-10 19:09:05 -0800 (Sat, 10 Dec 2005)
New Revision: 12835

Log:
Add build options to control SuS compatability, allows numeric 
option handling to be disabled.
Defaults to enabled, so no changes in default behaviour


Modified:
   trunk/busybox/coreutils/fold.c
   trunk/busybox/coreutils/head.c
   trunk/busybox/coreutils/tail.c
   trunk/busybox/include/usage.h
   trunk/busybox/sysdeps/linux/Config.in


Changeset:
Modified: trunk/busybox/coreutils/fold.c
===================================================================
--- trunk/busybox/coreutils/fold.c	2005-12-11 01:13:38 UTC (rev 12834)
+++ trunk/busybox/coreutils/fold.c	2005-12-11 03:09:05 UTC (rev 12835)
@@ -52,6 +52,8 @@
 	int i;
 	int errs = 0;
 
+
+#ifdef CONFIG_FEATURE_SUSv2_OBSOLETE
 	/* Turn any numeric options into -w options.  */
 	for (i = 1; i < argc; i++) {
 		char const *a = argv[i];
@@ -69,6 +71,7 @@
 			}
 		}
 	}
+#endif
 
 	flags = bb_getopt_ulflags(argc, argv, "bsw:", &w_opt);
 	if (flags & FLAG_WIDTH)

Modified: trunk/busybox/coreutils/head.c
===================================================================
--- trunk/busybox/coreutils/head.c	2005-12-11 01:13:38 UTC (rev 12834)
+++ trunk/busybox/coreutils/head.c	2005-12-11 03:09:05 UTC (rev 12835)
@@ -56,6 +56,7 @@
 	int c;
 	int retval = EXIT_SUCCESS;
 
+#if defined CONFIG_FEATURE_SUSv2 || defined CONFIG_FEATURE_FANCY_HEAD
 	/* Allow legacy syntax of an initial numeric option without -n. */
 	if ((argc > 1) && (argv[1][0] == '-')
 		/* && (isdigit)(argv[1][1]) */
@@ -66,7 +67,9 @@
 		p = (*argv) + 1;
 		goto GET_COUNT;
 	}
+#endif
 
+	/* No size benefit in converting this to bb_getopt_ulflags */
 	while ((opt = getopt(argc, argv, head_opts)) > 0) {
 		switch(opt) {
 #ifdef CONFIG_FEATURE_FANCY_HEAD

Modified: trunk/busybox/coreutils/tail.c
===================================================================
--- trunk/busybox/coreutils/tail.c	2005-12-11 01:13:38 UTC (rev 12834)
+++ trunk/busybox/coreutils/tail.c	2005-12-11 03:09:05 UTC (rev 12835)
@@ -121,6 +121,7 @@
 	char *s, *buf;
 	const char *fmt;
 
+#ifdef CONFIG_FEATURE_SUSv2
 	/* Allow legacy syntax of an initial numeric option without -n. */
 	if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-')
 			/* && (isdigit)(argv[1][1]) */
@@ -130,6 +131,7 @@
 		optarg = argv[1];
 		goto GET_COUNT;
 	}
+#endif
 
 	while ((opt = getopt(argc, argv, tail_opts)) > 0) {
 		switch (opt) {

Modified: trunk/busybox/include/usage.h
===================================================================
--- trunk/busybox/include/usage.h	2005-12-11 01:13:38 UTC (rev 12834)
+++ trunk/busybox/include/usage.h	2005-12-11 03:09:05 UTC (rev 12835)
@@ -766,7 +766,7 @@
 	"/etc/passwd\n"
 
 #define fold_trivial_usage \
-	"[-bsw] [FILE]"
+	"[-bs] [-w WIDTH] [FILE]"
 #define fold_full_usage \
 	"Wrap input lines in each FILE (standard input by default), writing to\n" \
 	"standard output.\n\n" \

Modified: trunk/busybox/sysdeps/linux/Config.in
===================================================================
--- trunk/busybox/sysdeps/linux/Config.in	2005-12-11 01:13:38 UTC (rev 12834)
+++ trunk/busybox/sysdeps/linux/Config.in	2005-12-11 03:09:05 UTC (rev 12835)
@@ -203,6 +203,21 @@
 	  if you want to add some simple compiler switches (like -march=i686),
 	  or check for warnings using -Werror, just those options here.
 
+config CONFIG_FEATURE_SUSv2
+	bool "Enable features that are in SuSv2 but not SuSv3?"
+	default y
+	help
+	  This option will enable backwards compatability with SuSv2,
+	  specifically, numeric options such as 'head -1 <file>' will be
+	  supported.
+
+config CONFIG_FEATURE_SUSv2_OBSOLETE
+	bool "Enable features that are obsolete in SuSv2"
+	depends on CONFIG_FEATURE_SUSv2
+	default y
+	help
+	  Disables support for numeric arguments in fold.
+
 endmenu
 
 menu 'Installation Options'




More information about the busybox-cvs mailing list