1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-11 16:57:23 +01:00

simplify the input_box function

This commit is contained in:
Joshua Tauberer
2014-08-21 15:52:19 +00:00
parent 980b83b124
commit 7ea4d33e06
2 changed files with 99 additions and 91 deletions

View File

@@ -134,21 +134,11 @@ function message_box {
}
function input_box {
TMP=`mktemp`
dialog --title "$1" --inputbox "$2" 0 0 "$3" 2>$TMP
respose=$?
case $respose in
0)
result=$(<$TMP)
;;
1)
exit
;;
255)
exit
esac
rm $TMP
# input_box "title" "prompt" "defaultvalue" VARIABLE
# The user's input will be stored in the variable VARIABLE.
# The exit code from dialog will be stored in VARIABLE_EXITCODE.
declare -n result=$4
declare -n result_code=$4_EXITCODE
result=$(dialog --stdout --title "$1" --inputbox "$2" 0 0 "$3")
result_code=$?
}