Initial import from FreeBSD RELENG_4:
[dragonfly.git] / gnu / usr.bin / dialog / TESTS / checklist
1 #!/bin/sh
2 DIALOG=${DIALOG=/usr/bin/dialog}
3
4 $DIALOG --title "CHECKLIST BOX" --clear \
5         --checklist "Hi, this is a checklist box. You can use this to \n\
6 present a list of choices which can be turned on or \n\
7 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!" oN \
17         "Fish"   "Cats like fish." On \
18         "Lemon"  "You know how it tastes." on 2> /tmp/checklist.tmp.$$
19
20 retval=$?
21
22 choice=`cat /tmp/checklist.tmp.$$`
23 rm -f /tmp/checklist.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