[2.1.43]-[patch] for adding needed string options to Menuconfig

Bernhard Kaindl (bernhard@bartelt.via.at)
Wed, 18 Jun 1997 22:57:57 +0200 (MEST)


Hello Linus, William and all others!

I've added support for the string options to Menuconfig which may be used
if "Translate Filename suffixes" is enabled are used to choose another
kernelname or kerneltype.

They are handled like the int and hex options. 99 percent of the code is
copied from the existing int/hex-functions. If you've selected a line
of a string option, press return and enter the string in a dialog.

Example of how it looks:

[*] Translate compiled-in kernelname
Enter kernelname string to compile in: "banana"
[*] Translate compiled-in kerneltype
Enter kerneltype string to compile in: "default"

I welcome all suggestions/patches how to improve the new feature further.

--- scripts/Menuconfig-2.1.43 Mon May 5 21:57:21 1997
+++ scripts/Menuconfig Wed Jun 18 22:28:10 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 () {
@@ -963,6 +1004,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"

@@ -1162,6 +1209,10 @@

inputbox_instructions_hex="\
Please enter a hexadecimal value. \
+Use the <TAB> key to move from the input field to the buttons below it."
+
+inputbox_instructions_string="\
+Please enter a string value. \
Use the <TAB> key to move from the input field to the buttons below it."

DIALOG="./scripts/lxdialog/lxdialog"

Thanks all,

Bernhard Kaindl

--
Bernhard Kaindl               |  email: edv@bartelt.via.at
Bartelt Labor- & Datentechnik |         bkaindl@netway.at
Neufeldweg 42                 |  phone: +43.316.475328
A-8010 Graz, Austria          |    fax: +43.316.475328-43