Messages in this thread Patch in this message | | | Date | Sat, 13 Sep 1997 20:47:03 +0200 | From | Pavel Machek <> | Subject | Menuconfig strings & robustness patch |
| |
Hi!
This patch adds strings support to menuconfig, makes menuconfig more robust and replaces inviting 'blue screen' with info about what is happening on startup. (I don't like blue screens - have some bad associations with them ;-)
Should be applied, IMO.
Pavel
--- clean/scripts/Menuconfig Sun Apr 13 19:18:23 1997 +++ linux/scripts/Menuconfig Fri Aug 22 08:24:21 1997 @@ -24,6 +24,8 @@ # 070497 Bernhard Kaindl (bkaindl@netway.at) - get default values for # new bool, tristate and dep_tristate parameters from the defconfig file. # new configuration parameters are marked with '(NEW)' as in make config. +# 180697 Bernhard Kaindl (bkaindl@netway.at) - added the needed support +# for string options. They are handled like the int and hex options. #---------------------------------------------------------------------------- @@ -179,7 +181,7 @@ } # -# Add a menu item which will call our local int function. +# Add a menu item which will call our local hex function. # function hex () { eval $2=\${$2:-"$3"} x=\${$2##*[x,X]} @@ -190,6 +192,17 @@ } # +# Add a menu item which will call our local string function. +# +function string () { + eval $2=\${$2:-"$3"} x=\$$2 + + echo -ne "'$2' ' $1: \"$x\"' " >>MCmenu + + echo -e "function $2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists +} + +# # Add a menu item which will call our local One-of-Many choice list. # function choice () { @@ -482,6 +495,34 @@ } # +# Create a dialog for entering a string into a kernel option. +# +function l_string () { + while true + do + if $DIALOG --title "$1" \ + --backtitle "$backtitle" \ + --inputbox "$inputbox_instructions_string" \ + 10 75 "$4" 2>MCdialog.out + then + answer="`cat MCdialog.out`" + answer="${answer:-$3}" + + # + # Someone may add a nice check for the entered + # string here... + # + eval $2=\"$answer\" + + break + fi + + help "$2" "$1" + done +} + + +# # Handle a one-of-many choice list. # function l_choice () { @@ -540,12 +581,18 @@ done } +# +# Call awk, and watch for error codes, etc. +# +function callawk () { +awk "$1" || echo "Awk died with error code $?. Giving up." || exit 1 +} # # A faster awk based recursive parser. (I hope) # function parser1 () { -awk ' +callawk ' BEGIN { menu_no = 0 comment_is_option = 0 @@ -598,7 +645,7 @@ # Secondary parser for single menu mode. # function parser2 () { -awk ' +callawk ' BEGIN { parser("'$CONFIG_IN'","MCmenu0") } @@ -629,12 +676,14 @@ # Parse all the config.in files into mini scripts. # function parse_config_files () { + echo -n "." rm -f MCmenu* echo "function MCmenu0 () {" >MCmenu0 echo 'default=$1' >>MCmenu0 echo "menu_name 'Main Menu'" >>MCmenu0 + echo -n "." if [ "_$single_menu_mode" = "_TRUE" ] then parser2 @@ -657,9 +706,9 @@ # for i in MCmenu* do + echo -n "." source ./$i done - rm -f MCmenu* } @@ -963,6 +1012,12 @@ echo "#define $2 0x${x##*[x,X]}" >>$CONFIG_H } + function string () { + eval x=\${$2:-"$3"} + echo "$2=\"$x\"" >>$CONFIG + echo "#define $2 \"$x\"" >>$CONFIG_H + } + function define_bool () { eval $1="$2" @@ -1164,7 +1219,10 @@ Please enter a hexadecimal value. \ Use the <TAB> key to move from the input field to the buttons below it." DIALOG="./scripts/lxdialog/lxdialog" +inputbox_instructions_string="\ +Please enter a string value. \ +Use the <TAB> key to move from the input field to the buttons below it." kernel_version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}" @@ -1188,22 +1245,17 @@ if [ -f $DEFAULTS ] then - echo "#" - echo "# Using defaults found in" $DEFAULTS - echo "#" + echo "Using defaults found in" $DEFAULTS load_config_file $DEFAULTS else - echo "#" - echo "# No defaults found" - echo "#" + echo "No defaults found" fi # Fresh new log. >.menuconfig.log -$DIALOG --backtitle "$backtitle" \ - --infobox "Preparing configuration scripts..." 3 40 +echo -n "Preparing configuration scripts: version" # # Check kernel version of previous menuconfig build. @@ -1222,6 +1274,7 @@ if [ "$rebuildsound" ] then + echo -n ", sound" # Activate the Linux compatible sound configuration. # This may not work for all sound cards. (See sound docs) # @@ -1231,13 +1284,23 @@ fi # Load the functions used by the config.in files. +echo -n ", functions" load_functions +if [ ! -e $CONFIG_IN ] +then + echo "Your main config.in file ($CONFIG_IN) does not exist" + exit 1 +fi + # # Read config.in files and parse them into one shell function per menu. # +echo -n ", parsing" parse_config_files $CONFIG_IN +sleep 1 +echo "done." # # Start the ball rolling from the top. # @@ -1261,10 +1324,7 @@ cat <<EOM -The linux kernel is now hopefully configured for your setup. -Check the top-level Makefile for additional configuration, -and do a 'make dep ; make clean' if you want to be sure all -the files are correctly re-made. +The linux kernel is now configured for your setup. EOM else
-- I'm really pavel@atrey.karlin.mff.cuni.cz. Pavel Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).
| |