From f8fd4db92f5626ef0065f5838fad42ad0fd0b362 Mon Sep 17 00:00:00 2001
From: Rob Landley <rob@landley.net>
Date: Mon, 30 Jan 2006 01:30:39 +0000
Subject: Move SUSv2 obsolete feature disabling to debug menu, invert meaning
 of symbol (switched on to remove now: test your apps to make sure they
 _don't_ do this, because as some point we should just yank it), fixup
 head/tail/fold.

Also tweak "make allyesconfig" so anything starting with CONFIG_DEBUG gets
left switched off.  Possibly other things we want to put in the debug menu?
---
 Config.in        | 25 ++++++++-----------------
 Makefile         |  2 +-
 coreutils/fold.c | 32 ++++++++++++++++----------------
 coreutils/head.c | 19 +++----------------
 coreutils/tail.c | 25 ++++---------------------
 5 files changed, 32 insertions(+), 71 deletions(-)

diff --git a/Config.in b/Config.in
index 1b87c1251..204821091 100644
--- a/Config.in
+++ b/Config.in
@@ -251,23 +251,6 @@ config CONFIG_BUILD_AT_ONCE
 
 	  Say 'N' unless you know what you are doing.
 
-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
-	  Enable pre- SuSv2 features which are deprecated in SuSv2 and
-	  above.
-	  Disables support for e.g. numeric arguments in fold.
-
 endmenu
 
 menu 'Installation Options'
@@ -389,5 +372,13 @@ config CONFIG_EFENCE
 
 endchoice
 
+config CONFIG_DEBUG_YANK_SUSv2
+	bool "Disable obsolete features removed before SUSv3?"
+	default y
+	help
+	  This option will disable backwards compatability with SuSv2,
+	  specifically, old-style numeric options ('command -1 <file>')
+	  will not be supported in head, tail, and fold.  (Note: should
+	  yank from renice too.)
 
 endmenu
diff --git a/Makefile b/Makefile
index 9841659fe..09504e766 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,7 @@ randconfig: scripts/config/conf
 
 allyesconfig: scripts/config/conf
 	@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
-	sed -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|FEATURE_DEVFS|BUILD_AT_ONCE)).*/# \1 is not set/" .config
+	sed -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|FEATURE_DEVFS|BUILD_AT_ONCE))=.*/# \1 is not set/" .config
 	echo "CONFIG_FEATURE_SHARED_BUSYBOX=y" >> .config
 	@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
 
diff --git a/coreutils/fold.c b/coreutils/fold.c
index ee0fdc250..53ef44681 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -53,25 +53,25 @@ extern int fold_main(int argc, char **argv)
 	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];
-
-		if (a[0] == '-') {
-			if (a[1] == '-' && !a[2])
-				break;
-			if (isdigit(a[1])) {
-				char *s = xmalloc(strlen(a) + 2);
-
-				s[0] = '-';
-				s[1] = 'w';
-				strcpy(s + 2, a + 1);
-				argv[i] = s;
+	if(!ENABLE_DEBUG_YANK_SUSv2) {
+		/* Turn any numeric options into -w options.  */
+		for (i = 1; i < argc; i++) {
+			char const *a = argv[i];
+
+			if (a[0] == '-') {
+				if (a[1] == '-' && !a[2])
+					break;
+				if (isdigit(a[1])) {
+					char *s = xmalloc(strlen(a) + 2);
+
+					s[0] = '-';
+					s[1] = 'w';
+					strcpy(s + 2, a + 1);
+					argv[i] = s;
+				}
 			}
 		}
 	}
-#endif
 
 	flags = bb_getopt_ulflags(argc, argv, "bsw:", &w_opt);
 	if (flags & FLAG_WIDTH)
diff --git a/coreutils/head.c b/coreutils/head.c
index eb0dcf212..17d3ef890 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -4,20 +4,7 @@
  *
  * Copyright (C) 2003  Manuel Novoa III  <mjn3@codepoet.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
 /* BB_AUDIT SUSv3 compliant */
@@ -56,7 +43,7 @@ int head_main(int argc, char **argv)
 	int c;
 	int retval = EXIT_SUCCESS;
 
-#if defined CONFIG_FEATURE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
+#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
 	/* Allow legacy syntax of an initial numeric option without -n. */
 	if ((argc > 1) && (argv[1][0] == '-')
 		/* && (isdigit)(argv[1][1]) */
@@ -85,7 +72,7 @@ int head_main(int argc, char **argv)
 #endif
 			case 'n':
 				p = optarg;
-#if defined CONFIG_FEATURE_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
+#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_HEAD
 			GET_COUNT:
 #endif
 				count = bb_xgetularg10(p);
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 49c00f3c9..48abc4b84 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -4,20 +4,7 @@
  *
  * Copyright (C) 2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
 /* BB_AUDIT SUSv3 compliant (need fancy for -c) */
@@ -53,11 +40,7 @@ static const struct suffix_mult tail_suffixes[] = {
 	{ NULL, 0 }
 };
 
-static int status
-#if EXIT_SUCCESS != 0
-	= EXIT_SUCCESS	/* If it is 0 (paranoid check), let bss initialize it. */
-#endif
-	;
+static int status;
 
 static void tail_xprint_header(const char *fmt, const char *filename)
 {
@@ -121,7 +104,7 @@ int tail_main(int argc, char **argv)
 	char *s, *buf;
 	const char *fmt;
 
-#if defined CONFIG_FEATURE_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
+#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
 	/* Allow legacy syntax of an initial numeric option without -n. */
 	if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-')
 			/* && (isdigit)(argv[1][1]) */
@@ -142,7 +125,7 @@ int tail_main(int argc, char **argv)
 				count_bytes = 1;
 				/* FALLS THROUGH */
 			case 'n':
-#if defined CONFIG_FEATURE_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
+#if !ENABLE_DEBUG_YANK_SUSv2 || ENABLE_FEATURE_FANCY_TAIL
 			GET_COUNT:
 #endif
 				count = bb_xgetlarg10_sfx(optarg, tail_suffixes);
-- 
cgit v1.2.3