patch-2.0.31 linux/scripts/Menuconfig

Next file: linux/scripts/README.Menuconfig
Previous file: linux/scripts/Configure
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.30/linux/scripts/Menuconfig linux/scripts/Menuconfig
@@ -19,17 +19,10 @@
 # Portions of this script were borrowed from the original Configure
 # script.
 #
-# Please send comments / questions / bug fixes to roadcapw@cfw.com
+# Please send comments / questions / bug fixes to roadcapw@titus.org
 #
 #----------------------------------------------------------------------------
 
-
-#
-# Change this to TRUE if you prefer all kernel options listed
-# in a single menu rather than the standard menu hierarchy.
-#
-single_menu_mode=
-
 #
 # Make sure we're really running bash.
 #
@@ -41,7 +34,12 @@
 set -h +o posix
 
 
-
+#
+# If you prefer all kernel options listed in a single menu rather than
+# the standard menu hierarchy, set SINGLE_MENU_MODE to "TRUE" in your
+# environment.
+#
+single_menu_mode="${SINGLE_MENU_MODE:-FALSE}"
 
 
 #
@@ -400,7 +398,8 @@
 			answer="`cat MCdialog.out`"
 			answer="${answer:-$3}"
 
-			if expr $answer : '0$\|-?[1-9][0-9]*$' >/dev/null
+			# Avoid problems with GNU vs POSIX expr semantics.
+			if expr "$answer" : '0$\|-[1-9][0-9]*$\|[1-9][0-9]*$' >/dev/null
 			then
 				eval $2="$answer"
 			else
@@ -433,7 +432,8 @@
 			answer="${answer:-$3}"
 			answer="${answer##*[x,X]}"
 
-			if expr $answer : '[0-9a-fA-F]+$' >/dev/null
+			# Avoid problems with GNU vs POSIX expr semantics.
+			if expr "$answer" : '[0-9a-fA-F][0-9a-fA-F]*$' >/dev/null
 			then
 				eval $2="$answer"
 			else
@@ -452,7 +452,7 @@
 }
 
 #
-# Handle a on-of-many choice list.
+# Handle a one-of-many choice list.
 #
 function l_choice () {
 	#
@@ -493,7 +493,7 @@
 	done
 
 	#
-	# Now set the boolean value of each option base on
+	# Now set the boolean value of each option based on
 	# the selection made from the radiolist.
 	#
 	set -- $choices
@@ -579,7 +579,7 @@
 		if ($1 ~ /mainmenu_option|endmenu/) {
 			printf("") >>menu
 		} 
-		else if ($0 ~ /^#|$MAKE|mainmenu_name/) {
+		else if ($0 ~ /^#|\$MAKE|mainmenu_name/) {
 			printf("") >>menu
 		}
 		else if ($1 == "source") {
@@ -655,7 +655,7 @@
 Menuconfig has encountered a possible error in one of the kernel's
 configuration files and is unable to continue.
 
-Please report this to the author <roadcapw@cfw.com>.  You may also
+Please report this to the author <roadcapw@titus.org>.  You may also
 send a problem report to linux-kernel@vger.rutgers.edu or post a
 message to the linux.dev.kernel news group.
 
@@ -718,7 +718,7 @@
 "make clean all" command.
 
 If you have verified that your ncurses install is correct, you may email
-the author <roadcapw@cfw.com> or post a message on the linux.dev.kernel
+the author <roadcapw@titus.org> or post a message on the linux.dev.kernel
 news group for additional assistance. 
 
 EOM
@@ -746,7 +746,7 @@
 
 	while true
 	do
-		ALT_CONFIG="${ALT_CONFIG:-$DEFAULTS}"
+		ALT_CONFIG="${ALT_CONFIG:-$_CONFIG}"
 
 		$DIALOG --backtitle "$backtitle" \
 			--inputbox "\
@@ -812,6 +812,7 @@
 			
 	while true
 	do
+
 		$DIALOG --backtitle "$backtitle" \
 			--inputbox "\
 Enter a filename to which this configuration should be saved \
@@ -858,20 +859,19 @@
 	rm -f help.out MCdialog.out
 }
 
+
+#
+# Load config file into the environment converting all
+# "# OPTION is not set" lines to "OPTION=n".
 #
-# Load config options from a file.
-# Converts all "# OPTION is not set" lines to "OPTION=n" lines
+# The $ARCH defaults are loaded first so "new"/previously 
+# unconfigured parameters are assigned the proper defaults.
 #
 function load_config_file () {
-	awk '
-	  /# .* is not set.*/ { printf("%s=n\n", $2) }
-	! /# .* is not set.*/ { print }
-	' $1 >.tmpconfig
-
-	source ./.tmpconfig
-	rm -f .tmpconfig
+	eval "`sed -e 's/# \(.*\) is not set.*/\1=n/' arch/$ARCH/defconfig $1`"
 }
 
+
 #
 # Just what it says.
 #
@@ -1007,8 +1007,8 @@
 		fi
 	}
 
-	DEF_CONFIG="${1:-.config}"
-	DEF_CONFIG_H="include/linux/autoconf.h"
+	DEF_CONFIG="${1:-$_CONFIG}"
+	DEF_CONFIG_H="$AUTOCONF_H"
 
 	CONFIG=.tmpconfig
 	CONFIG_H=.tmpconfig.h
@@ -1025,7 +1025,11 @@
 	
 	if . $CONFIG_IN >>.menuconfig.log 2>&1
 	then
-		if [ "$DEF_CONFIG" = ".config" ]
+		#
+		# Skip these steps if we are saving to an
+		# alternate configuration file.
+		#
+		if [ "$DEF_CONFIG" = "$_CONFIG" ]
 		then
 			#
 			# Create the sound driver's config files for cards
@@ -1055,12 +1059,14 @@
 	fi
 }
 
