Initial import from FreeBSD RELENG_4:
[dragonfly.git] / gnu / usr.bin / dialog / TESTS / textbox
1 #!/bin/sh
2 DIALOG=${DIALOG=/usr/bin/dialog}
3
4 cat << EOF > /tmp/textbox.tmp.$$
5 Hi, this is a text dialog box. It can be used to display text from a file.
6 The file should not contain any 'tab' characters, so you should 'expand'
7 the file first if it contains 'tab' characters.
8
9 It's like a simple text file viewer, with these keys implemented:
10
11 PGDN/SPACE     - Move down one page
12 PGUP/'b'       - Move up one page
13 DOWN/'j'       - Move down one line
14 UP/'k'         - Move up one line
15 LEFT/'h'       - Scroll left
16 RIGHT/'l'      - Scroll right
17 '0'            - Move to beginning of line
18 HOME/'g'       - Move to beginning of file
19 END/'G'        - Move to end of file
20 '/'            - Forward search
21 '?'            - Backward search
22 'n'            - Repeat last search (forward)
23 'N'            - Repeat last search (backward)
24
25
26 The following is a sample text file:
27
28
29 EOF
30
31 cat ../COPYING | expand >> /tmp/textbox.tmp.$$
32
33 $DIALOG --clear --title "TEXT BOX" --textbox "/tmp/textbox.tmp.$$" 22 77
34
35 case $? in
36   0)
37     echo "OK";;
38   255)
39     echo "EXIT choosed.";;
40 esac
41
42 rm -f /tmp/textbox.tmp.$$