xref: /freebsd/contrib/dialog/samples/textbox2 (revision 38f0b757fd84d17d0fc24739a7cda160c4516d81)
1#!/bin/sh
2# $Id: textbox2,v 1.8 2010/01/13 10:36:49 tom Exp $
3
4. ./setup-vars
5
6. ./setup-tempfile
7
8cat << EOF > $tempfile
9Hi, this is a text dialog box. It can be used to display text from a file.
10The file should not contain any 'tab' characters, so you should 'expand'
11the file first if it contains 'tab' characters.
12
13It's like a simple text file viewer, with these keys implemented:
14
15PGDN/SPACE     - Move down one page
16PGUP/'b'       - Move up one page
17ENTER/DOWN/'j' - Move down one line
18UP/'k'         - Move up one line
19LEFT/'h'       - Scroll left
20RIGHT/'l'      - Scroll right
21'0'            - Move to beginning of line
22HOME/'g'       - Move to beginning of file
23END/'G'        - Move to end of file
24'/'            - Forward search
25'?'            - Backward search
26'n'            - Repeat last search (forward)
27'N'            - Repeat last search (backward)
28
29
30The following is a sample text file:
31
32
33EOF
34
35TEXT=/usr/share/common-licenses/GPL
36test -f $TEXT || TEXT=../COPYING
37
38cat $TEXT | expand >> $tempfile
39
40$DIALOG --clear --title "TEXT BOX" "$@" --textbox "$tempfile" 0 0
41
42retval=$?
43
44. ./report-button
45