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