+
 #
 # Remove temporary files
 #
 cleanup () {
 	cleanup1
 	cleanup2
+	stty $S_TERMIO
 }
 
 cleanup1 () {
@@ -1093,6 +1099,7 @@
 	ROWS=$((ROWS-4))  COLS=$((COLS-5))
 }
 
+S_TERMIO=`stty -g`
 
 set_geometry `stty size 2>/dev/null`
 
@@ -1111,7 +1118,7 @@
 Press <?> for additional information about this option."
 
 inputbox_instructions_int="\
-Please enter a decimal value between 1 and 9999. \
+Please enter a decimal value. \
 Fractions will not be accepted.  \
 Use the <TAB> key to move from the input field to the buttons below it."
 
@@ -1119,7 +1126,7 @@
 Please enter a hexadecimal value. \
 Use the <TAB> key to move from the input field to the buttons below it."
 
-DIALOG="./scripts/lxdialog/lxdialog"
+DIALOG="${DIALOG:-./scripts/lxdialog/lxdialog}"
 
 kernel_version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}"
 
@@ -1131,29 +1138,28 @@
 #
 # Locate default files.
 #
-CONFIG_IN=./config.in
-if [ "$1" != "" ] ; then
-	CONFIG_IN=$1
-fi
+DEFAULTS="arch/$ARCH/defconfig"
+
+CONFIG_IN="${1:-./config.in}"
 
-DEFAULTS=arch/$ARCH/defconfig
-if [ -f .config ]; then
-  DEFAULTS=.config
+_CONFIG="${2:-.config}"
+
+if [ -f "$_CONFIG" ]; then
+  DEFAULTS=$_CONFIG
 fi
 
+AUTOCONF_H="${3:-include/linux/autoconf.h}"
+
 if [ -f $DEFAULTS ]
 then
-  echo "#"
-  echo "# Using defaults found in" $DEFAULTS
-  echo "#"
+  echo
+  echo "Using defaults found in" $DEFAULTS
   load_config_file $DEFAULTS
 else
-  echo "#"
-  echo "# No defaults found"
-  echo "#"
+  echo
+  echo "No defaults found"
 fi
 
-
 # Fresh new log.
 >.menuconfig.log
 
@@ -1211,8 +1217,9 @@
 	   
 then
 	save_configuration
-
+	stty $S_TERMIO
 	clear
+
 	cat <<EOM
 
 
@@ -1224,6 +1231,7 @@
 EOM
 else
 	clear
+	stty $S_TERMIO
 	echo -e "Your kernel configuration changes were NOT saved.\n"
 fi
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov