dialog is not compatible with VT52, beginning to rewrite UI
This commit is contained in:
96
start
96
start
@@ -1,91 +1,60 @@
|
||||
#!/bin/bash
|
||||
export LANG=C
|
||||
export EVENT=DiVOC
|
||||
|
||||
export DIALOGRC=dialogrc
|
||||
|
||||
LOCKFILE=/tmp/irolock
|
||||
TMP=/tmp/$RANDOM
|
||||
BT="Intergalactic Registration Office - v0.3"
|
||||
BT="Intergalactic Registration Office - v0.3\n========================================"
|
||||
|
||||
cd $(dirname "$0")
|
||||
|
||||
function clr() {
|
||||
printf "\033H\033J"
|
||||
}
|
||||
|
||||
function infoBox() {
|
||||
h=8
|
||||
w=60
|
||||
if [ -n "$3" ]; then
|
||||
h=$3
|
||||
fi
|
||||
if [ -n "$4" ]; then
|
||||
w=$4
|
||||
fi
|
||||
dialog --title "$1" \
|
||||
--backtitle "$BT" \
|
||||
--infobox "$2" $h $w
|
||||
clr
|
||||
echo -e "$BT\n\n$1\n\n\n$2"
|
||||
read -n 1 -s -r -p "Press any key to continue"
|
||||
}
|
||||
|
||||
function diaBox() {
|
||||
h=8
|
||||
w=60
|
||||
if [ -n "$3" ]; then
|
||||
h=$3
|
||||
fi
|
||||
if [ -n "$4" ]; then
|
||||
w=$4
|
||||
fi
|
||||
dialog --title "$1" \
|
||||
--backtitle "$BT" \
|
||||
--msgbox "$2" $h $w
|
||||
clr
|
||||
echo -e "$BT\n\n$1\n\n\n$2"
|
||||
read -r -p "Okay? [(o)kay/(a)bort] " resp
|
||||
echo "$resp" > $TMP
|
||||
}
|
||||
|
||||
function ynBox() {
|
||||
h=8
|
||||
w=60
|
||||
if [ -n "$3" ]; then
|
||||
h=$3
|
||||
clr
|
||||
echo -e "$BT\n\n$1\n\n\n$2"
|
||||
read -r -p "Are you sure? [y/N] " resp
|
||||
if [ "$resp" = "" ]; then
|
||||
resp="N"
|
||||
fi
|
||||
if [ -n "$4" ]; then
|
||||
w=$4
|
||||
fi
|
||||
|
||||
dialog --title "$1" \
|
||||
--backtitle "$BT" \
|
||||
--yesno "$2" $h $w
|
||||
|
||||
return $?
|
||||
echo "$resp" > $TMP
|
||||
}
|
||||
|
||||
function askStr() {
|
||||
h=12
|
||||
w=60
|
||||
if [ -n "$5" ]; then
|
||||
h=$5
|
||||
fi
|
||||
if [ -n "$6" ]; then
|
||||
w=$6
|
||||
fi
|
||||
clr
|
||||
echo -e "$BT\n\n$2\n\n\n$3"
|
||||
read resp
|
||||
|
||||
echo "$resp" > $TMP
|
||||
|
||||
dialog --title "$2" \
|
||||
--backtitle "$BT" \
|
||||
--max-input $1 \
|
||||
--inputbox "$3" $h $w "$4" 2> $TMP
|
||||
return $?
|
||||
}
|
||||
|
||||
function askPw() {
|
||||
h=12
|
||||
w=60
|
||||
if [ -n "$5" ]; then
|
||||
h=$5
|
||||
fi
|
||||
if [ -n "$6" ]; then
|
||||
w=$6
|
||||
fi
|
||||
clr
|
||||
echo -e "$BT\n\n$2\n\n"
|
||||
|
||||
dialog --title "$2" \
|
||||
--backtitle "$BT" \
|
||||
--max-input $1 \
|
||||
--insecure \
|
||||
--passwordbox "$3" $h $w "$4" 2> $TMP
|
||||
return $?
|
||||
stty -echo
|
||||
|
||||
read -r -p "$3 " resp
|
||||
|
||||
echo "$resp" > $TMP
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
@@ -368,6 +337,7 @@ function askForFunnyUserCreds() {
|
||||
fi
|
||||
else
|
||||
echo "Wrong credentials."
|
||||
sleep 3
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user