summaryrefslogtreecommitdiff
path: root/Build/source/utils/dialog/dialog-1.1-20080819/samples/editbox-utf8
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/utils/dialog/dialog-1.1-20080819/samples/editbox-utf8')
-rwxr-xr-xBuild/source/utils/dialog/dialog-1.1-20080819/samples/editbox-utf856
1 files changed, 56 insertions, 0 deletions
diff --git a/Build/source/utils/dialog/dialog-1.1-20080819/samples/editbox-utf8 b/Build/source/utils/dialog/dialog-1.1-20080819/samples/editbox-utf8
new file mode 100755
index 00000000000..6a005327f17
--- /dev/null
+++ b/Build/source/utils/dialog/dialog-1.1-20080819/samples/editbox-utf8
@@ -0,0 +1,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