Initial import from FreeBSD RELENG_4:
[games.git] / gnu / usr.bin / dialog / TESTS / radiolist
1 #!/bin/sh
2 DIALOG=${DIALOG=/usr/bin/dialog}
3
4 $DIALOG --title "RADIOLIST BOX" --clear \
5         --radiolist "Hi, this is a radiolist box. You can use this to \n\
6 present a list of choices, one of them can be turned \n\
7 on or off. If there are more items than can fit on the \n\
8 screen, the list will be scrolled. You can use the \n\
9 UP/DOWN arrow keys, the first letter of the choice as a\n\
10 hot key, or the number keys 1-9 to choose an option. \n\
11 Press SPACE to toggle an option on/off. \n\n\
12   Which of the following are fruits?" -1 -1 5 \
13         "Apple"  "It's an apple." off \
14         "Dog"    "No, that's not my dog." ON \
15         "Orange" "Yeah, that's juicy." off \
16         "Cat"    "No, never put a dog and a cat together!" oFF  \
17         "Fish"   "Cats like fish." OFF \
18         "Lemon"  "You know how it tastes." oFF 2> /tmp/radiolist.tmp.$$
19
20 retval=$?
21
22 choice=`cat /tmp/radiolist.tmp.$$`
23 rm -f /tmp/radiolist.tmp.$$
24
25 case $retval in
26   0)
27     echo "'$choice' chosen.";;
28   1)
29     echo "Cancel pressed.";;
30   255)
31     [ -z "$choice" ] || echo $choice ;
32     echo "ESC pressed.";;
33 esac