blob: 6a005327f177dbbf50f54eca8960bbc9baf2b809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/bin/sh
# $Id: editbox-utf8,v 1.1 2007/01/12 00:09:21 tom Exp $
: ${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15
case none"$LANG$LC_ALL$LC_CTYPE" in
*UTF-8*)
;;
*)
echo "This script must be run in a UTF-8 locale"
exit 1
;;
esac
input=`tempfile 2>/dev/null` || input=/tmp/input$$
output=`tempfile 2>/dev/null` || output=/tmp/test$$
trap "rm -f $input $output" 0 1 2 5 15
cat << EOF > $input
Hi, this is a edit box. You can use this to
allow the user to enter or modify free-form text.
Try it now!
----------- --------------------------------
Choose Description of the OS you like
----------- --------------------------------
Linux The Great Unix Clone for 386/486
NetBSD Another free Unix Clone for 386/486
OS/2 IBM OS/2
WIN NT Microsoft Windows NT
PCDOS IBM PC DOS
MSDOS Microsoft DOS
----------- --------------------------------
----------- --------------------------------
EOF
$DIALOG --title "EDIT BOX" \
--fixed-font --editbox $input 0 0 2>$output
case $? in
0)
diff -c $input $output
echo "OK"
;;
1)
echo "Button 1 (Cancel) pressed";;
2)
echo "Button 2 (Help) pressed";;
3)
echo "Button 3 (Extra) pressed";;
255)
echo "ESC pressed.";;
esac
|