Add a README.DRAGONFLY for contrib/dialog.
[dragonfly.git] / gnu / usr.bin / dialog / TESTS / inputbox
1 #!/bin/sh
2 DIALOG=${DIALOG=/usr/bin/dialog}
3
4 $DIALOG --title "INPUT BOX" --clear \
5         --inputbox "Hi, this is an input dialog box. You can use \n\
6 this to ask questions that require the user \n\
7 to input a string as the answer. You can \n\
8 input strings of length longer than the \n\
9 width of the input box, in that case, the \n\
10 input field will be automatically scrolled. \n\
11 You can use BACKSPACE, LEFT, RIGHT, HOME, END\n\
12 to correct errors. \n\n\
13 Try inputing your name below:" -1 -1 "John Smith" 2> /tmp/inputbox.tmp.$$
14
15 retval=$?
16
17 input=`cat /tmp/inputbox.tmp.$$`
18 rm -f /tmp/inputbox.tmp.$$
19
20 case $retval in
21   0)
22     echo "Input string is '$input'";;
23   1)
24     echo "Cancel pressed.";;
25   255)
26     [ -z "$input" ] || echo $input ;
27     echo "ESC pressed.";;
28 esac