diff options
Diffstat (limited to 'contrib/dialog/samples')
181 files changed, 6008 insertions, 0 deletions
diff --git a/contrib/dialog/samples/README b/contrib/dialog/samples/README new file mode 100644 index 0000000..604197c --- /dev/null +++ b/contrib/dialog/samples/README @@ -0,0 +1,7 @@ +-- $Id: README,v 1.4 2012/12/02 18:52:52 tom Exp $ + +You can set the environment-variable DIALOG to whatever program you +want to check. Default is "dialog". + +Use "export DIALOG=/usr/bin/dialog" for sh or "setenv DIALOG ../dialog" for csh +to test the /usr/bin/dialog program. diff --git a/contrib/dialog/samples/buildlist b/contrib/dialog/samples/buildlist new file mode 100755 index 0000000..72d871f --- /dev/null +++ b/contrib/dialog/samples/buildlist @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: buildlist,v 1.2 2012/12/04 11:45:21 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "BUILDLIST DEMO" --backtitle "A user-built list" \ + --separator "|" \ + --buildlist "hello, this is a --buildlist..." 0 0 0 \ + "1" "Item number 1" "on" \ + "2" "Item number 2" "off" \ + "3" "Item number 3" "on" \ + "4" "Item number 4" "on" \ + "5" "Item number 5" "off" \ + "6" "Item number 6" "on" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/buildlist2 b/contrib/dialog/samples/buildlist2 new file mode 100755 index 0000000..d5cbfb7 --- /dev/null +++ b/contrib/dialog/samples/buildlist2 @@ -0,0 +1,42 @@ +#!/bin/sh +# $Id: buildlist2,v 1.6 2012/12/23 22:28:12 tom Exp $ + +. ./setup-vars + +. ./setup-edit + +count=0 +ls -1 | while true +do + read filename + test -z "$filename" && break + case $filename in + *.*) + state=off + ;; + *-*) + state=on + ;; + *) + continue + ;; + esac + case "x$DIALOGOPTS" in + *--no-items*|*--noitem*) + echo $filename $state >>$input + ;; + *) + echo $count $filename $state >>$input + ;; + esac + count=`expr $count + 1` +done + +$DIALOG --title "BUILDLIST DEMO" --backtitle "A user-built list" \ + --visit-items --scrollbar --separator "|" \ + --buildlist "hello, this is a --buildlist..." 0 0 10 `cat $input` 2> $output + +retval=$? + +tempfile=$output +. ./report-tempfile diff --git a/contrib/dialog/samples/calendar b/contrib/dialog/samples/calendar new file mode 100755 index 0000000..e984bce --- /dev/null +++ b/contrib/dialog/samples/calendar @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: calendar,v 1.9 2010/01/13 10:20:33 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "CALENDAR" "$@" --calendar "Please choose a date..." 0 0 7 7 1981 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/calendar-stdout b/contrib/dialog/samples/calendar-stdout new file mode 100755 index 0000000..5dbbbce --- /dev/null +++ b/contrib/dialog/samples/calendar-stdout @@ -0,0 +1,9 @@ +#!/bin/sh +# $Id: calendar-stdout,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +RESULT=`$DIALOG --stdout --title "CALENDAR" "$@" --calendar "Please choose a date..." 0 0 7 7 1981` +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/calendar2 b/contrib/dialog/samples/calendar2 new file mode 100755 index 0000000..f6214ce --- /dev/null +++ b/contrib/dialog/samples/calendar2 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: calendar2,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "CALENDAR" "$@" --calendar "Please choose a date..." 0 0 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/calendar2-stdout b/contrib/dialog/samples/calendar2-stdout new file mode 100755 index 0000000..af731d9 --- /dev/null +++ b/contrib/dialog/samples/calendar2-stdout @@ -0,0 +1,9 @@ +#!/bin/sh +# $Id: calendar2-stdout,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +RESULT=`$DIALOG --stdout --title "CALENDAR" "$@" --calendar "Please choose a date..." 0 0` +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/calendar3 b/contrib/dialog/samples/calendar3 new file mode 100755 index 0000000..aece69c --- /dev/null +++ b/contrib/dialog/samples/calendar3 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: calendar3,v 1.9 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --extra-button --extra-label "Hold" --help-button --title "CALENDAR" "$@" --calendar "Please choose a date..." 0 0 7 7 1981 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/calendar3-stdout b/contrib/dialog/samples/calendar3-stdout new file mode 100755 index 0000000..4b7ecdb --- /dev/null +++ b/contrib/dialog/samples/calendar3-stdout @@ -0,0 +1,9 @@ +#!/bin/sh +# $Id: calendar3-stdout,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +RESULT=`$DIALOG --extra-button --extra-label "Hold" --help-button --stdout --title "CALENDAR" "$@" --calendar "Please choose a date..." 0 0 7 7 1981` +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/checklist b/contrib/dialog/samples/checklist new file mode 100755 index 0000000..be3c8c6 --- /dev/null +++ b/contrib/dialog/samples/checklist @@ -0,0 +1,28 @@ +#! /bin/sh +# $Id: checklist,v 1.14 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple." off \ + "Dog" "No, that's not my dog." ON \ + "Orange" "Yeah, that's juicy." off \ + "Chicken" "Normally not a pet." off \ + "Cat" "No, never put a dog and a cat together!" oN \ + "Fish" "Cats like fish." On \ + "Lemon" "You know how it tastes." on 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist-8bit b/contrib/dialog/samples/checklist-8bit new file mode 100755 index 0000000..20b23f1 --- /dev/null +++ b/contrib/dialog/samples/checklist-8bit @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: checklist-8bit,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./testdata-8bit + +$DIALOG --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "`./rotated-data 0 $SAMPLE`" "It's an `./rotated-data 0 $SAMPLE`." off \ + "`./rotated-data 1 $SAMPLE`" "No, that's not my `./rotated-data 1 $SAMPLE`." ON \ + "`./rotated-data 2 $SAMPLE`" "Yeah, that's `./rotated-data 2 $SAMPLE`." off \ + "`./rotated-data 3 $SAMPLE`" "Normally not a `./rotated-data 3 $SAMPLE`." off \ + "`./rotated-data 4 $SAMPLE`" "No, never put a `./rotated-data 4 $SAMPLE` there!" oN \ + "`./rotated-data 5 $SAMPLE`" "Cats like `./rotated-data 5 $SAMPLE`." On \ + "`./rotated-data 6 $SAMPLE`" "You `./rotated-data 6 $SAMPLE` how it is." on 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist-utf8 b/contrib/dialog/samples/checklist-utf8 new file mode 100755 index 0000000..12ed723 --- /dev/null +++ b/contrib/dialog/samples/checklist-utf8 @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: checklist-utf8,v 1.12 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./setup-utf8 + +$DIALOG --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "APPLE" "It's an APPLE." off \ + "DOG" "No, that's not my DOG." ON \ + "ORANGE" "Yeah, that's JUICY." off \ + "CHICKEN" "Normally not a PET." off \ + "CAT" "No, never put a DOG and a CAT together!" oN \ + "FISH" "Cats like FISH." On \ + "LEMON" "You KNOW how it TASTES." on 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist1 b/contrib/dialog/samples/checklist1 new file mode 100755 index 0000000..a0e19b6 --- /dev/null +++ b/contrib/dialog/samples/checklist1 @@ -0,0 +1,28 @@ +#! /bin/sh +# $Id: checklist1,v 1.10 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "" "It's an apple." off \ + "Dog" "No, that's not my dog." ON \ + "Orange" "Yeah, that's juicy." off \ + "Chicken" "" off \ + "Cat" "No, never put a dog and a cat together!" oN \ + "Fish" "Cats like fish." On \ + "Lemon" "You know how it tastes." on 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist10 b/contrib/dialog/samples/checklist10 new file mode 100755 index 0000000..2ebd5575 --- /dev/null +++ b/contrib/dialog/samples/checklist10 @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: checklist10,v 1.9 2010/01/13 10:20:03 tom Exp $ +# zero-width column + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG \ + --backtitle "No such organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + Dialog "" on \ + Readline "" off \ + Gnome "" off \ + Kde "" off \ + Editor "" off \ + Noninteractive "" on \ + 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist11 b/contrib/dialog/samples/checklist11 new file mode 100755 index 0000000..85e2349 --- /dev/null +++ b/contrib/dialog/samples/checklist11 @@ -0,0 +1,33 @@ +#! /bin/sh +# $Id: checklist11,v 1.1 2010/01/17 23:04:01 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "" "It's an apple." off \ + "Dog" "No1, that's not my dog." ON \ + "Dog2" "No2, that's not my dog." OFF \ + "Dog3" "No3, that's not my dog." OFF \ + "Dog4" "No4, that's not my dog." OFF \ + "Dog5" "No5, that's not my dog." OFF \ + "Dog6" "No6, that's not my dog." OFF \ + "Orange" "Yeah, that's juicy." off \ + "Chicken" "" off \ + "Cat" "No, never put a dog and a cat together!" oN \ + "Fish" "Cats like fish." On \ + "Lemon" "You know how it tastes." on 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist12 b/contrib/dialog/samples/checklist12 new file mode 100755 index 0000000..e23f88b --- /dev/null +++ b/contrib/dialog/samples/checklist12 @@ -0,0 +1,44 @@ +#! /bin/sh +# $Id: checklist12,v 1.3 2012/12/23 22:27:51 tom Exp $ + +. ./setup-vars + +. ./setup-edit + +case "x$DIALOGOPTS" in +*--no-items*|*--noitem*) + CUT="cut -d: -f1,3" + ;; +*) + CUT="cat" + ;; +esac + +$CUT >$input <<-EOF + Apple:It's an apple.:off + Dog:No, that's not my dog.:ON + Orange:Yeah, that's juicy.:off + Chicken:Normally not a pet.:off + Cat:No, never put a dog and a cat together!:oN + Fish:Cats like fish.:On + Lemon:You know how it tastes.:on +EOF +cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$output +cat $output >$input + +$DIALOG --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + --file $input 2> $output + +retval=$? + +tempfile=$output +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist2 b/contrib/dialog/samples/checklist2 new file mode 100755 index 0000000..c672a68 --- /dev/null +++ b/contrib/dialog/samples/checklist2 @@ -0,0 +1,28 @@ +#! /bin/sh +# $Id: checklist2,v 1.11 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --item-help --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple." off "fruit" \ + "Dog" "No, that's not my dog." ON "not a fruit" \ + "Orange" "Yeah, that's juicy." off "fruit" \ + "Chicken" "Normally not a pet." off "not a fruit" \ + "Cat" "No, never put a dog and a cat together!" oN "not a fruit" \ + "Fish" "Cats like fish." On "not a fruit" \ + "Lemon" "You know how it tastes." on "the only one you wouldn't eat" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist3 b/contrib/dialog/samples/checklist3 new file mode 100755 index 0000000..ce713d4 --- /dev/null +++ b/contrib/dialog/samples/checklist3 @@ -0,0 +1,28 @@ +#! /bin/sh +# $Id: checklist3,v 1.11 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --item-help --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Dog" "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ON "not a fruit" \ + "Orange" "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Chicken" "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not a fruit" \ + "Cat" "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN "not a fruit" \ + "Fish" "Cats like fish. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" On "not a fruit" \ + "Lemon" "You know how it tastes. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" on "the only one you wouldn't eat" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist4 b/contrib/dialog/samples/checklist4 new file mode 100755 index 0000000..53adeed --- /dev/null +++ b/contrib/dialog/samples/checklist4 @@ -0,0 +1,28 @@ +#! /bin/sh +# $Id: checklist4,v 1.12 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --help-button --item-help --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Dog" "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ON "not a fruit" \ + "Orange" "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Chicken" "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not a fruit" \ + "Cat" "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN "not a fruit" \ + "Fish" "Cats like fish. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" On "not a fruit" \ + "Lemon" "You know how it tastes. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" on "the only one you wouldn't eat" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist5 b/contrib/dialog/samples/checklist5 new file mode 100755 index 0000000..3890c85 --- /dev/null +++ b/contrib/dialog/samples/checklist5 @@ -0,0 +1,29 @@ +#! /bin/sh +# $Id: checklist5,v 1.11 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --help-button --item-help --backtitle "No Such Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Dog" "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ON "not a fruit" \ + "Orange" "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Chicken" "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not a fruit" \ + "" "No such pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not anything" \ + "Cat" "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN "not a fruit" \ + "Fish" "Cats like fish. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" On "not a fruit" \ + "Lemon" "You know how it tastes. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" on "the only one you wouldn't eat" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist6 b/contrib/dialog/samples/checklist6 new file mode 100755 index 0000000..1a05d06 --- /dev/null +++ b/contrib/dialog/samples/checklist6 @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: checklist6,v 1.11 2010/01/13 10:20:03 tom Exp $ +# example showing the --colors option + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --help-button --item-help --colors --backtitle "\Z1No Such\Zn Organization" \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +\Z4UP/DOWN\Zn arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press \Zb\ZrSPACE\Zn to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an \Z1apple\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Dog" "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ON "not a fruit" \ + "Orange" "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Chicken" "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not a fruit" \ + "" "No such pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not anything" \ + "Cat" "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN "not a fruit" \ + "Fish" "Cats like \Z4fish\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" On "not a fruit" \ + "Lemon" "You know how it \Zr\Zb\Z3tastes\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" on "the only one you wouldn't eat" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist7 b/contrib/dialog/samples/checklist7 new file mode 100755 index 0000000..1080b7e --- /dev/null +++ b/contrib/dialog/samples/checklist7 @@ -0,0 +1,34 @@ +#! /bin/sh +# $Id: checklist7,v 1.11 2010/01/13 10:20:03 tom Exp $ +# "checklist6" with --separate-output + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --help-button \ + --item-help \ + --colors \ + --backtitle "\Z1No Such\Zn Organization" \ + --separate-output \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +\Z4UP/DOWN\Zn arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press \Zb\ZrSPACE\Zn to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an \Z1apple\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Dog" "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ON "not a fruit" \ + "Orange" "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "fruit" \ + "Chicken" "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not a fruit" \ + "" "No such pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off "not anything" \ + "Cat" "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN "not a fruit" \ + "Fish" "Cats like \Z4fish\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" On "not a fruit" \ + "Lemon" "You know how it \Zr\Zb\Z3tastes\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" on "the only one you wouldn't eat" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist8 b/contrib/dialog/samples/checklist8 new file mode 100755 index 0000000..2ec1bbd --- /dev/null +++ b/contrib/dialog/samples/checklist8 @@ -0,0 +1,33 @@ +#! /bin/sh +# $Id: checklist8,v 1.10 2010/01/13 10:20:03 tom Exp $ +# "checklist7" without --item-help + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --help-button \ + --colors \ + --backtitle "\Z1No Such\Zn Organization" \ + --separate-output \ + --title "CHECKLIST BOX" "$@" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +\Z4UP/DOWN\Zn arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press \Zb\ZrSPACE\Zn to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an \Z1apple\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "Dog" "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ON \ + "Orange" "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "Chicken" "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "" "No such pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "Cat" "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN \ + "Fish" "Cats like \Z4fish\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" On \ + "Lemon" "You know how it \Zr\Zb\Z3tastes\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" on 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist9 b/contrib/dialog/samples/checklist9 new file mode 100755 index 0000000..e8d913f --- /dev/null +++ b/contrib/dialog/samples/checklist9 @@ -0,0 +1,13 @@ +#! /bin/sh +# $Id: checklist9,v 1.8 2010/01/13 10:20:03 tom Exp $ +# "checklist8" using --file + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG "$@" --file checklist9.txt 2>$tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/checklist9.txt b/contrib/dialog/samples/checklist9.txt new file mode 100644 index 0000000..cdb2652 --- /dev/null +++ b/contrib/dialog/samples/checklist9.txt @@ -0,0 +1,21 @@ +--help-button \ + --colors \ + --backtitle "\Z1No Such\Zn Organization" \ + --separate-output \ + --title "CHECKLIST BOX" \ + --checklist "Hi, this is a checklist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +\Z4UP/DOWN\Zn arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press \Zb\ZrSPACE\Zn to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an \Z1apple\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "Dog" "No, that's not my dog. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ON \ + "Orange" "Yeah, that's juicy. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "Chicken" "Normally not a pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "" "No such pet. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" off \ + "Cat" "No, never put a dog and a cat together! xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" oN \ + "Fish" "Cats like \Z4fish\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" On \ + "Lemon" "You know how it \Zr\Zb\Z3tastes\Zn. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" on diff --git a/contrib/dialog/samples/debian.rc b/contrib/dialog/samples/debian.rc new file mode 100644 index 0000000..195d798 --- /dev/null +++ b/contrib/dialog/samples/debian.rc @@ -0,0 +1,143 @@ +# $Id: debian.rc,v 1.7 2011/10/15 01:00:09 tom Exp $ +# vile:confmode +# Run-time configuration file for dialog, matches Debian color scheme. +# (these are the default values for dialog) +# +# Types of values: +# +# Number - <number> +# String - "string" +# Boolean - <ON|OFF> +# Attribute - (foreground,background,highlight?) + +# Set aspect-ration. +aspect = 0 + +# Set separator (for multiple widgets output). +separate_widget = "" + +# Set tab-length (for textbox tab-conversion). +tab_len = 0 + +# Make tab-traversal for checklist, etc., include the list. +visit_items = OFF + +# Shadow dialog boxes? This also turns on color. +use_shadow = ON + +# Turn color support ON or OFF +use_colors = ON + +# Screen color +screen_color = (CYAN,BLUE,ON) + +# Shadow color +shadow_color = (BLACK,BLACK,ON) + +# Dialog box color +dialog_color = (BLACK,WHITE,OFF) + +# Dialog box title color +title_color = (BLUE,WHITE,ON) + +# Dialog box border color +border_color = (WHITE,WHITE,ON) + +# Active button color +button_active_color = (WHITE,BLUE,ON) + +# Inactive button color +button_inactive_color = dialog_color + +# Active button key color +button_key_active_color = button_active_color + +# Inactive button key color +button_key_inactive_color = (RED,WHITE,OFF) + +# Active button label color +button_label_active_color = (YELLOW,BLUE,ON) + +# Inactive button label color +button_label_inactive_color = (BLACK,WHITE,ON) + +# Input box color +inputbox_color = dialog_color + +# Input box border color +inputbox_border_color = dialog_color + +# Search box color +searchbox_color = dialog_color + +# Search box title color +searchbox_title_color = title_color + +# Search box border color +searchbox_border_color = border_color + +# File position indicator color +position_indicator_color = title_color + +# Menu box color +menubox_color = dialog_color + +# Menu box border color +menubox_border_color = border_color + +# Item color +item_color = dialog_color + +# Selected item color +item_selected_color = button_active_color + +# Tag color +tag_color = title_color + +# Selected tag color +tag_selected_color = button_label_active_color + +# Tag key color +tag_key_color = button_key_inactive_color + +# Selected tag key color +tag_key_selected_color = (RED,BLUE,ON) + +# Check box color +check_color = dialog_color + +# Selected check box color +check_selected_color = button_active_color + +# Up arrow color +uarrow_color = (GREEN,WHITE,ON) + +# Down arrow color +darrow_color = uarrow_color + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = button_active_color + +# Form text color +form_text_color = (WHITE,CYAN,ON) + +# Readonly form item color +form_item_readonly_color = (CYAN,WHITE,ON) + +# Dialog box gauge color +gauge_color = title_color + +# Dialog box border2 color +border2_color = dialog_color + +# Input box border2 color +inputbox_border2_color = dialog_color + +# Search box border2 color +searchbox_border2_color = dialog_color + +# Menu box border2 color +menubox_border2_color = dialog_color diff --git a/contrib/dialog/samples/dft-cancel b/contrib/dialog/samples/dft-cancel new file mode 100755 index 0000000..2b317fc --- /dev/null +++ b/contrib/dialog/samples/dft-cancel @@ -0,0 +1,3 @@ +#!/bin/sh +# $Id: dft-cancel,v 1.2 2012/07/03 09:44:02 tom Exp $ +DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --default-button cancel" "$@" diff --git a/contrib/dialog/samples/dft-extra b/contrib/dialog/samples/dft-extra new file mode 100755 index 0000000..de08cd7 --- /dev/null +++ b/contrib/dialog/samples/dft-extra @@ -0,0 +1,3 @@ +#!/bin/sh +# $Id: dft-extra,v 1.2 2012/07/03 09:44:02 tom Exp $ +DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --default-button extra" "$@" diff --git a/contrib/dialog/samples/dft-help b/contrib/dialog/samples/dft-help new file mode 100755 index 0000000..cade8a7 --- /dev/null +++ b/contrib/dialog/samples/dft-help @@ -0,0 +1,3 @@ +#!/bin/sh +# $Id: dft-help,v 1.2 2012/07/03 09:44:02 tom Exp $ +DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --default-button help" "$@" diff --git a/contrib/dialog/samples/dft-no b/contrib/dialog/samples/dft-no new file mode 100755 index 0000000..172bcb2 --- /dev/null +++ b/contrib/dialog/samples/dft-no @@ -0,0 +1,3 @@ +#!/bin/sh +# $Id: dft-no,v 1.2 2012/07/03 09:44:02 tom Exp $ +DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --defaultno" "$@" diff --git a/contrib/dialog/samples/dialog.py b/contrib/dialog/samples/dialog.py new file mode 100644 index 0000000..5286b41 --- /dev/null +++ b/contrib/dialog/samples/dialog.py @@ -0,0 +1,354 @@ +#!/usr/bin/python +# $Id: dialog.py,v 1.4 2012/06/29 09:33:18 tom Exp $ +# Module: dialog.py +# Copyright (c) 2000 Robb Shecter <robb@acm.org> +# All rights reserved. +# This source is covered by the GNU GPL. +# +# This module is a Python wrapper around the Linux "dialog" utility +# by Savio Lam and Stuart Herbert. My goals were to make dialog as +# easy to use from Python as possible. The demo code at the end of +# the module is a good example of how to use it. To run the demo, +# execute: +# +# python dialog.py +# +# This module has one class in it, "Dialog". An application typically +# creates an instance of it, and possibly sets the background title option. +# Then, methods can be called on it for interacting with the user. +# +# I wrote this because I want to use my 486-33 laptop as my main +# development computer (!), and I wanted a way to nicely interact with the +# user in console mode. There are apparently other modules out there +# with similar functionality, but they require the Python curses library. +# Writing this module from scratch was easier than figuring out how to +# recompile Python with curses enabled. :) +# +# One interesting feature is that the menu and selection windows allow +# *any* objects to be displayed and selected, not just strings. +# +# TO DO: +# Add code so that the input buffer is flushed before a dialog box is +# shown. This would make the UI more predictable for users. This +# feature could be turned on and off through an instance method. +# Drop using temporary files when interacting with 'dialog' +# (it's possible -- I've already tried :-). +# Try detecting the terminal window size in order to make reasonable +# height and width defaults. Hmmm - should also then check for +# terminal resizing... +# Put into a package name to make more reusable - reduce the possibility +# of name collisions. +# +# NOTES: +# there is a bug in (at least) Linux-Mandrake 7.0 Russian Edition +# running on AMD K6-2 3D that causes core dump when 'dialog' +# is running with --gauge option; +# in this case you'll have to recompile 'dialog' program. +# +# Modifications: +# Jul 2000, Sultanbek Tezadov (http://sultan.da.ru) +# Added: +# - 'gauge' widget *) +# - 'title' option to some widgets +# - 'checked' option to checklist dialog; clicking "Cancel" is now +# recognizable +# - 'selected' option to radiolist dialog; clicking "Cancel" is now +# recognizable +# - some other cosmetic changes and improvements +# + +import os +from tempfile import mktemp +from string import split +from time import sleep + +# +# Path of the dialog executable +# +DIALOG = os.getenv("DIALOG"); +if DIALOG is None: + DIALOG="../dialog"; + +class Dialog: + def __init__(self): + self.__bgTitle = '' # Default is no background title + + + def setBackgroundTitle(self, text): + self.__bgTitle = '--backtitle "%s"' % text + + + def __perform(self, cmd): + """Do the actual work of invoking dialog and getting the output.""" + fName = mktemp() + rv = os.system('%s %s %s 2> %s' % (DIALOG, self.__bgTitle, cmd, fName)) + f = open(fName) + output = f.readlines() + f.close() + os.unlink(fName) + return (rv, output) + + + def __perform_no_options(self, cmd): + """Call dialog w/out passing any more options. Needed by --clear.""" + return os.system(DIALOG + ' ' + cmd) + + + def __handleTitle(self, title): + if len(title) == 0: + return '' + else: + return '--title "%s" ' % title + + + def yesno(self, text, height=10, width=30, title=''): + """ + Put a Yes/No question to the user. + Uses the dialog --yesno option. + Returns a 1 or a 0. + """ + (code, output) = self.__perform(self.__handleTitle(title) +\ + '--yesno "%s" %d %d' % (text, height, width)) + return code == 0 + + + def msgbox(self, text, height=10, width=30, title=''): + """ + Pop up a message to the user which has to be clicked + away with "ok". + """ + self.__perform(self.__handleTitle(title) +\ + '--msgbox "%s" %d %d' % (text, height, width)) + + + def infobox(self, text, height=10, width=30): + """Make a message to the user, and return immediately.""" + self.__perform('--infobox "%s" %d %d' % (text, height, width)) + + + def inputbox(self, text, height=10, width=30, init='', title=''): + """ + Request a line of input from the user. + Returns the user's input or None if cancel was chosen. + """ + (c, o) = self.__perform(self.__handleTitle(title) +\ + '--inputbox "%s" %d %d "%s"' % (text, height, width, init)) + try: + return o[0] + except IndexError: + if c == 0: # empty string entered + return '' + else: # canceled + return None + + + def textbox(self, filename, height=20, width=60, title=None): + """Display a file in a scrolling text box.""" + if title is None: + title = filename + self.__perform(self.__handleTitle(title) +\ + ' --textbox "%s" %d %d' % (filename, height, width)) + + + def menu(self, text, height=15, width=54, list=[]): + """ + Display a menu of options to the user. This method simplifies the + --menu option of dialog, which allows for complex arguments. This + method receives a simple list of objects, and each one is assigned + a choice number. + The selected object is returned, or None if the dialog was canceled. + """ + menuheight = height - 8 + pairs = map(lambda i, item: (i + 1, item), range(len(list)), list) + choices = reduce(lambda res, pair: res + '%d "%s" ' % pair, pairs, '') + (code, output) = self.__perform('--menu "%s" %d %d %d %s' %\ + (text, height, width, menuheight, choices)) + try: + return list[int(output[0]) - 1] + except IndexError: + return None + + + def checklist(self, text, height=15, width=54, list=[], checked=None): + """ + Returns a list of the selected objects. + Returns an empty list if nothing was selected. + Returns None if the window was canceled. + checked -- a list of boolean (0/1) values; len(checked) must equal + len(list). + """ + if checked is None: + checked = [0]*len(list) + menuheight = height - 8 + triples = map( + lambda i, item, onoff, fs=('off', 'on'): (i + 1, item, fs[onoff]), + range(len(list)), list, checked) + choices = reduce(lambda res, triple: res + '%d "%s" %s ' % triple, + triples, '') + (c, o) = self.__perform('--checklist "%s" %d %d %d %s' %\ + (text, height, width, menuheight, choices)) + try: + output = o[0] + indexList = map(lambda x: int(x[1:-1]), split(output)) + objectList = filter(lambda item, list=list, indexList=indexList: + list.index(item) + 1 in indexList, + list) + return objectList + except IndexError: + if c == 0: # Nothing was selected + return [] + return None # Was canceled + + + def radiolist(self, text, height=15, width=54, list=[], selected=0): + """ + Return the selected object. + Returns empty string if no choice was selected. + Returns None if window was canceled. + selected -- the selected item (must be between 1 and len(list) + or 0, meaning no selection). + """ + menuheight = height - 8 + triples = map(lambda i, item: (i + 1, item, 'off'), + range(len(list)), list) + if selected: + i, item, tmp = triples[selected - 1] + triples[selected - 1] = (i, item, 'on') + choices = reduce(lambda res, triple: res + '%d "%s" %s ' % triple, + triples, '') + (c, o) = self.__perform('--radiolist "%s" %d %d %d %s' %\ + (text, height, width, menuheight, choices)) + try: + return list[int(o[0]) - 1] + except IndexError: + if c == 0: + return '' + return None + + + def clear(self): + """ + Clear the screen. Equivalent to the dialog --clear option. + """ + self.__perform_no_options('--clear') + + + def scrollbox(self, text, height=20, width=60, title=''): + """ + This is a bonus method. The dialog package only has a function to + display a file in a scrolling text field. This method allows any + string to be displayed by first saving it in a temp file, and calling + --textbox. + """ + fName = mktemp() + f = open(fName, 'w') + f.write(text) + f.close() + self.__perform(self.__handleTitle(title) +\ + '--textbox "%s" %d %d' % (fName, height, width)) + os.unlink(fName) + + + def gauge_start(self, perc=0, text='', height=8, width=54, title=''): + """ + Display gauge output window. + Gauge normal usage (assuming that there is an instace of 'Dialog' + class named 'd'): + d.gauge_start() + # do something + d.gauge_iterate(10) # passed throgh 10% + # ... + d.gauge_iterate(100, 'any text here') # work is done + d.stop_gauge() # clean-up actions + """ + cmd = self.__handleTitle(title) +\ + '--gauge "%s" %d %d %d' % (text, height, width, perc) + cmd = '%s %s %s 2> /dev/null' % (DIALOG, self.__bgTitle, cmd) + self.pipe = os.popen(cmd, 'w') + #/gauge_start() + + + def gauge_iterate(self, perc, text=''): + """ + Update percentage point value. + + See gauge_start() function above for the usage. + """ + if text: + text = 'XXX\n%d\n%s\nXXX\n' % (perc, text) + else: + text = '%d\n' % perc + self.pipe.write(text) + self.pipe.flush() + #/gauge_iterate() + + + def gauge_stop(self): + """ + Finish previously started gauge. + + See gauge_start() function above for the usage. + """ + self.pipe.close() + #/gauge_stop() + + + +# +# DEMO APPLICATION +# +if __name__ == '__main__': + """ + This demo tests all the features of the class. + """ + d = Dialog() + d.setBackgroundTitle('dialog.py demo') + + d.infobox( + "One moment... Just wasting some time here to test the infobox...") + sleep(3) + + if d.yesno("Do you like this demo?"): + d.msgbox("Excellent! Here's the source code:") + else: + d.msgbox("Send your complaints to /dev/null") + + d.textbox("dialog.py") + + name = d.inputbox("What's your name?", init="Snow White") + fday = d.menu("What's your favorite day of the week?", + list=["Monday", "Tuesday", "Wednesday", "Thursday", + "Friday (The best day of all)", "Saturday", "Sunday"]) + food = d.checklist("What sandwich toppings do you like?", + list=["Catsup", "Mustard", "Pesto", "Mayonaise", "Horse radish", + "Sun-dried tomatoes"], checked=[0,0,0,1,1,1]) + sand = d.radiolist("What's your favorite kind of sandwich?", + list=["Hamburger", "Hotdog", "Burrito", "Doener", "Falafel", + "Bagel", "Big Mac", "Whopper", "Quarter Pounder", + "Peanut Butter and Jelly", "Grilled cheese"], selected=4) + + # Prepare the message for the final window + bigMessage = "Here are some vital statistics about you:\n\nName: " + name +\ + "\nFavorite day of the week: " + fday +\ + "\nFavorite sandwich toppings:\n" + for topping in food: + bigMessage = bigMessage + " " + topping + "\n" + bigMessage = bigMessage + "Favorite sandwich: " + str(sand) + + d.scrollbox(bigMessage) + + #<># Gauge Demo + d.gauge_start(0, 'percentage: 0', title='Gauge Demo') + for i in range(1, 101): + if i < 50: + msg = 'percentage: %d' % i + elif i == 50: + msg = 'Over 50%' + else: + msg = '' + d.gauge_iterate(i, msg) + sleep(0.1) + d.gauge_stop() + #<># + + d.clear() diff --git a/contrib/dialog/samples/editbox b/contrib/dialog/samples/editbox new file mode 100755 index 0000000..8ae4c63 --- /dev/null +++ b/contrib/dialog/samples/editbox @@ -0,0 +1,45 @@ +#!/bin/sh +# $Id: editbox,v 1.13 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +DIALOG_ERROR=254 +export DIALOG_ERROR + +. ./setup-edit + +cat << EOF > $input +Hi, this is an edit box. It can be used to edit text from a file. + +It's like a simple text editor, with these keys implemented: + +PGDN - Move down one page +PGUP - Move up one page +DOWN - Move down one line +UP - Move up one line +DELETE - Delete the current character +BACKSPC - Delete the previous character + +Unlike Xdialog, it does not do these: + +CTRL C - Copy text +CTRL V - Paste text + +Because dialog normally uses TAB for moving between fields, +this editbox uses CTRL/V as a literal-next character. You +can enter TAB characters by first pressing CTRL/V. This +example contains a few tab characters. + +It supports the mouse - but only for positioning in the editbox, +or for clicking on buttons. Your terminal (emulator) may support +cut/paste. + +Try to input some text below: + +EOF + +$DIALOG --title "EDIT BOX" \ + --fixed-font "$@" --editbox $input 0 0 2>$output +retval=$? + +. ./report-edit diff --git a/contrib/dialog/samples/editbox-utf8 b/contrib/dialog/samples/editbox-utf8 new file mode 100755 index 0000000..94f2fab --- /dev/null +++ b/contrib/dialog/samples/editbox-utf8 @@ -0,0 +1,35 @@ +#!/bin/sh +# $Id: editbox-utf8,v 1.9 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./setup-utf8 + +. ./setup-edit + +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 +retval=$? + +. ./report-edit diff --git a/contrib/dialog/samples/editbox2 b/contrib/dialog/samples/editbox2 new file mode 100755 index 0000000..6662394 --- /dev/null +++ b/contrib/dialog/samples/editbox2 @@ -0,0 +1,45 @@ +#!/bin/sh +# $Id: editbox2,v 1.7 2010/01/13 10:20:03 tom Exp $ +# example with extra- and help-buttons + +. ./setup-vars + +. ./setup-edit + +cat << EOF > $input +Hi, this is an edit box. It can be used to edit text from a file. + +It's like a simple text editor, with these keys implemented: + +PGDN - Move down one page +PGUP - Move up one page +DOWN - Move down one line +UP - Move up one line +DELETE - Delete the current character +BACKSPC - Delete the previous character + +Unlike Xdialog, it does not do these: + +CTRL C - Copy text +CTRL V - Paste text + +Because dialog normally uses TAB for moving between fields, +this editbox uses CTRL/V as a literal-next character. You +can enter TAB characters by first pressing CTRL/V. This +example contains a few tab characters. + +It supports the mouse - but only for positioning in the editbox, +or for clicking on buttons. Your terminal (emulator) may support +cut/paste. + +Try to input some text below: + +EOF + +$DIALOG --title "EDIT BOX" \ + --extra-button \ + --help-button \ + --fixed-font "$@" --editbox $input 0 0 2>$output +retval=$? + +. ./report-edit diff --git a/contrib/dialog/samples/editbox3 b/contrib/dialog/samples/editbox3 new file mode 100755 index 0000000..aba30bd --- /dev/null +++ b/contrib/dialog/samples/editbox3 @@ -0,0 +1,18 @@ +#!/bin/sh +# $Id: editbox3,v 1.7 2010/01/13 10:20:03 tom Exp $ +# example with extra- and help-buttons + +. ./setup-vars + +. ./setup-edit + +cat << EOF > $input +EOF + +$DIALOG --title "EDIT BOX" \ + --extra-button \ + --help-button \ + --fixed-font "$@" --editbox $input 0 0 2>$output +retval=$? + +. ./report-edit diff --git a/contrib/dialog/samples/editbox4 b/contrib/dialog/samples/editbox4 new file mode 100755 index 0000000..8153fac --- /dev/null +++ b/contrib/dialog/samples/editbox4 @@ -0,0 +1,45 @@ +#!/bin/sh +# $Id: editbox4,v 1.1 2010/01/17 22:29:50 tom Exp $ + +. ./setup-vars + +DIALOG_ERROR=254 +export DIALOG_ERROR + +. ./setup-edit + +cat << EOF > $input +Hi, this is an edit box. It can be used to edit text from a file. + +It's like a simple text editor, with these keys implemented: + +PGDN - Move down one page +PGUP - Move up one page +DOWN - Move down one line +UP - Move up one line +DELETE - Delete the current character +BACKSPC - Delete the previous character + +Unlike Xdialog, it does not do these: + +CTRL C - Copy text +CTRL V - Paste text + +Because dialog normally uses TAB for moving between fields, +this editbox uses CTRL/V as a literal-next character. You +can enter TAB characters by first pressing CTRL/V. This +example contains a few tab characters. + +It supports the mouse - but only for positioning in the editbox, +or for clicking on buttons. Your terminal (emulator) may support +cut/paste. + +Try to input some text below: + +EOF + +$DIALOG --title "EDIT BOX" \ + --fixed-font "$@" --editbox $input 20 40 2>$output +retval=$? + +. ./report-edit diff --git a/contrib/dialog/samples/form1 b/contrib/dialog/samples/form1 new file mode 100755 index 0000000..38e2364 --- /dev/null +++ b/contrib/dialog/samples/form1 @@ -0,0 +1,79 @@ +#! /bin/sh +# $Id: form1,v 1.15 2011/10/04 23:36:53 tom Exp $ + +. ./setup-vars + +DIALOG_ERROR=254 +export DIALOG_ERROR + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + $DIALOG_ERROR) + echo "ERROR!$value" + exit + ;; + $DIALOG_ESC) + echo "ESC pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form1-both b/contrib/dialog/samples/form1-both new file mode 100755 index 0000000..f571830 --- /dev/null +++ b/contrib/dialog/samples/form1-both @@ -0,0 +1,69 @@ +#! /bin/sh +# $Id: form1-both,v 1.5 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --extra-button --help-button \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form1-extra b/contrib/dialog/samples/form1-extra new file mode 100755 index 0000000..ca180a9 --- /dev/null +++ b/contrib/dialog/samples/form1-extra @@ -0,0 +1,69 @@ +#! /bin/sh +# $Id: form1-extra,v 1.5 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --extra-button \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form1-help b/contrib/dialog/samples/form1-help new file mode 100755 index 0000000..44c5543 --- /dev/null +++ b/contrib/dialog/samples/form1-help @@ -0,0 +1,69 @@ +#! /bin/sh +# $Id: form1-help,v 1.5 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --help-button \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form1-utf8 b/contrib/dialog/samples/form1-utf8 new file mode 100755 index 0000000..a2be4a6 --- /dev/null +++ b/contrib/dialog/samples/form1-utf8 @@ -0,0 +1,71 @@ +#! /bin/sh +# $Id: form1-utf8,v 1.7 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +. ./setup-utf8 + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="DOG" +home=/usr/home/$user + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --backtitle "$backtitle" \ + --insecure "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form2 b/contrib/dialog/samples/form2 new file mode 100755 index 0000000..a005be3 --- /dev/null +++ b/contrib/dialog/samples/form2 @@ -0,0 +1,84 @@ +#! /bin/sh +# $Id: form2,v 1.9 2010/01/13 10:53:11 tom Exp $ + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +0 0 10 \ + "1 Username:" 1 1 "$user" 1 12 10 10 \ + "1 UID:" 2 1 "$uid" 2 12 10 10 \ + "1 GID:" 3 1 "$gid" 3 12 10 10 \ + "1 HOME:" 4 1 "$home" 4 12 10 10 \ + "2 Username:" 5 1 "$user" 5 12 10 10 \ + "2 UID:" 6 1 "$uid" 6 12 10 10 \ + "2 GID:" 7 1 "$gid" 7 12 10 10 \ + "2 HOME:" 8 1 "$home" 8 12 10 10 \ + "3 Username:" 9 1 "$user" 9 12 10 10 \ + "3 UID:" 10 1 "$uid" 10 12 10 10 \ + "3 GID:" 11 1 "$gid" 11 12 10 10 \ + "3 HOME:" 12 1 "$home" 12 12 10 10 \ + "4 Username:" 13 1 "$user" 13 12 10 10 \ + "4 UID:" 14 1 "$uid" 14 12 10 10 \ + "4 GID:" 15 1 "$gid" 15 12 10 10 \ + "4 HOME:" 16 1 "$home" 16 12 10 10 \ + "5 Username:" 17 1 "$user" 17 12 10 10 \ + "5 UID:" 18 1 "$uid" 18 12 10 10 \ + "5 GID:" 19 1 "$gid" 19 12 10 10 \ + "5 HOME:" 20 1 "$home" 20 12 10 10 \ + "6 Username:" 21 1 "$user" 21 12 10 10 \ + "6 UID:" 22 1 "$uid" 22 12 10 10 \ + "6 GID:" 23 1 "$gid" 23 12 10 10 \ + "6 HOME:" 24 1 "$home" 24 12 10 10 \ + "7 Username:" 25 1 "$user" 25 12 10 10 \ + "7 UID:" 26 1 "$uid" 26 12 10 10 \ + "7 GID:" 27 1 "$gid" 27 12 10 10 \ + "7 HOME:" 28 1 "$home" 28 12 10 10 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 0 0 + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form3 b/contrib/dialog/samples/form3 new file mode 100755 index 0000000..c3ac6d5 --- /dev/null +++ b/contrib/dialog/samples/form3 @@ -0,0 +1,69 @@ +#! /bin/sh +# $Id: form3,v 1.6 2010/01/13 10:49:52 tom Exp $ +# form1 with --help-button + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --help-button \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Help data:\n\ +$show" 10 40 + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form4 b/contrib/dialog/samples/form4 new file mode 100755 index 0000000..a733865 --- /dev/null +++ b/contrib/dialog/samples/form4 @@ -0,0 +1,70 @@ +#! /bin/sh +# $Id: form4,v 1.6 2010/01/13 10:49:52 tom Exp $ +# form3 with --item-help + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --help-button \ + --item-help \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 "Login name" \ + "UID:" 2 1 "$uid" 2 10 8 0 "User ID" \ + "GID:" 3 1 "$gid" 3 10 8 0 "Group ID" \ + "HOME:" 4 1 "$home" 4 10 40 0 "User's home-directory" \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Help data:\n\ +$show" 10 40 + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form5 b/contrib/dialog/samples/form5 new file mode 100755 index 0000000..649c387 --- /dev/null +++ b/contrib/dialog/samples/form5 @@ -0,0 +1,71 @@ +#! /bin/sh +# $Id: form5,v 1.6 2010/01/13 10:49:52 tom Exp $ +# form4 with --help-status + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --help-status \ + --help-button \ + --item-help \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 "Login name" \ + "UID:" 2 1 "$uid" 2 10 8 0 "User ID" \ + "GID:" 3 1 "$gid" 3 10 8 0 "Group ID" \ + "HOME:" 4 1 "$home" 4 10 40 0 "User's home-directory" \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Help data:\n\ +$show" 10 40 + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/form6 b/contrib/dialog/samples/form6 new file mode 100755 index 0000000..8b5483f --- /dev/null +++ b/contrib/dialog/samples/form6 @@ -0,0 +1,71 @@ +#! /bin/sh +# $Id: form6,v 1.5 2010/01/13 10:49:52 tom Exp $ +# form4 with --help-status + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --help-status \ + --help-button \ + --item-help \ + --backtitle "$backtitle" "$@" \ + --form "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 -9 9 "Login name" \ + "UID:" 2 1 "$uid" 2 10 8 0 "User ID" \ + "GID:" 3 1 "$gid" 3 10 8 0 "Group ID" \ + "HOME:" 4 1 "$home" 4 10 40 0 "User's home-directory" \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Help data:\n\ +$show" 10 40 + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/fselect b/contrib/dialog/samples/fselect new file mode 100755 index 0000000..20b8304 --- /dev/null +++ b/contrib/dialog/samples/fselect @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: fselect,v 1.11 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "Please choose a file" "$@" --fselect $HOME/ 14 48 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/fselect-stdout b/contrib/dialog/samples/fselect-stdout new file mode 100755 index 0000000..02eefdb --- /dev/null +++ b/contrib/dialog/samples/fselect-stdout @@ -0,0 +1,9 @@ +#!/bin/sh +# $Id: fselect-stdout,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +RESULT=`$DIALOG --stdout --title "Please choose a file" "$@" --fselect $HOME/ 14 48` +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/fselect0 b/contrib/dialog/samples/fselect0 new file mode 100755 index 0000000..3bd5b6d --- /dev/null +++ b/contrib/dialog/samples/fselect0 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: fselect0,v 1.1 2011/10/14 08:32:48 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "Please choose a file" "$@" --fselect '' 14 48 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/fselect1 b/contrib/dialog/samples/fselect1 new file mode 100755 index 0000000..5913794 --- /dev/null +++ b/contrib/dialog/samples/fselect1 @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: fselect1,v 1.9 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +FILE=$HOME +for n in .cshrc .profile .bashrc +do + if test -f $HOME/$n ; then + FILE=$HOME/$n + break + fi +done + +exec 3>&1 +RESULT=`$DIALOG --title "Please choose a file" "$@" --fselect $FILE 14 48 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/fselect1-stdout b/contrib/dialog/samples/fselect1-stdout new file mode 100755 index 0000000..01d1135 --- /dev/null +++ b/contrib/dialog/samples/fselect1-stdout @@ -0,0 +1,18 @@ +#!/bin/sh +# $Id: fselect1-stdout,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +FILE=$HOME +for n in .cshrc .profile .bashrc +do + if test -f $HOME/$n ; then + FILE=$HOME/$n + break + fi +done + +RESULT=`$DIALOG --stdout --title "Please choose a file" "$@" --fselect $FILE 14 48` +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/fselect2 b/contrib/dialog/samples/fselect2 new file mode 100755 index 0000000..6480c75 --- /dev/null +++ b/contrib/dialog/samples/fselect2 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: fselect2,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "Please choose a file" "$@" --fselect $HOME/ 0 0 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/fselect2-stdout b/contrib/dialog/samples/fselect2-stdout new file mode 100755 index 0000000..644fb2a --- /dev/null +++ b/contrib/dialog/samples/fselect2-stdout @@ -0,0 +1,9 @@ +#!/bin/sh +# $Id: fselect2-stdout,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +RESULT=`$DIALOG --stdout --title "Please choose a file" "$@" --fselect $HOME/ 0 0` +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/gauge b/contrib/dialog/samples/gauge new file mode 100755 index 0000000..80dc188 --- /dev/null +++ b/contrib/dialog/samples/gauge @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id: gauge,v 1.7 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +PCT=10 +( +while test $PCT != 100 +do +cat <<EOF +XXX +$PCT +The new\n\ +message ($PCT percent) +XXX +EOF +PCT=`expr $PCT + 10` +sleep 1 +done +) | + +$DIALOG --title "GAUGE" "$@" --gauge "Hi, this is a gauge widget" 20 70 0 diff --git a/contrib/dialog/samples/gauge0 b/contrib/dialog/samples/gauge0 new file mode 100755 index 0000000..97e654c --- /dev/null +++ b/contrib/dialog/samples/gauge0 @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id: gauge0,v 1.7 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +PCT=10 +( +sleep 1 +while test $PCT != 110 +do +cat <<EOF +XXX +$PCT +The new\n\ +message ($PCT percent) +XXX +EOF +PCT=`expr $PCT + 10` +sleep 1 +done +) | + +$DIALOG --title "GAUGE" "$@" --gauge "Hi, this is a gauge widget" 0 0 0 diff --git a/contrib/dialog/samples/gauge0-input-fd b/contrib/dialog/samples/gauge0-input-fd new file mode 100755 index 0000000..0b96fe4 --- /dev/null +++ b/contrib/dialog/samples/gauge0-input-fd @@ -0,0 +1,27 @@ +#!/bin/sh +# $Id: gauge0-input-fd,v 1.5 2010/01/13 10:20:03 tom Exp $ +# modified "gauge0" script to use "--input-fd" option. + +. ./setup-vars + +exec 3<&0 +PCT=10 +( +sleep 1 +while test $PCT != 110 +do +cat <<EOF +XXX +$PCT +The new\n\ +message ($PCT percent) +XXX +EOF +PCT=`expr $PCT + 10` +sleep 1 +done +) | + +$DIALOG --title "GAUGE" --input-fd 3 "$@" --gauge "Hi, this is a gauge widget" 0 0 0 + +exec 3<&- diff --git a/contrib/dialog/samples/gauge2 b/contrib/dialog/samples/gauge2 new file mode 100755 index 0000000..10455d1 --- /dev/null +++ b/contrib/dialog/samples/gauge2 @@ -0,0 +1,28 @@ +#!/bin/sh +# $Id: gauge2,v 1.8 2010/01/13 10:26:52 tom Exp $ +# The original dialog program assumed the first line after the first "XXX" +# was a percentage value (compare with "gauge" script). + +. ./setup-vars + +(echo "10" ; sleep 2 ; + +cat <<"EOF" +XXX +The new +\n +message +XXX +20 +EOF +sleep 2; + +echo "75" ; sleep 1 +echo "100") | \ + +$DIALOG --title "GAUGE" "$@" --gauge "Hi, this is a gauge widget" 10 40 0 + +if [ "$?" = $DIALOG_ESC ] ; then + echo "" + echo "Box closed !" +fi diff --git a/contrib/dialog/samples/infobox b/contrib/dialog/samples/infobox new file mode 100755 index 0000000..91dd5dd --- /dev/null +++ b/contrib/dialog/samples/infobox @@ -0,0 +1,21 @@ +#! /bin/sh +# $Id: infobox,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +left=10 +unit="seconds" +while test $left != 0 +do + +$DIALOG --sleep 1 \ + --title "INFO BOX" "$@" \ + --infobox "Hi, this is an information box. It is +different from a message box: it will +not pause waiting for input after displaying +the message. The pause here is only introduced +by the sleep command within dialog. +You have $left $unit to read this..." 10 52 +left=`expr $left - 1` +test $left = 1 && unit="second" +done diff --git a/contrib/dialog/samples/infobox1 b/contrib/dialog/samples/infobox1 new file mode 100755 index 0000000..4ee6c9f --- /dev/null +++ b/contrib/dialog/samples/infobox1 @@ -0,0 +1,21 @@ +#! /bin/sh +# $Id: infobox1,v 1.4 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +left=10 +unit="seconds" +while test $left != 0 +do + +sleep 1 +$DIALOG --title "INFO BOX" "$@" \ + --infobox "Hi, this is an information box. It is +different from a message box: it will +not pause waiting for input after displaying +the message. The pause here is only introduced +by a sleep command in the shell script. +You have $left $unit to read this..." 10 52 +left=`expr $left - 1` +test $left = 1 && unit="second" +done diff --git a/contrib/dialog/samples/infobox2 b/contrib/dialog/samples/infobox2 new file mode 100755 index 0000000..fdf64ca --- /dev/null +++ b/contrib/dialog/samples/infobox2 @@ -0,0 +1,21 @@ +#! /bin/sh +# $Id: infobox2,v 1.5 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +left=10 +unit="seconds" +while test $left != 0 +do + +$DIALOG --sleep 1 \ + --title "INFO BOX" "$@" \ + --infobox "Hi, this is an information box. It is +different from a message box: it will +not pause waiting for input after displaying +the message. The pause here is only introduced +by the sleep command within dialog. +You have $left $unit to read this..." 0 0 +left=`expr $left - 1` +test $left = 1 && unit="second" +done diff --git a/contrib/dialog/samples/infobox3 b/contrib/dialog/samples/infobox3 new file mode 100755 index 0000000..edba1df --- /dev/null +++ b/contrib/dialog/samples/infobox3 @@ -0,0 +1,22 @@ +#! /bin/sh +# $Id: infobox3,v 1.5 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +left=10 +unit="seconds" +while test $left != 0 +do + +$DIALOG --sleep 1 \ + --begin 5 0 \ + --title "INFO BOX" "$@" \ + --infobox "Hi, this is an information box. It is +different from a message box: it will +not pause waiting for input after displaying +the message. The pause here is only introduced +by the sleep command within dialog. +You have $left $unit to read this..." 0 0 +left=`expr $left - 1` +test $left = 1 && unit="second" +done diff --git a/contrib/dialog/samples/infobox4 b/contrib/dialog/samples/infobox4 new file mode 100755 index 0000000..7c96d6b --- /dev/null +++ b/contrib/dialog/samples/infobox4 @@ -0,0 +1,22 @@ +#! /bin/sh +# $Id: infobox4,v 1.5 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +left=10 +unit="seconds" +while test $left != 0 +do + +$DIALOG --sleep 1 \ + --begin 0 5 \ + --title "INFO BOX" "$@" \ + --infobox "Hi, this is an information box. It is +different from a message box: it will +not pause waiting for input after displaying +the message. The pause here is only introduced +by the sleep command within dialog. +You have $left $unit to read this..." 0 0 +left=`expr $left - 1` +test $left = 1 && unit="second" +done diff --git a/contrib/dialog/samples/infobox5 b/contrib/dialog/samples/infobox5 new file mode 100755 index 0000000..58512c9 --- /dev/null +++ b/contrib/dialog/samples/infobox5 @@ -0,0 +1,39 @@ +#! /bin/sh +# $Id: infobox5,v 1.7 2011/01/18 09:19:09 tom Exp $ +# get rid of all flickering by constructing a script unroll the loop, leaving +# us in curses-mode until we're done counting. + +. ./setup-vars + +. ./setup-tempfile + +left=10 +unit="seconds" +last='\' + +cat >>$tempfile <<EOF +$DIALOG $last +EOF + +while test $left != 0 +do + +cat >>$tempfile <<EOF + --sleep 1 \ + --begin 0 5 \ + --title "INFO BOX" $* \ + --infobox "Hi, this is an information box. It is +different from a message box: it will +not pause waiting for input after displaying +the message. The pause here is only introduced +by the sleep command within dialog. +You have $left $unit to read this..." 0 0 $last +EOF + +left=`expr $left - 1` +test $left = 1 && unit="second" +done + +echo >>$tempfile + +. $tempfile diff --git a/contrib/dialog/samples/infobox6 b/contrib/dialog/samples/infobox6 new file mode 100755 index 0000000..a3a06ce --- /dev/null +++ b/contrib/dialog/samples/infobox6 @@ -0,0 +1,41 @@ +#! /bin/sh +# $Id: infobox6,v 1.7 2011/01/18 09:20:59 tom Exp $ +# get rid of all flickering by constructing a script unroll the loop, leaving +# us in curses-mode until we're done counting. +# +# a little fancier than infobox5, this moves the widget at each step. + +. ./setup-vars + +. ./setup-tempfile + +left=10 +unit="seconds" +last='\' + +cat >>$tempfile <<EOF +$DIALOG $last +EOF + +while test $left != 0 +do + +cat >>$tempfile <<EOF + --sleep 1 \ + --begin $left `expr $left + 5` \ + --title "INFO BOX" $* $last + --infobox "Hi, this is an information box. It is +different from a message box: it will +not pause waiting for input after displaying +the message. The pause here is only introduced +by the sleep command within dialog. +You have $left $unit to read this..." 0 0 $last +EOF + +left=`expr $left - 1` +test $left = 1 && unit="second" +done + +echo >>$tempfile + +. $tempfile diff --git a/contrib/dialog/samples/inputbox b/contrib/dialog/samples/inputbox new file mode 100755 index 0000000..9975d44 --- /dev/null +++ b/contrib/dialog/samples/inputbox @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: inputbox,v 1.11 2010/01/13 10:06:01 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox-both b/contrib/dialog/samples/inputbox-both new file mode 100755 index 0000000..4103ccf --- /dev/null +++ b/contrib/dialog/samples/inputbox-both @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id: inputbox-both,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear \ + --extra-button \ + --help-button "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox-extra b/contrib/dialog/samples/inputbox-extra new file mode 100755 index 0000000..9f2277c --- /dev/null +++ b/contrib/dialog/samples/inputbox-extra @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: inputbox-extra,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear \ + --extra-button "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox-help b/contrib/dialog/samples/inputbox-help new file mode 100755 index 0000000..0dfe7c8 --- /dev/null +++ b/contrib/dialog/samples/inputbox-help @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: inputbox-help,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear \ + --help-button "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox1 b/contrib/dialog/samples/inputbox1 new file mode 100755 index 0000000..487aa8c --- /dev/null +++ b/contrib/dialog/samples/inputbox1 @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id: inputbox1,v 1.13 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --cr-wrap \ + --title "INPUT BOX" --clear \ + --inputbox "$@" \ +"Hi, this is an input dialog box. You can use +this to ask questions that require the user +to input a string as the answer. You can +input strings of length longer than the +width of the input box, in that case, the +input field will be automatically scrolled. +You can use BACKSPACE to correct errors. + +Try entering your name below:" 0 0 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox2 b/contrib/dialog/samples/inputbox2 new file mode 100755 index 0000000..f7b4b5f --- /dev/null +++ b/contrib/dialog/samples/inputbox2 @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: inputbox2,v 1.9 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox3 b/contrib/dialog/samples/inputbox3 new file mode 100755 index 0000000..d343e0a --- /dev/null +++ b/contrib/dialog/samples/inputbox3 @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: inputbox3,v 1.7 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --nocancel \ + --title "INPUT BOX" --clear "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n\ +this to ask questions that require the user \n\ +to input a string as the answer. You can \n\ +input strings of length longer than the \n\ +width of the input box, in that case, the \n\ +input field will be automatically scrolled. \n\ +You can use BACKSPACE to correct errors. \n\n\ +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox4 b/contrib/dialog/samples/inputbox4 new file mode 100755 index 0000000..416bf86 --- /dev/null +++ b/contrib/dialog/samples/inputbox4 @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: inputbox4,v 1.7 2010/01/13 10:28:12 tom Exp $ +# An example which does not use temporary files, as suggested by Cary Evans: + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "INPUT BOX" --clear "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/inputbox5 b/contrib/dialog/samples/inputbox5 new file mode 100755 index 0000000..ad72623 --- /dev/null +++ b/contrib/dialog/samples/inputbox5 @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: inputbox5,v 1.7 2010/01/13 10:20:03 tom Exp $ +# use --output-fd to write to a different output than stderr + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear --output-fd 4 "$@" \ + --inputbox "Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 4> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox6-8bit b/contrib/dialog/samples/inputbox6-8bit new file mode 100755 index 0000000..b7692e8 --- /dev/null +++ b/contrib/dialog/samples/inputbox6-8bit @@ -0,0 +1,17 @@ +#!/bin/sh +# $Id: inputbox6-8bit,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./testdata-8bit + +$DIALOG \ +--title `printf "$SAMPLE"` "$@" \ +--inputbox `printf "$SAMPLE"` \ +10 40 `printf "$SAMPLE"` 2>$tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox6-utf8 b/contrib/dialog/samples/inputbox6-utf8 new file mode 100755 index 0000000..056757e --- /dev/null +++ b/contrib/dialog/samples/inputbox6-utf8 @@ -0,0 +1,18 @@ +#!/bin/sh +# $Id: inputbox6-utf8,v 1.9 2013/09/24 00:06:02 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./setup-utf8 + +TITLE="あいうえお" + +$DIALOG \ +--title "$TITLE" "$@" \ +--inputbox "$TITLE" 10 20 "D.O.G" 2>$tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/inputbox7 b/contrib/dialog/samples/inputbox7 new file mode 100755 index 0000000..e79d9cc --- /dev/null +++ b/contrib/dialog/samples/inputbox7 @@ -0,0 +1,29 @@ +#!/bin/sh +# $Id: inputbox7,v 1.7 2010/01/13 10:20:03 tom Exp $ +# An example which produces two widget outputs. + +. ./setup-vars + +MSG='Hi, this is an input dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:' + +# separate with a line-break (newline) +SEP=' +' + +exec 3>&1 +RESULT=`$DIALOG --title "INPUT BOX" --clear --separate-widget "$SEP" "$@" \ + --inputbox "$MSG" 16 51 \ + --title "ANOTHER INPUT BOX" \ + --inputbox "$MSG" 16 51 \ +2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/inputmenu b/contrib/dialog/samples/inputmenu new file mode 100755 index 0000000..3c80811 --- /dev/null +++ b/contrib/dialog/samples/inputmenu @@ -0,0 +1,65 @@ +#! /bin/sh +# $Id: inputmenu,v 1.15 2012/07/06 18:11:21 tom Exp $ +# 2002 - written by Tobias Rittweiler <tobrit@freebits.de> + +. ./setup-vars + +user="$USER" +uid=`id|sed -e 's/^uid=//' -e 's/(.*//'` +gid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'` +home="$HOME" + +while [ ${returncode:-99} -ne 1 -a ${returncode:-99} -ne 250 ]; do + exec 3>&1 + value=`$DIALOG \ + --clear --ok-label "Create" \ + --backtitle "An Example for the use of --inputmenu:" "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ +configuration purpose. Here is a possible piece of a configuration program. \ +" 20 50 10 \ +"Username:" "$user" \ +"UID:" "$uid" \ +"GID:" "$gid" \ +"HOME:" "$home" \ +2>&1 1>&3 ` + returncode=$? + exec 3>&- + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear --backtitle "An Example for the use of --inputmenu:" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) break;; + $DIALOG_CANCEL) returncode=99;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear --backtitle "An Example for the use of --inputmenu:" \ + --msgbox "useradd \n\ + -d $home \n\ + -u $uid \n\ + -g $gid \n\ + $user" 10 40 + ;; + $DIALOG_EXTRA) + value=`echo "$value" | sed -e 's/^RENAMED //'` + tag=`echo "$value" | sed -e 's/:.*//'` + item=`echo "$value" | sed -e 's/^[^:]*:[ ][ ]*//'` + + case "$tag" in + Username) user="$item" ;; + UID) uid="$item" ;; + GID) gid="$item" ;; + HOME) home="$item" ;; + esac + ;; + + $DIALOG_ESC) + echo "ESC pressed." + break + ;; + + esac +done diff --git a/contrib/dialog/samples/inputmenu-stdout b/contrib/dialog/samples/inputmenu-stdout new file mode 100755 index 0000000..a778226 --- /dev/null +++ b/contrib/dialog/samples/inputmenu-stdout @@ -0,0 +1,63 @@ +#! /bin/sh +# $Id: inputmenu-stdout,v 1.13 2012/07/06 18:11:12 tom Exp $ +# 2002 - written by Tobias Rittweiler <tobrit@freebits.de> + +. ./setup-vars + +user="$USER" +uid=`id|sed -e 's/^uid=//' -e 's/(.*//'` +gid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'` +home="$HOME" + +while [ ${returncode:-99} -ne 1 -a ${returncode:-99} -ne 250 ]; do + value=`$DIALOG \ + --stdout --clear --ok-label "Create" \ + --backtitle "An Example for the use of --inputmenu:" "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ +configuration purpose. Here is a possible piece of a configuration program. \ +" 20 50 10 \ +"Username:" "$user" \ +"UID:" "$uid" \ +"GID:" "$gid" \ +"HOME:" "$home" \ +` + returncode=$? + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear --backtitle "An Example for the use of --inputmenu:" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) break;; + $DIALOG_CANCEL) returncode=99;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear --backtitle "An Example for the use of --inputmenu:" \ + --msgbox "useradd \n\ + -d $home \n\ + -u $uid \n\ + -g $gid \n\ + $user" 10 40 + ;; + $DIALOG_EXTRA) + value=`echo "$value" | sed -e 's/^RENAMED //'` + tag=`echo "$value" | sed -e 's/:.*//'` + item=`echo "$value" | sed -e 's/^[^:]*:[ ][ ]*//'` + + case "$tag" in + Username) user="$item" ;; + UID) uid="$item" ;; + GID) gid="$item" ;; + HOME) home="$item" ;; + esac + ;; + + $DIALOG_ESC) + echo "ESC pressed." + break + ;; + + esac +done diff --git a/contrib/dialog/samples/inputmenu1 b/contrib/dialog/samples/inputmenu1 new file mode 100755 index 0000000..905c292 --- /dev/null +++ b/contrib/dialog/samples/inputmenu1 @@ -0,0 +1,85 @@ +#! /bin/sh +# $Id: inputmenu1,v 1.9 2012/07/01 00:59:54 tom Exp $ +# +# "inputmenu" rewritten into Bourne shell. + +. ./setup-vars + +backtitle="An Example for the use of --inputmenu:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --clear --ok-label "Create" \ + --backtitle "$backtitle" "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ +configuration purpose. Here is a possible piece of a configuration program." \ +20 50 10 \ + "Username:" "$user" \ + "UID:" "$uid" \ + "GID:" "$gid" \ + "HOME:" "$home" \ +2>&1 1>&3` +returncode=$? +exec 3>&- + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --msgbox "useradd \n\ + -d $home \n\ + -u $uid \n\ + -g $gid \n\ + $user" 10 40 + ;; + $DIALOG_EXTRA) + tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*//'` + item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + + case "$tag" in + Username) + user="$item" + ;; + UID) + uid="$item" + ;; + GID) + gid="$item" + ;; + HOME) + home="$item" + ;; + esac + ;; + + $DIALOG_ESC) + echo "ESC pressed." + break + ;; + + esac +done diff --git a/contrib/dialog/samples/inputmenu2 b/contrib/dialog/samples/inputmenu2 new file mode 100755 index 0000000..ecef674 --- /dev/null +++ b/contrib/dialog/samples/inputmenu2 @@ -0,0 +1,97 @@ +#! /bin/sh +# $Id: inputmenu2,v 1.9 2012/07/01 01:00:34 tom Exp $ +# +# "inputmenu1" with defaultitem, help-button. + +. ./setup-vars + +backtitle="An Example for the use of --inputmenu:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +defaultitem="Username:" +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --clear --ok-label "Create" \ + --backtitle "$backtitle" \ + --help-button \ + --help-label "Script" \ + --default-item "$defaultitem" "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ +configuration purpose. Here is a possible piece of a configuration program." \ +20 60 10 \ + "Username:" "$user" \ + "UID:" "$uid" \ + "GID:" "$gid" \ + "HOME:" "$home" \ +2>&1 1>&3` +returncode=$? +exec 3>&- + + case $returncode in + $DIALOG_HELP) + "$DIALOG" \ + --textbox "$0" 0 0 + ;; + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --msgbox "useradd \n\ + -d $home \n\ + -u $uid \n\ + -g $gid \n\ + $user" 10 40 + ;; + $DIALOG_EXTRA) + tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*/:/'` + item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + + case "$tag" in + Username:) + user="$item" + ;; + UID:) + uid="$item" + ;; + GID:) + gid="$item" + ;; + HOME:) + home="$item" + ;; + *) + tag= + ;; + esac + test -n "$tag" && defaultitem="$tag" + ;; + + $DIALOG_ESC) + echo "ESC pressed." + break + ;; + + esac +done diff --git a/contrib/dialog/samples/inputmenu3 b/contrib/dialog/samples/inputmenu3 new file mode 100755 index 0000000..4b9d522 --- /dev/null +++ b/contrib/dialog/samples/inputmenu3 @@ -0,0 +1,106 @@ +#! /bin/sh +# $Id: inputmenu3,v 1.11 2012/07/01 01:00:34 tom Exp $ +# +# "inputmenu1" with defaultitem, help-button and item-help. + +. ./setup-vars + +backtitle="An Example for the use of --inputmenu:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +defaultitem="Username:" +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --clear --ok-label "Create" \ + --backtitle "$backtitle" \ + --help-button \ + --help-label "Script" \ + --default-item "$defaultitem" \ + --item-help "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ +configuration purpose. Here is a possible piece of a configuration program." \ +20 60 10 \ + "Username:" "$user" "User login-name" \ + "UID:" "$uid" "User-ID (number)" \ + "GID:" "$gid" "Group-ID (number)" \ + "HOME:" "$home" "User's home-directory" \ +2>&1 1>&3` +returncode=$? +exec 3>&- + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + case $value in + HELP*) + "$DIALOG" \ + --textbox "$0" 0 0 + ;; + *) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --msgbox "useradd \n\ + -d $home \n\ + -u $uid \n\ + -g $gid \n\ + $user" 10 40 + ;; + esac + ;; + $DIALOG_HELP) + "$DIALOG" \ + --textbox "$0" 0 0 + ;; + $DIALOG_EXTRA) + tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*/:/'` + item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + + case "$tag" in + Username:) + user="$item" + ;; + UID:) + uid="$item" + ;; + GID:) + gid="$item" + ;; + HOME:) + home="$item" + ;; + *) + tag= + ;; + esac + test -n "$tag" && defaultitem="$tag" + ;; + + $DIALOG_ESC) + echo "ESC pressed." + break + ;; + + esac +done diff --git a/contrib/dialog/samples/inputmenu4 b/contrib/dialog/samples/inputmenu4 new file mode 100755 index 0000000..6688c9c --- /dev/null +++ b/contrib/dialog/samples/inputmenu4 @@ -0,0 +1,86 @@ +#! /bin/sh +# $Id: inputmenu4,v 1.9 2012/07/01 01:00:34 tom Exp $ +# +# "inputmenu1" with a different label for the extra-button + +. ./setup-vars + +backtitle="An Example for the use of --inputmenu:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --clear --ok-label "Create" \ + --extra-label "Edit" \ + --backtitle "$backtitle" "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ +configuration purpose. Here is a possible piece of a configuration program." \ +20 50 10 \ + "Username:" "$user" \ + "UID:" "$uid" \ + "GID:" "$gid" \ + "HOME:" "$home" \ +2>&1 1>&3` +returncode=$? +exec 3>&- + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --msgbox "useradd \n\ + -d $home \n\ + -u $uid \n\ + -g $gid \n\ + $user" 10 40 + ;; + $DIALOG_EXTRA) + tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*//'` + item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + + case "$tag" in + Username) + user="$item" + ;; + UID) + uid="$item" + ;; + GID) + gid="$item" + ;; + HOME) + home="$item" + ;; + esac + ;; + + $DIALOG_ESC) + echo "ESC pressed." + break + ;; + + esac +done diff --git a/contrib/dialog/samples/killall b/contrib/dialog/samples/killall new file mode 100755 index 0000000..7030fe2 --- /dev/null +++ b/contrib/dialog/samples/killall @@ -0,0 +1,16 @@ +#! /bin/sh +# $Id: killall,v 1.3 2012/06/29 09:39:19 tom Exp $ +# Linux has a program that does this correctly. + +. ./setup-vars + +for prog in $* +do + pid=`ps -a |fgrep $prog |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' ` + if test -n "$pid" ; then + echo killing pid=$pid, $prog + kill -$SIG_HUP $pid || \ + kill -$SIG_TERM $pid || \ + kill -$SIG_KILL $pid + fi +done diff --git a/contrib/dialog/samples/listing b/contrib/dialog/samples/listing new file mode 100755 index 0000000..71d85aa --- /dev/null +++ b/contrib/dialog/samples/listing @@ -0,0 +1,8 @@ +#!/bin/sh +# $Id: listing,v 1.2 2007/05/28 12:40:36 tom Exp $ +while true +do +ls -lrt +date +sleep 1 +done diff --git a/contrib/dialog/samples/menubox b/contrib/dialog/samples/menubox new file mode 100755 index 0000000..0cea3bb --- /dev/null +++ b/contrib/dialog/samples/menubox @@ -0,0 +1,27 @@ +#!/bin/sh +# $Id: menubox,v 1.11 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --clear --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "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" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox-8bit b/contrib/dialog/samples/menubox-8bit new file mode 100755 index 0000000..91faa5c --- /dev/null +++ b/contrib/dialog/samples/menubox-8bit @@ -0,0 +1,29 @@ +#!/bin/sh +# $Id: menubox-8bit,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./testdata-8bit + +$DIALOG --clear --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "`./rotated-data 0 $SAMPLE`" "The Great Unix Clone for 386/486" \ + "`./rotated-data 1 $SAMPLE`" "Another free Unix Clone for 386/486" \ + "`./rotated-data 2 $SAMPLE`" "IBM OS/2" \ + "`./rotated-data 3 $SAMPLE`" "Microsoft Windows NT" \ + "`./rotated-data 4 $SAMPLE`" "IBM PC DOS" \ + "`./rotated-data 5 $SAMPLE`" "Microsoft DOS" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox-utf8 b/contrib/dialog/samples/menubox-utf8 new file mode 100755 index 0000000..cd6e429 --- /dev/null +++ b/contrib/dialog/samples/menubox-utf8 @@ -0,0 +1,29 @@ +#!/bin/sh +# $Id: menubox-utf8,v 1.10 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./setup-utf8 + +$DIALOG --clear --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "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" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox1 b/contrib/dialog/samples/menubox1 new file mode 100755 index 0000000..dc40d02 --- /dev/null +++ b/contrib/dialog/samples/menubox1 @@ -0,0 +1,27 @@ +#!/bin/sh +# $Id: menubox1,v 1.7 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --default-item "OS/2" --clear --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "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" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox10 b/contrib/dialog/samples/menubox10 new file mode 100755 index 0000000..8606934 --- /dev/null +++ b/contrib/dialog/samples/menubox10 @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id: menubox10,v 1.5 2010/01/13 10:34:12 tom Exp $ +# zero-width column + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --backtitle "Debian Configuration" \ + --title "Configuring debconf" \ + --default-item Dialog "$@" \ + --menu "Packages that use debconf for co" 19 50 6 \ + Dialog "" \ + Readline "" \ + Gnome "" \ + Kde "" \ + Editor "" \ + Noninteractive "" \ +2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/menubox12 b/contrib/dialog/samples/menubox12 new file mode 100755 index 0000000..ee4b474 --- /dev/null +++ b/contrib/dialog/samples/menubox12 @@ -0,0 +1,43 @@ +#!/bin/sh +# $Id: menubox12,v 1.3 2012/12/23 22:28:26 tom Exp $ + +. ./setup-vars + +. ./setup-edit + +case "x$DIALOGOPTS" in +*--no-items*|*--noitem*) + CUT="cut -d: -f1,3" + ;; +*) + CUT="cat" + ;; +esac + +$CUT >$input <<-EOF + 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 +cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$output +cat $output >$input + +$DIALOG --clear --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + --file $input 2> $output + +retval=$? + +tempfile=$output +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox2 b/contrib/dialog/samples/menubox2 new file mode 100755 index 0000000..d81ba79 --- /dev/null +++ b/contrib/dialog/samples/menubox2 @@ -0,0 +1,27 @@ +#!/bin/sh +# $Id: menubox2,v 1.7 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --default-item "MSDOS" --clear --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "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" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox3 b/contrib/dialog/samples/menubox3 new file mode 100755 index 0000000..d33b5d6 --- /dev/null +++ b/contrib/dialog/samples/menubox3 @@ -0,0 +1,27 @@ +#!/bin/sh +# $Id: menubox3,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --clear --item-help --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "Linux" "The Great Unix Clone for 386/486" "Why use Linux?" \ + "NetBSD" "Another free Unix Clone for 386/486" "Or NetBSD?" \ + "OS/2" "IBM OS/2" "aka \"Warp\"" \ + "WIN NT" "Microsoft Windows NT" "hmm" \ + "PCDOS" "IBM PC DOS" "clone of a clone" \ + "MSDOS" "Microsoft DOS" "DOS: Disk Operating System, originally for an IBM contract, hence using the same jargon" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox4 b/contrib/dialog/samples/menubox4 new file mode 100755 index 0000000..e95342d --- /dev/null +++ b/contrib/dialog/samples/menubox4 @@ -0,0 +1,27 @@ +#!/bin/sh +# $Id: menubox4,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --clear --item-help --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "Linux" "The Great Unix Clone for 386/486 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Why use Linux?" \ + "NetBSD" "Another free Unix Clone for 386/486 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Or NetBSD?" \ + "OS/2" "IBM OS/2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "aka \"Warp\"" \ + "WIN NT" "Microsoft Windows NT xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "hmm" \ + "PCDOS" "IBM PC DOS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "clone of a clone" \ + "MSDOS" "Microsoft DOS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "DOS: Disk Operating System, originally for an IBM contract, hence using the same jargon" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox5 b/contrib/dialog/samples/menubox5 new file mode 100755 index 0000000..c89be3a --- /dev/null +++ b/contrib/dialog/samples/menubox5 @@ -0,0 +1,30 @@ +#!/bin/sh +# $Id: menubox5,v 1.9 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --clear --help-button --item-help --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "Linux" "The Great Unix Clone for 386/486 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Why use Linux?" \ + "NetBSD" "Another free Unix Clone for 386/486 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "Or NetBSD?" \ + "OS/2" "IBM OS/2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "aka \"Warp\"" \ + "WIN NT" "Microsoft Windows NT xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "hmm" \ + "WIN 2K" "Microsoft Windows 2000 xxxxxxxxxxxxxxxxxxxxxxxxxxxx" "hmm" \ + "WIN XP" "Microsoft Windows XP (son of Windows 95) xxxxxxxxxx" "hmm" \ + "WIN 95" "Microsoft Windows 95 (son of MSDOS) xxxxxxxxxxxxxxx" "hmm" \ + "PCDOS" "IBM PC DOS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "clone of a clone" \ + "MSDOS" "Microsoft DOS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "DOS: Disk Operating System, originally for an IBM contract, hence using the same jargon" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox6 b/contrib/dialog/samples/menubox6 new file mode 100755 index 0000000..afcc90d --- /dev/null +++ b/contrib/dialog/samples/menubox6 @@ -0,0 +1,28 @@ +#!/bin/sh +# $Id: menubox6,v 1.8 2010/01/13 10:20:03 tom Exp $ +# example showing the --colors option + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --clear --item-help --title "MENU BOX" --colors "$@" \ + --menu "Hi, this is a \Zumenu\Zn box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the \Z4UP/DOWN\Zn arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +\Z2number\Zn keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "Linux" "The Great Unix Clone for \Zu386/486" "Why use \ZbLinux?" \ + "NetBSD" "Another free Unix Clone for \Zu386/486" "Or \ZbNetBSD?" \ + "OS/2" "IBM OS/2" "aka \"Warp\"" \ + "WIN NT" "Microsoft Windows NT" "hmm" \ + "PCDOS" "IBM PC \ZrDOS" "clone of a clone" \ + "MSDOS" "Microsoft \ZrDOS" "\ZbDOS\Zn: \Zb\Z3D\Znisk \Zb\Z3O\Znperating \Zb\Z3S\Znystem, originally for an IBM contract, hence using the same jargon" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox7 b/contrib/dialog/samples/menubox7 new file mode 100755 index 0000000..2e85b43 --- /dev/null +++ b/contrib/dialog/samples/menubox7 @@ -0,0 +1,29 @@ +#!/bin/sh +# $Id: menubox7,v 1.9 2010/01/13 10:20:03 tom Exp $ +# example with --extra-button + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --clear --item-help --extra-button --extra-label "Choice" \ + --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "Linux" "The Great Unix Clone for 386/486" "Why use Linux?" \ + "NetBSD" "Another free Unix Clone for 386/486" "Or NetBSD?" \ + "OS/2" "IBM OS/2" "aka \"Warp\"" \ + "WIN NT" "Microsoft Windows NT" "hmm" \ + "PCDOS" "IBM PC DOS" "clone of a clone" \ + "MSDOS" "Microsoft DOS" "DOS: Disk Operating System, originally for an IBM contract, hence using the same jargon" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/menubox8 b/contrib/dialog/samples/menubox8 new file mode 100755 index 0000000..85448d0 --- /dev/null +++ b/contrib/dialog/samples/menubox8 @@ -0,0 +1,30 @@ +#!/bin/sh +# $Id: menubox8,v 1.7 2010/01/13 10:34:32 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --help-button \ + --default-item "MSDOS" \ + --clear \ + --title "MENU BOX" "$@" \ + --menu "Hi, this is a menu box. You can use this to \n\ +present a list of choices for the user to \n\ +choose. If there are more items than can fit \n\ +on the screen, the menu will be scrolled. \n\ +You can use the UP/DOWN arrow keys, the first \n\ +letter of the choice as a hot key, or the \n\ +number keys 1-9 to choose an option.\n\ +Try it now!\n\n\ + Choose the OS you like:" 20 51 4 \ + "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" \ +2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/menubox9 b/contrib/dialog/samples/menubox9 new file mode 100755 index 0000000..8373939 --- /dev/null +++ b/contrib/dialog/samples/menubox9 @@ -0,0 +1,26 @@ +#!/bin/sh +# $Id: menubox9,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --help-button \ + --clear \ + --title "Select Linux installation partition:" "$@" \ + --menu \ +"Please select a partition from the following list to use for your \ +root (/) Linux partition." 13 70 5 \ +"/dev/hda2" "Linux native 30724312K" \ +"/dev/hda4" "Linux native 506047K" \ +"/dev/hdb1" "Linux native 4096543K" \ +"/dev/hdb2" "Linux native 2586465K" \ +"---" "(add none, continue with setup)" \ +"---" "(add none, continue with setup)" \ +"---" "(add none, continue with setup)" \ +"---" "(add none, continue with setup)" \ +"---" "(add none, continue with setup)" \ +2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/mixedform b/contrib/dialog/samples/mixedform new file mode 100755 index 0000000..6178476 --- /dev/null +++ b/contrib/dialog/samples/mixedform @@ -0,0 +1,61 @@ +#! /bin/sh +# $Id: mixedform,v 1.6 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +backtitle="An Example for the use of --mixedform:" +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +returncode=$? +exec 3>&1 +value=`$DIALOG --title "Mixed form demonstration" --ok-label "Submit" \ + --backtitle "$backtitle" \ + --insecure "$@" \ + --mixedform "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username :" 1 1 "Kiran" 1 20 10 0 2 \ + "Password :" 2 1 "" 2 20 8 0 1 \ + "Retype Password :" 3 1 "" 3 20 8 0 1 \ + "HOME :" 4 1 "Cisco" 4 20 40 0 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/mixedform2 b/contrib/dialog/samples/mixedform2 new file mode 100755 index 0000000..07f1d66 --- /dev/null +++ b/contrib/dialog/samples/mixedform2 @@ -0,0 +1,61 @@ +#! /bin/sh +# $Id: mixedform2,v 1.5 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +backtitle="An Example for the use of --mixedform:" +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +returncode=$? +exec 3>&1 +value=`$DIALOG --title "Mixed form demonstration" --ok-label "Submit" \ + --backtitle "$backtitle" \ + --insecure "$@" \ + --mixedform "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username :" 1 1 "Kiran" 1 20 10 0 2 \ + "Password :" 2 1 "pass" 2 20 8 0 3 \ + "Retype Password :" 3 1 "pass" 3 20 8 0 3 \ + "HOME :" 4 1 "Cisco" 4 20 40 0 2 \ +2>&1 1>&3` +returncode=$? +exec 3>&- +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/mixedgauge b/contrib/dialog/samples/mixedgauge new file mode 100755 index 0000000..517ba11 --- /dev/null +++ b/contrib/dialog/samples/mixedgauge @@ -0,0 +1,26 @@ +#! /bin/sh +# $Id: mixedgauge,v 1.7 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +background="An Example of --mixedgauge usage" + +for i in 5 10 20 30 40 50 60 70 80 90 100 +do +$DIALOG --backtitle "$background" \ + --title "Mixed gauge demonstration" "$@" \ + --mixedgauge "This is a prompt message,\nand this is the second line." \ + 0 0 33 \ + "Process one" "0" \ + "Process two" "1" \ + "Process three" "2" \ + "Process four" "3" \ + "" "8" \ + "Process five" "5" \ + "Process six" "6" \ + "Process seven" "7" \ + "Process eight" "4" \ + "Process nine" "-$i" +# break +sleep 1 +done diff --git a/contrib/dialog/samples/msgbox b/contrib/dialog/samples/msgbox new file mode 100755 index 0000000..adc204e --- /dev/null +++ b/contrib/dialog/samples/msgbox @@ -0,0 +1,13 @@ +#!/bin/sh +# $Id: msgbox,v 1.7 2010/01/13 10:35:13 tom Exp $ + +. ./setup-vars + +$DIALOG --title "MESSAGE BOX" --clear "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to \ + display any message you like. The box will remain until \ + you press the ENTER key." 10 41 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/msgbox-help b/contrib/dialog/samples/msgbox-help new file mode 100755 index 0000000..3825f6b --- /dev/null +++ b/contrib/dialog/samples/msgbox-help @@ -0,0 +1,14 @@ +#!/bin/sh +# $Id: msgbox-help,v 1.6 2010/01/13 10:53:11 tom Exp $ + +. ./setup-vars + +$DIALOG --title "MESSAGE BOX" --clear \ + --help-button "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to \ + display any message you like. The box will remain until \ + you press the ENTER key." 10 41 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/msgbox-utf8 b/contrib/dialog/samples/msgbox-utf8 new file mode 100755 index 0000000..e733150 --- /dev/null +++ b/contrib/dialog/samples/msgbox-utf8 @@ -0,0 +1,14 @@ +#!/bin/sh +# $Id: msgbox-utf8,v 1.1 2011/01/18 00:25:30 tom Exp $ +# from Debian #570634 + +. ./setup-vars + +. ./setup-utf8 + +${DIALOG-dialog} "$@" \ + --title "ทดสอบวรรณยุกต์" \ + --msgbox "วรรณยุกต์อยู่ท้ายบรรทัดได้หรือไม่" 8 23 +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/msgbox1 b/contrib/dialog/samples/msgbox1 new file mode 100755 index 0000000..b7ef824 --- /dev/null +++ b/contrib/dialog/samples/msgbox1 @@ -0,0 +1,34 @@ +#!/bin/sh +# $Id: msgbox1,v 1.9 2010/01/13 10:26:52 tom Exp $ + +. ./setup-vars + +$DIALOG --title "MESSAGE BOX" --clear "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to + display any message you like. The box will remain until + you press the ENTER key. This box is being displayed + with dialogs default aspect ratio of 9." 0 0 +test $? = $DIALOG_ESC && exit + +$DIALOG --aspect 12 --title "MESSAGE BOX aspect=12" --clear "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to + display any message you like. The box will remain until + you press the ENTER key. This box is being displayed + with an aspect ratio of 12." 0 0 +test $? = $DIALOG_ESC && exit + +$DIALOG --aspect 6 --title "MESSAGE BOX aspect=6" --clear "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to + display any message you like. The box will remain until + you press the ENTER key. This box is being displayed + with an aspect ratio of 6." 0 0 +test $? = $DIALOG_ESC && exit + +$DIALOG --aspect 6 --cr-wrap --title "MESSAGE BOX aspect=6 with --cr-wrap" \ + --clear --msgbox " "$@" \ + Hi, this is a simple + message box. You can + use this to display any + message you like. +The box will remain until you press the ENTER key. This box is being displayed with an aspect ratio of 6, and using --cr-wrap.\n" 0 0 +test $? = $DIALOG_ESC && exit diff --git a/contrib/dialog/samples/msgbox2 b/contrib/dialog/samples/msgbox2 new file mode 100755 index 0000000..b39f65a --- /dev/null +++ b/contrib/dialog/samples/msgbox2 @@ -0,0 +1,34 @@ +#!/bin/sh +# $Id: msgbox2,v 1.7 2010/01/13 10:26:52 tom Exp $ + +. ./setup-vars + +$DIALOG --title "MESSAGE BOX" --trim "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to + display any message you like. The box will remain until + you press the ENTER key. This box is being displayed + with dialogs default aspect ratio of 9." 0 0 +test $? = $DIALOG_ESC && exit + +$DIALOG --aspect 12 --title "MESSAGE BOX aspect=12" --trim "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to + display any message you like. The box will remain until + you press the ENTER key. This box is being displayed + with an aspect ratio of 12." 0 0 +test $? = $DIALOG_ESC && exit + +$DIALOG --aspect 6 --title "MESSAGE BOX aspect=6" --trim "$@" \ + --msgbox "Hi, this is a simple message box. You can use this to + display any message you like. The box will remain until + you press the ENTER key. This box is being displayed + with an aspect ratio of 6." 0 0 +test $? = $DIALOG_ESC && exit + +$DIALOG --aspect 6 --cr-wrap --title "MESSAGE BOX aspect=6 with --cr-wrap" \ + --trim --msgbox " "$@" \ + Hi, this is a simple + message box. You can + use this to display any + message you like. +The box will remain until you press the ENTER key. This box is being displayed with an aspect ratio of 6, and using --cr-wrap.\n" 0 0 +test $? = $DIALOG_ESC && exit diff --git a/contrib/dialog/samples/msgbox3 b/contrib/dialog/samples/msgbox3 new file mode 100755 index 0000000..d1ea108 --- /dev/null +++ b/contrib/dialog/samples/msgbox3 @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id: msgbox3,v 1.7 2010/01/13 10:26:52 tom Exp $ + +. ./setup-vars + +width=35 +while test $width != 61 +do +$DIALOG --title "MESSAGE BOX (width $width)" --clear --no-collapse "$@" \ + --msgbox "\ + H H EEEEE L L OOO + H H E L L O O + HHHHH EEEEE L L O O + H H E L L O O + H H EEEEE LLLLL LLLLL OOO + +Hi, this is a simple message box. You can use this to \ +display any message you like. The box will remain until \ +you press the ENTER key." 15 $width +test $? = $DIALOG_ESC && break +width=`expr $width + 1` +done diff --git a/contrib/dialog/samples/msgbox4-8bit b/contrib/dialog/samples/msgbox4-8bit new file mode 100755 index 0000000..216ac8e --- /dev/null +++ b/contrib/dialog/samples/msgbox4-8bit @@ -0,0 +1,31 @@ +#!/bin/sh +# $Id: msgbox4-8bit,v 1.4 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./testdata-8bit + +width=30 +while test $width != 61 +do +$DIALOG --title "MESSAGE BOX (width $width)" --no-collapse --colors "$@" \ + --msgbox "\ +This sample uses characters which are non-printing in POSIX locale. + +\Z1`./rotated-data 0 $SAMPLE` \Z2`./rotated-data 1 $SAMPLE` \Z3`./rotated-data 2 $SAMPLE` \Z4`./rotated-data 3 $SAMPLE`\Zn + +Hi, this is a simple message box. You can use this to \ +display any message you like. The box will remain until \ +you press the ENTER key." 22 $width +retval=$? + +case $retval in + $DIALOG_CANCEL) + echo "Cancel pressed.";exit;; + $DIALOG_ESC) + echo "ESC pressed.";exit;; +esac + +width=`expr $width + 1` + +done diff --git a/contrib/dialog/samples/msgbox4-eucjp b/contrib/dialog/samples/msgbox4-eucjp new file mode 100755 index 0000000..9969c08 --- /dev/null +++ b/contrib/dialog/samples/msgbox4-eucjp @@ -0,0 +1,25 @@ +#!/bin/sh +# $Id: msgbox4-eucjp,v 1.5 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +width=35 +while test $width != 61 +do +$DIALOG --title "MESSAGE BOX (width $width)" --clear --no-collapse "$@" \ + --msgbox "\ +This sample is written in EUC-JP. +There are several checking points: +(1) whether the fullwidth characters are displayed well or not, +(2) whether the width of characters are evaluated properly, and +(3) whether the character at line-folding is lost or not. + +ĤƤȤʤˤ̤ͤ + +£ãģţƣǣȣɣʣˣ̣ͣΣϣУѣңӣԣգ֣ףأ + +Hi, this is a simple message box. You can use this to \ +display any message you like. The box will remain until \ +you press the ENTER key." 22 $width +width=`expr $width + 1` +done diff --git a/contrib/dialog/samples/msgbox4-utf8 b/contrib/dialog/samples/msgbox4-utf8 new file mode 100755 index 0000000..acbbebe --- /dev/null +++ b/contrib/dialog/samples/msgbox4-utf8 @@ -0,0 +1,37 @@ +#!/bin/sh +# $Id: msgbox4-utf8,v 1.10 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-utf8 + +width=30 +while test $width != 61 +do +$DIALOG --title "MESSAGE BOX (width $width)" --no-collapse "$@" \ + --msgbox "\ +This sample is written in UTF-8. +There are several checking points: +(1) whether the fullwidth characters are displayed well or not, +(2) whether the width of characters are evaluated properly, and +(3) whether the character at line-folding is lost or not. + +あいうえおかきくけこさしすせそたちつてとなにぬねの +1234567890123456789012345 +ABCDEFGHIJKLMNOPQRSTUVWXY + +Hi, this is a simple message box. You can use this to \ +display any message you like. The box will remain until \ +you press the ENTER key." 22 $width +retval=$? + +case $retval in + $DIALOG_CANCEL) + echo "Cancel pressed.";exit;; + $DIALOG_ESC) + echo "ESC pressed.";exit;; +esac + +width=`expr $width + 1` + +done diff --git a/contrib/dialog/samples/msgbox5 b/contrib/dialog/samples/msgbox5 new file mode 100755 index 0000000..f5d9427 --- /dev/null +++ b/contrib/dialog/samples/msgbox5 @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id: msgbox5,v 1.5 2010/01/13 10:26:52 tom Exp $ +# this differs from msgbox3 by making a window small enough to force scrolling. + +. ./setup-vars + +width=35 +while test $width != 61 +do +$DIALOG --title "MESSAGE BOX (width $width)" --clear --no-collapse "$@" \ + --msgbox "\ + H H EEEEE L L OOO + H H E L L O O + HHHHH EEEEE L L O O + H H E L L O O + H H EEEEE LLLLL LLLLL OOO + +Hi, this is a simple message box. You can use this to \ +display any message you like. The box will remain until \ +you press the ENTER key." 10 $width +test $? = $DIALOG_ESC && break +width=`expr $width + 1` +done diff --git a/contrib/dialog/samples/msgbox6 b/contrib/dialog/samples/msgbox6 new file mode 100755 index 0000000..1d30f02 --- /dev/null +++ b/contrib/dialog/samples/msgbox6 @@ -0,0 +1,17 @@ +#!/bin/sh +# $Id: msgbox6,v 1.5 2010/01/13 10:26:52 tom Exp $ +# this differs from msgbox3 by making a window small enough to force scrolling. + +. ./setup-vars + +width=35 +while test $width != 61 +do +$DIALOG --title "MESSAGE BOX (width $width)" --clear "$@" \ + --msgbox "\ + a b c d e f g h j i j k l m n o p q r s t u v w x y z + A B C D E F G H J I J K L M N O P Q R S T U V W X Y Z +" 10 $width +test $? = $DIALOG_ESC && break +width=`expr $width + 1` +done diff --git a/contrib/dialog/samples/msgbox6a b/contrib/dialog/samples/msgbox6a new file mode 100755 index 0000000..e84edbf --- /dev/null +++ b/contrib/dialog/samples/msgbox6a @@ -0,0 +1,17 @@ +#!/bin/sh +# $Id: msgbox6a,v 1.5 2010/01/13 10:26:52 tom Exp $ +# this differs from msgbox3 by making a window small enough to force scrolling. + +. ./setup-vars + +width=35 +while test $width != 61 +do +$DIALOG --title "MESSAGE BOX (width $width)" --clear "$@" \ + --msgbox "\ + .a .b .c .d .e .f .g .h .j .i .j .k .l .m .n .o .p .q .r .s .t .u .v .w .x .y .z + .A .B .C .D .E .F .G .H .J .I .J .K .L .M .N .O .P .Q .R .S .T .U .V .W .X .Y .Z +" 10 $width +test $? = $DIALOG_ESC && break +width=`expr $width + 1` +done diff --git a/contrib/dialog/samples/password b/contrib/dialog/samples/password new file mode 100755 index 0000000..4517043 --- /dev/null +++ b/contrib/dialog/samples/password @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: password,v 1.7 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear "$@" \ + --passwordbox "Hi, this is an password dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/password1 b/contrib/dialog/samples/password1 new file mode 100755 index 0000000..adeabc0 --- /dev/null +++ b/contrib/dialog/samples/password1 @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: password1,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear \ + --insecure "$@" \ + --passwordbox "Hi, this is an password dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/password2 b/contrib/dialog/samples/password2 new file mode 100755 index 0000000..91a7e45 --- /dev/null +++ b/contrib/dialog/samples/password2 @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: password2,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "INPUT BOX" --clear \ + --insecure "$@" \ + --passwordbox "Hi, this is an password dialog box. You can use \n +this to ask questions that require the user \n +to input a string as the answer. You can \n +input strings of length longer than the \n +width of the input box, in that case, the \n +input field will be automatically scrolled. \n +You can use BACKSPACE to correct errors. \n\n +Try entering your name below:" 16 51 stupid 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/passwordform1 b/contrib/dialog/samples/passwordform1 new file mode 100755 index 0000000..7c3c1f0 --- /dev/null +++ b/contrib/dialog/samples/passwordform1 @@ -0,0 +1,69 @@ +#! /bin/sh +# $Id: passwordform1,v 1.5 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +backtitle="An Example for the use of --form:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="$USER" +home="$HOME" + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --backtitle "$backtitle" \ + --insecure "$@" \ + --passwordform "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/passwordform1-utf8 b/contrib/dialog/samples/passwordform1-utf8 new file mode 100755 index 0000000..3dda34c --- /dev/null +++ b/contrib/dialog/samples/passwordform1-utf8 @@ -0,0 +1,71 @@ +#! /bin/sh +# $Id: passwordform1-utf8,v 1.7 2010/01/13 10:47:35 tom Exp $ + +. ./setup-vars + +. ./setup-utf8 + +backtitle="An Example for the use of --passwordform:" + +ids=`id|sed -e 's/([^)]*)//g'` +uid=`echo "$ids" | sed -e 's/^uid=//' -e 's/ .*//'` +gid=`echo "$ids" | sed -e 's/^.* gid=//' -e 's/ .*//'` + +user="DOG" +home=/usr/home/$user + +returncode=0 +while test $returncode != 1 && test $returncode != 250 +do +exec 3>&1 +value=`$DIALOG --ok-label "Submit" \ + --backtitle "$backtitle" \ + --insecure "$@" \ + --passwordform "Here is a possible piece of a configuration program." \ +20 50 0 \ + "Username:" 1 1 "$user" 1 10 10 0 \ + "UID:" 2 1 "$uid" 2 10 8 0 \ + "GID:" 3 1 "$gid" 3 10 8 0 \ + "HOME:" 4 1 "$home" 4 10 40 0 \ +2>&1 1>&3` +returncode=$? +exec 3>&- + +show=`echo "$value" |sed -e 's/^/ /'` + + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) + break + ;; + $DIALOG_CANCEL) + returncode=99 + ;; + esac + ;; + $DIALOG_OK) + "$DIALOG" \ + --clear \ + --backtitle "$backtitle" --no-collapse --cr-wrap \ + --msgbox "Resulting data:\n\ +$show" 10 40 + ;; + $DIALOG_HELP) + echo "Button 2 (Help) pressed." + exit + ;; + $DIALOG_EXTRA) + echo "Button 3 (Extra) pressed." + exit + ;; + *) + echo "Return code was $returncode" + exit + ;; + esac +done diff --git a/contrib/dialog/samples/pause b/contrib/dialog/samples/pause new file mode 100755 index 0000000..64e211b --- /dev/null +++ b/contrib/dialog/samples/pause @@ -0,0 +1,10 @@ +#!/bin/sh +# $Id: pause,v 1.5 2010/01/14 00:27:23 tom Exp $ + +. ./setup-vars + +$DIALOG --title "PAUSE" "$@" --pause "Hi, this is a pause widget" 20 70 10 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/pause-both b/contrib/dialog/samples/pause-both new file mode 100755 index 0000000..aa72936 --- /dev/null +++ b/contrib/dialog/samples/pause-both @@ -0,0 +1,14 @@ +#!/bin/sh +# $Id: pause-both,v 1.1 2011/01/18 09:49:24 tom Exp $ + +. ./setup-vars + +$DIALOG --title "PAUSE" \ + --help-button \ + --extra-button "$@" \ + --pause "Hi, this is a pause widget" 20 70 10 + +retval=$? +echo return $retval + +. ./report-button diff --git a/contrib/dialog/samples/pause-extra b/contrib/dialog/samples/pause-extra new file mode 100755 index 0000000..846e108 --- /dev/null +++ b/contrib/dialog/samples/pause-extra @@ -0,0 +1,13 @@ +#!/bin/sh +# $Id: pause-extra,v 1.1 2011/01/18 09:49:07 tom Exp $ + +. ./setup-vars + +$DIALOG --title "PAUSE" \ + --extra-button "$@" \ + --pause "Hi, this is a pause widget" 20 70 10 + +retval=$? +echo return $retval + +. ./report-button diff --git a/contrib/dialog/samples/pause-help b/contrib/dialog/samples/pause-help new file mode 100755 index 0000000..2d3656e --- /dev/null +++ b/contrib/dialog/samples/pause-help @@ -0,0 +1,12 @@ +#!/bin/sh +# $Id: pause-help,v 1.5 2010/01/13 10:36:00 tom Exp $ + +. ./setup-vars + +$DIALOG --title "PAUSE" \ + --help-button "$@" \ + --pause "Hi, this is a pause widget" 20 70 10 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/prgbox b/contrib/dialog/samples/prgbox new file mode 100755 index 0000000..c06a630 --- /dev/null +++ b/contrib/dialog/samples/prgbox @@ -0,0 +1,9 @@ +#!/bin/sh +# $Id: prgbox,v 1.2 2012/07/02 09:46:24 tom Exp $ + +. ./setup-vars + +$DIALOG --title "PRGBOX" "$@" --prgbox "./shortlist" 20 70 + +retval=$? +. ./report-button diff --git a/contrib/dialog/samples/prgbox2 b/contrib/dialog/samples/prgbox2 new file mode 100755 index 0000000..ba94622 --- /dev/null +++ b/contrib/dialog/samples/prgbox2 @@ -0,0 +1,9 @@ +#!/bin/sh +# $Id: prgbox2,v 1.2 2012/07/02 09:46:24 tom Exp $ + +. ./setup-vars + +$DIALOG --title "PRGBOX" "$@" --prgbox "./shortlist 3" 20 70 + +retval=$? +. ./report-button diff --git a/contrib/dialog/samples/programbox b/contrib/dialog/samples/programbox new file mode 100755 index 0000000..9fa0abc --- /dev/null +++ b/contrib/dialog/samples/programbox @@ -0,0 +1,19 @@ +#!/bin/sh +# $Id: programbox,v 1.1 2011/03/02 01:17:28 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +ls -1 >$tempfile +( +while true +do +read text +test -z "$text" && break +ls -ld "$text" +sleep 0.1 +done <$tempfile +) | + +$DIALOG --title "PROGRAMBOX" "$@" --programbox 20 70 diff --git a/contrib/dialog/samples/programbox2 b/contrib/dialog/samples/programbox2 new file mode 100755 index 0000000..63f87df --- /dev/null +++ b/contrib/dialog/samples/programbox2 @@ -0,0 +1,19 @@ +#!/bin/sh +# $Id: programbox2,v 1.1 2011/03/02 01:25:31 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +ls -1 >$tempfile +( +while true +do +read text +test -z "$text" && break +ls -ld "$text" +sleep 0.1 +done <$tempfile +) | + +$DIALOG --title "PROGRAMBOX" "$@" --programbox "ProgramBox" 20 70 diff --git a/contrib/dialog/samples/progress b/contrib/dialog/samples/progress new file mode 100755 index 0000000..6ad45d8 --- /dev/null +++ b/contrib/dialog/samples/progress @@ -0,0 +1,19 @@ +#!/bin/sh +# $Id: progress,v 1.5 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +ls -1 >$tempfile +( +while true +do +read text +test -z "$text" && break +ls -ld "$text" +sleep 1 +done <$tempfile +) | + +$DIALOG --title "PROGRESS" "$@" --progressbox 20 70 diff --git a/contrib/dialog/samples/progress2 b/contrib/dialog/samples/progress2 new file mode 100755 index 0000000..564433b --- /dev/null +++ b/contrib/dialog/samples/progress2 @@ -0,0 +1,19 @@ +#!/bin/sh +# $Id: progress2,v 1.5 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +ls -1 >$tempfile +( +while true +do +read text +test -z "$text" && break +ls -ld "$text" +sleep 1 +done <$tempfile +) | + +$DIALOG --title "PROGRESS" "$@" --progressbox "This is a detailed description\nof the progress-box." 20 70 diff --git a/contrib/dialog/samples/radiolist b/contrib/dialog/samples/radiolist new file mode 100755 index 0000000..602ad82 --- /dev/null +++ b/contrib/dialog/samples/radiolist @@ -0,0 +1,28 @@ +#! /bin/sh +# $Id: radiolist,v 1.13 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --backtitle "No Such Organization" \ + --title "RADIOLIST BOX" --clear "$@" \ + --radiolist "Hi, this is a radiolist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple." off \ + "Dog" "No, that's not my dog." ON \ + "Orange" "Yeah, that's juicy." off \ + "Chicken" "Normally not a pet." off \ + "Cat" "No, never put a dog and a cat together!" off \ + "Fish" "Cats like fish." off \ + "Lemon" "You know how it tastes." off 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/radiolist1 b/contrib/dialog/samples/radiolist1 new file mode 100755 index 0000000..77defa5 --- /dev/null +++ b/contrib/dialog/samples/radiolist1 @@ -0,0 +1,33 @@ +#! /bin/sh +# $Id: radiolist1,v 1.1 2010/01/17 23:05:14 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --backtitle "No Such Organization" \ + --title "RADIOLIST BOX" --clear "$@" \ + --radiolist "Hi, this is a radiolist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple." off \ + "Dog" "No, that's not my dog." ON \ + "Dog2" "No2, that's not my dog." off \ + "Dog3" "No3, that's not my dog." off \ + "Dog4" "No4, that's not my dog." off \ + "Dog5" "No5, that's not my dog." off \ + "Dog6" "No6, that's not my dog." off \ + "Orange" "Yeah, that's juicy." off \ + "Chicken" "Normally not a pet." off \ + "Cat" "No, never put a dog and a cat together!" off \ + "Fish" "Cats like fish." off \ + "Lemon" "You know how it tastes." off 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/radiolist10 b/contrib/dialog/samples/radiolist10 new file mode 100755 index 0000000..2953871 --- /dev/null +++ b/contrib/dialog/samples/radiolist10 @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: radiolist10,v 1.6 2010/01/13 10:20:03 tom Exp $ +# zero-width column + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG \ + --backtitle "No such organization" \ + --title "RADIOLIST BOX" "$@" \ + --radiolist "Hi, this is a radiolist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + Dialog "" on \ + Readline "" off \ + Gnome "" off \ + Kde "" off \ + Editor "" off \ + Noninteractive "" on \ + 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/radiolist2 b/contrib/dialog/samples/radiolist2 new file mode 100755 index 0000000..e2965ea --- /dev/null +++ b/contrib/dialog/samples/radiolist2 @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: radiolist2,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --ok-label Okay \ + --cancel-label 'Give Up' \ + --backtitle "No Such Organization" \ + --title "RADIOLIST BOX" --clear "$@" \ + --radiolist "Hi, this is a radiolist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple." off \ + "Dog" "No, that's not my dog." ON \ + "Orange" "Yeah, that's juicy." off \ + "Chicken" "Normally not a pet." off \ + "Cat" "No, never put a dog and a cat together!" off \ + "Fish" "Cats like fish." off \ + "Lemon" "You know how it tastes." off 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/radiolist3 b/contrib/dialog/samples/radiolist3 new file mode 100755 index 0000000..6c695e7 --- /dev/null +++ b/contrib/dialog/samples/radiolist3 @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: radiolist3,v 1.9 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --item-help --ok-label Okay \ + --cancel-label 'Give Up' \ + --backtitle "No Such Organization" \ + --title "RADIOLIST BOX" --clear "$@" \ + --radiolist "Hi, this is a radiolist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple." off "Hint: this grows in a tree" \ + "Dog" "No, that's not my dog." ON "Hint: this likes trees" \ + "Orange" "Yeah, that's juicy." off "Hint: this is green when picked" \ + "Chicken" "Normally not a pet." off "Hint: not often in trees" \ + "Cat" "No, never put a dog and a cat together!" off "Hint: may be found in trees" \ + "Fish" "Cats like fish." off "Hint: usually not close to cats" \ + "Lemon" "You know how it tastes." off "Hint: like an orange" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/radiolist4 b/contrib/dialog/samples/radiolist4 new file mode 100755 index 0000000..67d920f --- /dev/null +++ b/contrib/dialog/samples/radiolist4 @@ -0,0 +1,30 @@ +#! /bin/sh +# $Id: radiolist4,v 1.9 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --help-button --help-label "Hints" --item-help --ok-label Okay \ + --cancel-label 'Give Up' \ + --backtitle "No Such Organization" \ + --title "RADIOLIST BOX" --clear "$@" \ + --radiolist "Hi, this is a radiolist box. You can use this to \n\ +present a list of choices which can be turned on or \n\ +off. If there are more items than can fit on the \n\ +screen, the list will be scrolled. You can use the \n\ +UP/DOWN arrow keys, the first letter of the choice as a \n\ +hot key, or the number keys 1-9 to choose an option. \n\ +Press SPACE to toggle an option on/off. \n\n\ + Which of the following are fruits?" 20 61 5 \ + "Apple" "It's an apple." off "Hint: this grows in a tree" \ + "Dog" "No, that's not my dog." ON "Hint: this likes trees" \ + "Orange" "Yeah, that's juicy." off "Hint: this is green when picked" \ + "Chicken" "Normally not a pet." off "Hint: not often in trees" \ + "Cat" "No, never put a dog and a cat together!" off "Hint: may be found in trees" \ + "Fish" "Cats like fish." off "Hint: usually not close to cats" \ + "Lemon" "You know how it tastes." off "Hint: like an orange" 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/rangebox b/contrib/dialog/samples/rangebox new file mode 100755 index 0000000..d864026 --- /dev/null +++ b/contrib/dialog/samples/rangebox @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: rangebox,v 1.3 2012/12/05 10:07:54 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 0 123 5 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/rangebox2 b/contrib/dialog/samples/rangebox2 new file mode 100755 index 0000000..f67f02b --- /dev/null +++ b/contrib/dialog/samples/rangebox2 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: rangebox2,v 1.1 2012/12/05 10:28:58 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 0 6 5 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/rangebox3 b/contrib/dialog/samples/rangebox3 new file mode 100755 index 0000000..19dad64 --- /dev/null +++ b/contrib/dialog/samples/rangebox3 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: rangebox3,v 1.1 2012/12/05 10:19:42 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 -48 55 5 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/rangebox4 b/contrib/dialog/samples/rangebox4 new file mode 100755 index 0000000..b8b68c2 --- /dev/null +++ b/contrib/dialog/samples/rangebox4 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: rangebox4,v 1.1 2012/12/05 11:54:04 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "RANGE BOX" --rangebox "Please set the volume..." 0 60 10 100 5 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/report-button b/contrib/dialog/samples/report-button new file mode 100644 index 0000000..c6a1730 --- /dev/null +++ b/contrib/dialog/samples/report-button @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: report-button,v 1.3 2012/06/29 09:29:36 tom Exp $ +# Report button-only, no $RESULT +# vile:shmode + +case $retval in + $DIALOG_OK) + echo "OK";; + $DIALOG_CANCEL) + echo "Cancel pressed.";; + $DIALOG_HELP) + echo "Help pressed.";; + $DIALOG_EXTRA) + echo "Extra button pressed.";; + $DIALOG_ITEM_HELP) + echo "Item-help button pressed.";; + $DIALOG_ERROR) + echo "ERROR!";; + $DIALOG_ESC) + echo "ESC pressed.";; +esac diff --git a/contrib/dialog/samples/report-edit b/contrib/dialog/samples/report-edit new file mode 100644 index 0000000..37e3eb0 --- /dev/null +++ b/contrib/dialog/samples/report-edit @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id: report-edit,v 1.4 2012/06/29 09:29:41 tom Exp $ +# Report results from editing. +# vile:shmode + +case $retval in + $DIALOG_OK) + diff -c $input $output + echo "OK" + ;; + $DIALOG_CANCEL) + echo "Cancel pressed";; + $DIALOG_HELP) + echo "Help pressed";; + $DIALOG_EXTRA) + echo "Extra pressed";; + $DIALOG_ITEM_HELP) + echo "Item-help button pressed.";; + $DIALOG_ERROR) + echo "ERROR!";; + $DIALOG_ESC) + echo "ESC pressed.";; +esac diff --git a/contrib/dialog/samples/report-string b/contrib/dialog/samples/report-string new file mode 100644 index 0000000..dc96c2f --- /dev/null +++ b/contrib/dialog/samples/report-string @@ -0,0 +1,24 @@ +#!/bin/sh +# $Id: report-string,v 1.3 2012/06/29 09:32:17 tom Exp $ +# Report result passed in a string $RESULT +# vile:shmode + +case $retval in + $DIALOG_OK) + echo "Result is $RESULT";; + $DIALOG_CANCEL) + echo "Cancel pressed.";; + $DIALOG_HELP) + echo "Help pressed ($RESULT).";; + $DIALOG_EXTRA) + echo "Extra button pressed.";; + $DIALOG_ITEM_HELP) + echo "Item-help button pressed.";; + $DIALOG_ESC) + if test -n "$RESULT" ; then + echo "$RESULT" + else + echo "ESC pressed." + fi + ;; +esac diff --git a/contrib/dialog/samples/report-tempfile b/contrib/dialog/samples/report-tempfile new file mode 100644 index 0000000..4c5f099 --- /dev/null +++ b/contrib/dialog/samples/report-tempfile @@ -0,0 +1,24 @@ +#!/bin/sh +# $Id: report-tempfile,v 1.5 2013/09/02 18:03:13 tom Exp $ +# Report results in a temporary-file. +# vile:shmode + +case $retval in + $DIALOG_OK) + echo "Result: `cat $tempfile`";; + $DIALOG_CANCEL) + echo "Cancel pressed.";; + $DIALOG_HELP) + echo "Help pressed: `cat $tempfile`";; + $DIALOG_EXTRA) + echo "Extra button pressed.";; + $DIALOG_ITEM_HELP) + echo "Item-help button pressed: `cat $tempfile`";; + $DIALOG_ESC) + if test -s $tempfile ; then + cat $tempfile + else + echo "ESC pressed." + fi + ;; +esac diff --git a/contrib/dialog/samples/report-yesno b/contrib/dialog/samples/report-yesno new file mode 100644 index 0000000..d22ebe4 --- /dev/null +++ b/contrib/dialog/samples/report-yesno @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: report-yesno,v 1.2 2012/06/29 09:32:12 tom Exp $ +# Report button-only, no $RESULT +# vile:shmode + +case $retval in + $DIALOG_OK) + echo "YES";; + $DIALOG_CANCEL) + echo "NO";; + $DIALOG_HELP) + echo "Help pressed.";; + $DIALOG_EXTRA) + echo "Extra button pressed.";; + $DIALOG_ITEM_HELP) + echo "Item-help button pressed.";; + $DIALOG_ERROR) + echo "ERROR!";; + $DIALOG_ESC) + echo "ESC pressed.";; +esac diff --git a/contrib/dialog/samples/rotated-data b/contrib/dialog/samples/rotated-data new file mode 100755 index 0000000..dc40714 --- /dev/null +++ b/contrib/dialog/samples/rotated-data @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id: rotated-data,v 1.1 2004/12/19 16:43:47 tom Exp $ +# Rotate the second parameter's data by the given shift count. +if test $# != 0 +then + case $1 in + [1-9]*) + left=$1 + next=`expr $left + 1` + shift 1 + ;; + *) + left=1 + next=2 + ;; + esac + char=`echo "$@" | cut -b -${left}` + data=`echo "$@" | cut -b ${next}-` + + printf "%s%s\n" $data $char +else + echo +fi diff --git a/contrib/dialog/samples/setup-edit b/contrib/dialog/samples/setup-edit new file mode 100644 index 0000000..8f9d284 --- /dev/null +++ b/contrib/dialog/samples/setup-edit @@ -0,0 +1,7 @@ +#!/bin/sh +# $Id: setup-edit,v 1.2 2012/06/29 09:31:49 tom Exp $ +# vile:shmode + +input=`tempfile 2>/dev/null` || input=/tmp/input$$ +output=`tempfile 2>/dev/null` || output=/tmp/test$$ +trap "rm -f $input $output" $SIG_NONE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM diff --git a/contrib/dialog/samples/setup-tempfile b/contrib/dialog/samples/setup-tempfile new file mode 100644 index 0000000..3a67ea6 --- /dev/null +++ b/contrib/dialog/samples/setup-tempfile @@ -0,0 +1,6 @@ +#!/bin/sh +# $Id: setup-tempfile,v 1.3 2012/07/06 17:51:56 tom Exp $ +# vile:shmode + +tempfile=`(tempfile) 2>/dev/null` || tempfile=/tmp/test$$ +trap "rm -f $tempfile" 0 $SIG_NONE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM diff --git a/contrib/dialog/samples/setup-utf8 b/contrib/dialog/samples/setup-utf8 new file mode 100644 index 0000000..07cff39 --- /dev/null +++ b/contrib/dialog/samples/setup-utf8 @@ -0,0 +1,12 @@ +#!/bin/sh +# $Id: setup-utf8,v 1.2 2012/06/29 09:50:32 tom Exp $ +# vile:shmode + +case none"$LANG$LC_ALL$LC_CTYPE" in +*UTF-8*) + ;; +*) + echo "This script must be run in a UTF-8 locale" + exit 1 + ;; +esac diff --git a/contrib/dialog/samples/setup-vars b/contrib/dialog/samples/setup-vars new file mode 100644 index 0000000..f0ea779 --- /dev/null +++ b/contrib/dialog/samples/setup-vars @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id: setup-vars,v 1.3 2012/06/29 09:52:26 tom Exp $ +# vile:shmode + +# These symbols are defined to use in the sample shell scripts to make them +# more readable. But they are (intentionally) not exported. If they were +# exported, they would also be visible in the dialog program (a subprocess). + +: ${DIALOG=dialog} + +: ${DIALOG_OK=0} +: ${DIALOG_CANCEL=1} +: ${DIALOG_HELP=2} +: ${DIALOG_EXTRA=3} +: ${DIALOG_ITEM_HELP=4} +: ${DIALOG_ESC=255} + +: ${SIG_NONE=0} +: ${SIG_HUP=1} +: ${SIG_INT=2} +: ${SIG_QUIT=3} +: ${SIG_KILL=9} +: ${SIG_TERM=15} diff --git a/contrib/dialog/samples/shortlist b/contrib/dialog/samples/shortlist new file mode 100755 index 0000000..bda8b4e --- /dev/null +++ b/contrib/dialog/samples/shortlist @@ -0,0 +1,19 @@ +#!/bin/sh +# $Id: shortlist,v 1.2 2011/03/02 00:11:50 tom Exp $ +# make a short listing, which writes to both stdout and stderr. + +if test $# != 0 +then + count=$1 +else + count=10 +fi + +while test $count != 0 +do + echo "** $count -- `date`" + w >&2 + sleep 1 + count=`expr $count - 1 2>/dev/null` + test -z "$count" && count=0 +done diff --git a/contrib/dialog/samples/slackware.rc b/contrib/dialog/samples/slackware.rc new file mode 100644 index 0000000..82f1ee8 --- /dev/null +++ b/contrib/dialog/samples/slackware.rc @@ -0,0 +1,142 @@ +# $Id: slackware.rc,v 1.10 2012/12/01 00:36:55 tom Exp $ +# vile:confmode +# Run-time configuration file for dialog, matches Slackware color scheme. +# +# Types of values: +# +# Number - <number> +# String - "string" +# Boolean - <ON|OFF> +# Attribute - (foreground,background,highlight?) + +# Set aspect-ration. +aspect = 0 + +# Set separator (for multiple widgets output). +separate_widget = "" + +# Set tab-length (for textbox tab-conversion). +tab_len = 0 + +# Make tab-traversal for checklist, etc., include the list. +visit_items = OFF + +# Shadow dialog boxes? This also turns on color. +use_shadow = ON + +# Turn color support ON or OFF +use_colors = ON + +# Screen color +screen_color = (WHITE,BLUE,OFF) + +# Shadow color +shadow_color = (WHITE,BLACK,OFF) + +# Dialog box color +dialog_color = (BLACK,CYAN,OFF) + +# Dialog box title color +title_color = (YELLOW,CYAN,ON) + +# Dialog box border color +border_color = (CYAN,CYAN,ON) + +# Active button color +button_active_color = (WHITE,BLUE,ON) + +# Inactive button color +button_inactive_color = dialog_color + +# Active button key color +button_key_active_color = button_active_color + +# Inactive button key color +button_key_inactive_color = (RED,CYAN,OFF) + +# Active button label color +button_label_active_color = button_active_color + +# Inactive button label color +button_label_inactive_color = (BLACK,CYAN,ON) + +# Input box color +inputbox_color = (BLUE,WHITE,OFF) + +# Input box border color +inputbox_border_color = border_color + +# Search box color +searchbox_color = (YELLOW,WHITE,ON) + +# Search box title color +searchbox_title_color = (WHITE,WHITE,ON) + +# Search box border color +searchbox_border_color = (RED,WHITE,OFF) + +# File position indicator color +position_indicator_color = button_key_inactive_color + +# Menu box color +menubox_color = dialog_color + +# Menu box border color +menubox_border_color = border_color + +# Item color +item_color = dialog_color + +# Selected item color +item_selected_color = screen_color + +# Tag color +tag_color = title_color + +# Selected tag color +tag_selected_color = screen_color + +# Tag key color +tag_key_color = button_key_inactive_color + +# Selected tag key color +tag_key_selected_color = (RED,BLUE,ON) + +# Check box color +check_color = dialog_color + +# Selected check box color +check_selected_color = (WHITE,CYAN,ON) + +# Up arrow color +uarrow_color = (GREEN,CYAN,ON) + +# Down arrow color +darrow_color = uarrow_color + +# Item help-text color +itemhelp_color = shadow_color + +# Active form text color +form_active_text_color = inputbox_color + +# Form text color +form_text_color = (CYAN,BLUE,ON) + +# Readonly form item color +form_item_readonly_color = (CYAN,WHITE,ON) + +# Dialog box gauge color +gauge_color = (BLUE,WHITE,ON) + +# Dialog box border2 color +border2_color = dialog_color + +# Input box border2 color +inputbox_border2_color = border2_color + +# Search box border2 color +searchbox_border2_color = border2_color + +# Menu box border2 color +menubox_border2_color = border2_color diff --git a/contrib/dialog/samples/sourcemage.rc b/contrib/dialog/samples/sourcemage.rc new file mode 100644 index 0000000..9384798 --- /dev/null +++ b/contrib/dialog/samples/sourcemage.rc @@ -0,0 +1,142 @@ +# $Id: sourcemage.rc,v 1.6 2011/10/15 01:00:41 tom Exp $ +# vile:confmode +# Run-time configuration file for dialog, matches SourceMage color scheme. +# +# Types of values: +# +# Number - <number> +# String - "string" +# Boolean - <ON|OFF> +# Attribute - (foreground,background,highlight?) + +# Set aspect-ration. +aspect = 0 + +# Set separator (for multiple widgets output). +separate_widget = "" + +# Set tab-length (for textbox tab-conversion). +tab_len = 0 + +# Make tab-traversal for checklist, etc., include the list. +visit_items = OFF + +# Shadow dialog boxes? This also turns on color. +use_shadow = ON + +# Turn color support ON or OFF +use_colors = ON + +# Screen color +screen_color = (RED,BLACK,ON) + +# Shadow color +shadow_color = (BLACK,BLACK,ON) + +# Dialog box color +dialog_color = (BLACK,WHITE,OFF) + +# Dialog box title color +title_color = (RED,WHITE,ON) + +# Dialog box border color +border_color = (WHITE,WHITE,ON) + +# Active button color +button_active_color = (WHITE,RED,ON) + +# Inactive button color +button_inactive_color = dialog_color + +# Active button key color +button_key_active_color = button_active_color + +# Inactive button key color +button_key_inactive_color = (RED,WHITE,OFF) + +# Active button label color +button_label_active_color = (RED,RED,ON) + +# Inactive button label color +button_label_inactive_color = (BLACK,WHITE,ON) + +# Input box color +inputbox_color = dialog_color + +# Input box border color +inputbox_border_color = dialog_color + +# Search box color +searchbox_color = dialog_color + +# Search box title color +searchbox_title_color = title_color + +# Search box border color +searchbox_border_color = border_color + +# File position indicator color +position_indicator_color = title_color + +# Menu box color +menubox_color = dialog_color + +# Menu box border color +menubox_border_color = border_color + +# Item color +item_color = dialog_color + +# Selected item color +item_selected_color = button_active_color + +# Tag color +tag_color = title_color + +# Selected tag color +tag_selected_color = button_label_active_color + +# Tag key color +tag_key_color = title_color + +# Selected tag key color +tag_key_selected_color = button_active_color + +# Check box color +check_color = dialog_color + +# Selected check box color +check_selected_color = button_active_color + +# Up arrow color +uarrow_color = title_color + +# Down arrow color +darrow_color = title_color + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = dialog_color + +# Form text color +form_text_color = screen_color + +# Readonly form item color +form_item_readonly_color = (CYAN,WHITE,ON) + +# Dialog box gauge color +gauge_color = (BLUE,WHITE,ON) + +# Dialog box border2 color +border2_color = dialog_color + +# Input box border2 color +inputbox_border2_color = dialog_color + +# Search box border2 color +searchbox_border2_color = dialog_color + +# Menu box border2 color +menubox_border2_color = dialog_color diff --git a/contrib/dialog/samples/suse.rc b/contrib/dialog/samples/suse.rc new file mode 100644 index 0000000..c8ff099 --- /dev/null +++ b/contrib/dialog/samples/suse.rc @@ -0,0 +1,142 @@ +# $Id: suse.rc,v 1.5 2011/10/15 01:01:00 tom Exp $ +# vile:confmode +# Run-time configuration file for dialog, matches SuSE color scheme. +# +# Types of values: +# +# Number - <number> +# String - "string" +# Boolean - <ON|OFF> +# Attribute - (foreground,background,highlight?) + +# Set aspect-ration. +aspect = 0 + +# Set separator (for multiple widgets output). +separate_widget = "" + +# Set tab-length (for textbox tab-conversion). +tab_len = 0 + +# Make tab-traversal for checklist, etc., include the list. +visit_items = OFF + +# Shadow dialog boxes? This also turns on color. +use_shadow = OFF + +# Turn color support ON or OFF +use_colors = OFF + +# Screen color +screen_color = (CYAN,BLUE,ON) + +# Shadow color +shadow_color = (BLACK,BLACK,OFF) + +# Dialog box color +dialog_color = (BLACK,WHITE,OFF) + +# Dialog box title color +title_color = (YELLOW,WHITE,ON) + +# Dialog box border color +border_color = (WHITE,WHITE,ON) + +# Active button color +button_active_color = (WHITE,BLUE,ON) + +# Inactive button color +button_inactive_color = dialog_color + +# Active button key color +button_key_active_color = button_active_color + +# Inactive button key color +button_key_inactive_color = (RED,WHITE,OFF) + +# Active button label color +button_label_active_color = (YELLOW,BLUE,ON) + +# Inactive button label color +button_label_inactive_color = (BLACK,WHITE,ON) + +# Input box color +inputbox_color = dialog_color + +# Input box border color +inputbox_border_color = dialog_color + +# Search box color +searchbox_color = dialog_color + +# Search box title color +searchbox_title_color = title_color + +# Search box border color +searchbox_border_color = border_color + +# File position indicator color +position_indicator_color = title_color + +# Menu box color +menubox_color = dialog_color + +# Menu box border color +menubox_border_color = border_color + +# Item color +item_color = dialog_color + +# Selected item color +item_selected_color = button_active_color + +# Tag color +tag_color = title_color + +# Selected tag color +tag_selected_color = button_label_active_color + +# Tag key color +tag_key_color = button_key_inactive_color + +# Selected tag key color +tag_key_selected_color = (RED,BLUE,ON) + +# Check box color +check_color = dialog_color + +# Selected check box color +check_selected_color = button_active_color + +# Up arrow color +uarrow_color = (GREEN,WHITE,ON) + +# Down arrow color +darrow_color = uarrow_color + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = button_active_color + +# Form text color +form_text_color = (WHITE,CYAN,ON) + +# Readonly form item color +form_item_readonly_color = (CYAN,WHITE,ON) + +# Dialog box gauge color +gauge_color = (BLUE,WHITE,ON) + +# Dialog box border2 color +border2_color = dialog_color + +# Input box border2 color +inputbox_border2_color = dialog_color + +# Search box border2 color +searchbox_border2_color = dialog_color + +# Menu box border2 color +menubox_border2_color = dialog_color diff --git a/contrib/dialog/samples/tailbox b/contrib/dialog/samples/tailbox new file mode 100755 index 0000000..227104e --- /dev/null +++ b/contrib/dialog/samples/tailbox @@ -0,0 +1,16 @@ +#!/bin/sh +# $Id: tailbox,v 1.7 2010/01/13 10:36:18 tom Exp $ + +. ./setup-vars + +./killall listing +./listing >listing.out & + +$DIALOG --title "TAIL BOX" "$@" \ + --tailbox listing.out 24 70 + +retval=$? + +. ./report-button + +./killall listing diff --git a/contrib/dialog/samples/tailboxbg b/contrib/dialog/samples/tailboxbg new file mode 100755 index 0000000..bcc3434 --- /dev/null +++ b/contrib/dialog/samples/tailboxbg @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id: tailboxbg,v 1.10 2012/06/29 09:48:28 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +./killall listing +./listing >listing.out & + +$DIALOG --title "TAIL BOX" \ + --no-kill "$@" \ + --tailboxbg listing.out 24 70 2>$tempfile + +# wait a while for the background process to run +sleep 10 + +# now kill it +kill -$SIG_QUIT `cat $tempfile` 2>&1 >/dev/null 2>/dev/null + +# ...and the process that is making the listing +./killall listing diff --git a/contrib/dialog/samples/tailboxbg1 b/contrib/dialog/samples/tailboxbg1 new file mode 100755 index 0000000..f04567a --- /dev/null +++ b/contrib/dialog/samples/tailboxbg1 @@ -0,0 +1,32 @@ +#!/bin/sh +# $Id: tailboxbg1,v 1.10 2012/06/29 09:51:46 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +./killall listing +./listing >listing.out & + +$DIALOG --title "TAIL BOXES" \ + --begin 10 10 "$@" --tailboxbg listing.out 8 58 \ + --and-widget \ + --begin 15 15 "$@" --tailboxbg listing.out 8 58 \ + --and-widget \ + --begin 3 10 "$@" --msgbox "Press OK " 5 30 \ + 2>$tempfile + +# The --and-widget causes a tab to be emitted, but our example will only +# write one number to stderr. +pid=`cat $tempfile |sed -e 's/ //g'` +if test -n "$pid" ; then +# wait a while for the background process to run +sleep 10 + +# now kill it +kill -$SIG_QUIT $pid 2>&1 >/dev/null 2>/dev/null +echo "killed [$pid]" +fi + +# ...and the process that is making the listing +./killall listing diff --git a/contrib/dialog/samples/tailboxbg2 b/contrib/dialog/samples/tailboxbg2 new file mode 100755 index 0000000..628cb05 --- /dev/null +++ b/contrib/dialog/samples/tailboxbg2 @@ -0,0 +1,33 @@ +#!/bin/sh +# $Id: tailboxbg2,v 1.10 2012/06/29 09:51:11 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +./killall listing +./listing >listing.out & + +$DIALOG --title "TAIL BOXES" \ + --no-kill \ + --begin 10 10 "$@" --tailboxbg listing.out 8 58 \ + --and-widget \ + --begin 15 15 "$@" --tailboxbg listing.out 8 58 \ + --and-widget \ + --begin 3 10 "$@" --msgbox "Press OK " 5 30 \ + 2>$tempfile + +# The --and-widget causes a tab to be emitted, but our example will only +# write one number to stderr. +pid=`cat $tempfile |sed -e 's/ //g'` +if test -n "$pid" ; then +# wait a while for the background process to run +sleep 10 + +# now kill it +kill -$SIG_QUIT $pid 2>&1 >/dev/null 2>/dev/null +echo "killed [$pid]" +fi + +# ...and the process that is making the listing +./killall listing diff --git a/contrib/dialog/samples/testdata-8bit b/contrib/dialog/samples/testdata-8bit new file mode 100755 index 0000000..f09021d --- /dev/null +++ b/contrib/dialog/samples/testdata-8bit @@ -0,0 +1,48 @@ +#!/bin/sh +# $Id: testdata-8bit,v 1.2 2011/10/16 23:26:32 tom Exp $ + +# Select one of the "SAMPLE=" lines, to test handling of characters which +# are nonprinting in a POSIX locale: + +case .$1 in + # C1 controls +.8) + SAMPLE="" + ;; +.9) + SAMPLE="" + ;; + +# Latin-1 +.[aA]) + SAMPLE="" + ;; +.[bB]) + SAMPLE="" + ;; +.[cC]) + SAMPLE="" + ;; +.[dD]) + SAMPLE="" + ;; +.[eE]) + SAMPLE="" + ;; +.[fF]) + SAMPLE="" + ;; +*) + # C0 controls (except a few which are always treated specially by curses): + SAMPLE="" + ;; +esac + +# This script is source'd from other scripts, and uses the parameter list from +# those explicitly. But they may use the parameter list later, to set options +# specially for dialog. Work around the conflicting uses by removing the +# parameter which we just used to select a set of data. +if test $# != 0 +then + shift 1 +fi diff --git a/contrib/dialog/samples/textbox b/contrib/dialog/samples/textbox new file mode 100755 index 0000000..d3c7698 --- /dev/null +++ b/contrib/dialog/samples/textbox @@ -0,0 +1,44 @@ +#!/bin/sh +# $Id: textbox,v 1.12 2010/01/13 10:36:35 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +cat << EOF > $tempfile +Hi, this is a text dialog box. It can be used to display text from a file. +The file should not contain any 'tab' characters, so you should 'expand' +the file first if it contains 'tab' characters. + +It's like a simple text file viewer, with these keys implemented: + +PGDN/SPACE - Move down one page +PGUP/'b' - Move up one page +ENTER/DOWN/'j' - Move down one line +UP/'k' - Move up one line +LEFT/'h' - Scroll left +RIGHT/'l' - Scroll right +'0' - Move to beginning of line +HOME/'g' - Move to beginning of file +END/'G' - Move to end of file +'/' - Forward search +'?' - Backward search +'n' - Repeat last search (forward) +'N' - Repeat last search (backward) + + +The following is a sample text file: + + +EOF + +TEXT=/usr/share/common-licenses/GPL +test -f $TEXT || TEXT=../COPYING + +cat $TEXT | expand >> $tempfile + +$DIALOG --clear --title "TEXT BOX" "$@" --textbox "$tempfile" 22 77 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/textbox-both b/contrib/dialog/samples/textbox-both new file mode 100755 index 0000000..7875153 --- /dev/null +++ b/contrib/dialog/samples/textbox-both @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: textbox-both,v 1.1 2011/01/18 09:59:47 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +TEXT=/usr/share/common-licenses/GPL +test -f $TEXT || TEXT=../COPYING + +cat textbox.txt | expand > $tempfile +cat $TEXT | expand >> $tempfile + +$DIALOG --clear --title "TEXT BOX" \ + --help-button \ + --extra-button "$@" \ + --textbox "$tempfile" 22 77 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/textbox-help b/contrib/dialog/samples/textbox-help new file mode 100755 index 0000000..cb30253 --- /dev/null +++ b/contrib/dialog/samples/textbox-help @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: textbox-help,v 1.1 2011/01/18 09:59:20 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +TEXT=/usr/share/common-licenses/GPL +test -f $TEXT || TEXT=../COPYING + +cat textbox.txt | expand > $tempfile +cat $TEXT | expand >> $tempfile + +$DIALOG --clear --title "TEXT BOX" \ + --help-button "$@" \ + --textbox "$tempfile" 22 77 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/textbox.txt b/contrib/dialog/samples/textbox.txt new file mode 100644 index 0000000..3aaec0f --- /dev/null +++ b/contrib/dialog/samples/textbox.txt @@ -0,0 +1,24 @@ +Hi, this is a text dialog box. It can be used to display text from a file. +The file should not contain any 'tab' characters, so you should 'expand' +the file first if it contains 'tab' characters. + +It's like a simple text file viewer, with these keys implemented: + +PGDN/SPACE - Move down one page +PGUP/'b' - Move up one page +ENTER/DOWN/'j' - Move down one line +UP/'k' - Move up one line +LEFT/'h' - Scroll left +RIGHT/'l' - Scroll right +'0' - Move to beginning of line +HOME/'g' - Move to beginning of file +END/'G' - Move to end of file +'/' - Forward search +'?' - Backward search +'n' - Repeat last search (forward) +'N' - Repeat last search (backward) + + +The following is a sample text file: + + diff --git a/contrib/dialog/samples/textbox2 b/contrib/dialog/samples/textbox2 new file mode 100755 index 0000000..7c97de8 --- /dev/null +++ b/contrib/dialog/samples/textbox2 @@ -0,0 +1,44 @@ +#!/bin/sh +# $Id: textbox2,v 1.8 2010/01/13 10:36:49 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +cat << EOF > $tempfile +Hi, this is a text dialog box. It can be used to display text from a file. +The file should not contain any 'tab' characters, so you should 'expand' +the file first if it contains 'tab' characters. + +It's like a simple text file viewer, with these keys implemented: + +PGDN/SPACE - Move down one page +PGUP/'b' - Move up one page +ENTER/DOWN/'j' - Move down one line +UP/'k' - Move up one line +LEFT/'h' - Scroll left +RIGHT/'l' - Scroll right +'0' - Move to beginning of line +HOME/'g' - Move to beginning of file +END/'G' - Move to end of file +'/' - Forward search +'?' - Backward search +'n' - Repeat last search (forward) +'N' - Repeat last search (backward) + + +The following is a sample text file: + + +EOF + +TEXT=/usr/share/common-licenses/GPL +test -f $TEXT || TEXT=../COPYING + +cat $TEXT | expand >> $tempfile + +$DIALOG --clear --title "TEXT BOX" "$@" --textbox "$tempfile" 0 0 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/textbox3 b/contrib/dialog/samples/textbox3 new file mode 100755 index 0000000..2c076e9 --- /dev/null +++ b/contrib/dialog/samples/textbox3 @@ -0,0 +1,20 @@ +#!/bin/sh +# $Id: textbox3,v 1.6 2010/01/13 10:37:01 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +TEXT=/usr/share/common-licenses/GPL +test -f $TEXT || TEXT=../COPYING + +cat textbox.txt | expand > $tempfile +cat $TEXT | expand >> $tempfile + +$DIALOG --clear --title "TEXT BOX" \ + --extra-button "$@" \ + --textbox "$tempfile" 22 77 + +retval=$? + +. ./report-button diff --git a/contrib/dialog/samples/timebox b/contrib/dialog/samples/timebox new file mode 100755 index 0000000..cb6bf5c --- /dev/null +++ b/contrib/dialog/samples/timebox @@ -0,0 +1,14 @@ +#!/bin/sh +# $Id: timebox,v 1.9 2010/01/13 10:23:10 tom Exp $ + +. ./setup-vars + +DIALOG_ERROR=254 +export DIALOG_ERROR + +exec 3>&1 +RESULT=`$DIALOG --title "TIMEBOX" "$@" --timebox "Please set the time..." 0 0 12 34 56 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/timebox-stdout b/contrib/dialog/samples/timebox-stdout new file mode 100755 index 0000000..10a0026 --- /dev/null +++ b/contrib/dialog/samples/timebox-stdout @@ -0,0 +1,10 @@ +#!/bin/sh +# $Id: timebox-stdout,v 1.5 2010/01/13 10:37:19 tom Exp $ + +. ./setup-vars + +RESULT=`$DIALOG --stdout --title "TIMEBOX" "$@" --timebox "Please set the time..." 0 0 12 34 56` + +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/timebox2 b/contrib/dialog/samples/timebox2 new file mode 100755 index 0000000..088acdf --- /dev/null +++ b/contrib/dialog/samples/timebox2 @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: timebox2,v 1.7 2010/01/13 10:37:35 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "TIMEBOX" "$@" --timebox "Please set the time..." 0 0 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/timebox2-stdout b/contrib/dialog/samples/timebox2-stdout new file mode 100755 index 0000000..922921f --- /dev/null +++ b/contrib/dialog/samples/timebox2-stdout @@ -0,0 +1,10 @@ +#!/bin/sh +# $Id: timebox2-stdout,v 1.5 2010/01/13 10:37:55 tom Exp $ + +. ./setup-vars + +RESULT=`$DIALOG --stdout --title "TIMEBOX" "$@" --timebox "Please set the time..." 0 0` + +retval=$? + +. ./report-string diff --git a/contrib/dialog/samples/treeview b/contrib/dialog/samples/treeview new file mode 100755 index 0000000..3421218 --- /dev/null +++ b/contrib/dialog/samples/treeview @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id: treeview,v 1.2 2012/12/04 10:53:09 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +$DIALOG --title "TREE VIEW DIALOG" \ + --treeview "TreeView demo" 0 0 0 \ + tag1 one off 0 \ + tag2 two off 1 \ + tag3 three on 2 \ + tag4 four off 1 \ + tag5 five off 2 \ + tag6 six off 3 \ + tag7 seven off 3 \ + tag8 eight off 4 \ + tag9 nine off 1 2> $tempfile + +retval=$? + +. ./report-tempfile diff --git a/contrib/dialog/samples/treeview2 b/contrib/dialog/samples/treeview2 new file mode 100755 index 0000000..b3dde41 --- /dev/null +++ b/contrib/dialog/samples/treeview2 @@ -0,0 +1,52 @@ +#!/bin/sh +# $Id: treeview2,v 1.3 2012/12/23 22:28:00 tom Exp $ + +. ./setup-vars + +. ./setup-edit + +case "x$DIALOGOPTS" in +*--no-items*|*--noitem*) + CUT="cut -d: -f1,3,4" + ;; +*) + CUT="cat" + ;; +esac + +$CUT >$input <<-EOF + tag1:one:off:0 + tag2:two:off:1 + tag3:three:on:2 + tag4:four:off:1 + tag5:five:off:2 + tag6:six:off:3 + tag7:seven:off:3 + tag8:eight:off:4 + tag11:1one:off:0 + tag12:1two:off:1 + tag13:1three:on:2 + tag14:1four:off:1 + tag15:1five:off:2 + tag16:1six:off:3 + tag17:1seven:off:3 + tag18:1eight:off:4 + tag21:2one:off:0 + tag22:2two:off:1 + tag23:2three:on:2 + tag24:2four:off:1 + tag25:2five:off:2 + tag26:2six:off:3 + tag27:2seven:off:3 + tag28:2eight:off:4 + tag9:nine:off:1 +EOF + +$DIALOG --title "TREE VIEW DIALOG" \ + --scrollbar \ + --treeview "TreeView demo" 0 0 10 `cat $input | sed -e 's/:/ /g'` 2> $output + +retval=$? + +tempfile=$output +. ./report-tempfile diff --git a/contrib/dialog/samples/wheel b/contrib/dialog/samples/wheel new file mode 100755 index 0000000..4adef26 --- /dev/null +++ b/contrib/dialog/samples/wheel @@ -0,0 +1,64 @@ +#!/bin/sh +# $Id: wheel,v 1.8 2012/06/29 09:59:40 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +TITLE="This screen was taken from ComeOn Point Installer! v0.9 by ComeOn Linux!" + +$DIALOG --print-maxsize 2>$tempfile +ROWS="`cut $tempfile -f1 -d, | cut -f2 -d:`" +COLS="`cut $tempfile -f2 -d,`" +rm $tempfile + +# account for widest labels +COLS=`expr $COLS - 30` + +# Takes an integer, multiplies it for COLS, divides for 132 +scalex() { + expr $1 \* $COLS / 132 +} +scaley() { + expr $1 \* $ROWS / 60 +} + +$DIALOG --backtitle "$TITLE" --no-shadow \ +--begin `scaley 27` `scalex 98` --infobox "pushd /var/log >/dev/null" 0 0 --and-widget \ +--begin `scaley 35` `scalex 95` --infobox "mkdir -p news -m 755" 0 0 --and-widget \ +--begin `scaley 45` `scalex 86` --infobox "chown news.news news" 0 0 --and-widget \ +--begin `scaley 48` `scalex 78` --infobox "cd /var/log/news" 0 0 --and-widget \ +--begin `scaley 51` `scalex 61` --infobox "mkdir -p OLD -m 755" 0 0 --and-widget \ +--begin `scaley 52` `scalex 47` --infobox "chown news.news OLD" 0 0 --and-widget \ +--begin `scaley 51` `scalex 40` --infobox "cd /var/spool" 0 0 --and-widget \ +--begin `scaley 48` `scalex 25` --infobox "mkdir -p news -m 775" 0 0 --and-widget \ +--begin `scaley 42` `scalex 13` --infobox "chown news.news news" 0 0 --and-widget \ +--begin `scaley 35` `scalex 4` --infobox "cd /var/spool/news" 0 0 --and-widget \ +--begin `scaley 27` `scalex 2` --infobox "CURMASK=`umask`" 0 0 --and-widget \ +--begin `scaley 19` `scalex 4` --infobox "umask 02" 0 0 --and-widget \ +--begin `scaley 11` `scalex 13` --infobox "mkdir -p out.going control junk in.coming" 0 0 --and-widget \ +--begin `scaley 5` `scalex 25` --infobox "chown news.news out.going control junk in.coming" 0 0 --and-widget \ +--begin `scaley 2` `scalex 37` --infobox "cd in.coming" 0 0 --and-widget \ +--begin `scaley 1` `scalex 46` --infobox "mkdir -p bad tmp" 0 0 --and-widget \ +--begin `scaley 2` `scalex 61` --infobox "chown news.news bad tmp" 0 0 --and-widget \ +--begin `scaley 5` `scalex 76` --infobox "umask $CURMASK" 0 0 --and-widget \ +--begin `scaley 11` `scalex 87` --infobox "ln -sf ~news /usr/local/lib/" 0 0 --and-widget \ +--begin `scaley 18` `scalex 95` --infobox "ln -sf ~news/inews /usr/bin/" 0 0 --and-widget \ +--begin `scaley 26` `scalex 97` --infobox "chmod 1777 /var/tmp" 0 0 --and-widget \ +--begin `scaley 34` `scalex 95` --infobox "cd ~news" 0 0 --and-widget \ +--begin `scaley 42` `scalex 87` --infobox "touch history history.dir history.pag errlog log" 0 0 --and-widget \ +--begin `scaley 47` `scalex 76` --infobox "chown news.news history* log errlog" 0 0 --and-widget \ +--infobox "Creating spooling and logging directories and files..." 0 0 --and-widget \ +--begin `scaley 51` `scalex 78` --infobox "chmod 664 history* log errlog" 0 0 --and-widget \ +--begin `scaley 52` `scalex 60` --infobox "echo \"control 0000000000 0000000001 y\" > active" 0 0 --and-widget \ +--begin `scaley 51` `scalex 42` --infobox "echo \"junk 0000000000 0000000001 y\" >> active" 0 0 --and-widget \ +--begin `scaley 48` `scalex 26` --infobox "chown news.news active" 0 0 --and-widget \ +--begin `scaley 42` `scalex 13` --infobox "echo \"control 814573260 usenet\" > active.times" 0 0 --and-widget \ +--begin `scaley 35` `scalex 4` --infobox "echo \"junk 814573260 usenet\" >> active.times" 0 0 --and-widget \ +--begin `scaley 27` `scalex 2` --infobox "chown news.news active.times" 0 0 --and-widget \ +--begin `scaley 19` `scalex 4` --infobox ":>newsgroups" 0 0 --and-widget \ +--begin `scaley 11` `scalex 12` --infobox "chown news.news newsgroups" 0 0 --and-widget \ +--sleep 2 --begin `scaley 6` `scalex 25` --infobox "popd >/dev/null" 0 0 --and-widget \ +--beep --msgbox "ComeOn Linux! :-)" 0 0 --and-widget \ +--begin 2 0 --title "/var/adm/debug. This is running while that down runs also" --tailboxbg /var/adm/debug 6 80 --and-widget \ +--begin 8 0 --title "/var/adm/messages. It tails the file in multitasking with /var/adm/debug" --tailbox /var/adm/messages -1 -1 diff --git a/contrib/dialog/samples/whiptail.rc b/contrib/dialog/samples/whiptail.rc new file mode 100644 index 0000000..81ad653 --- /dev/null +++ b/contrib/dialog/samples/whiptail.rc @@ -0,0 +1,142 @@ +# $Id: whiptail.rc,v 1.6 2012/12/01 01:15:04 tom Exp $ +# vile:confmode +# Run-time configuration file for dialog, matches whiptail's color scheme. +# +# Types of values: +# +# Number - <number> +# String - "string" +# Boolean - <ON|OFF> +# Attribute - (foreground,background,highlight?) + +# Set aspect-ration. +aspect = 0 + +# Set separator (for multiple widgets output). +separate_widget = "" + +# Set tab-length (for textbox tab-conversion). +tab_len = 0 + +# Make tab-traversal for checklist, etc., include the list. +visit_items = ON + +# Shadow dialog boxes? This also turns on color. +use_shadow = ON + +# Turn color support ON or OFF +use_colors = ON + +# Screen color +screen_color = (YELLOW,BLUE,ON) + +# Shadow color +shadow_color = (BLACK,BLACK,ON) + +# Dialog box color +dialog_color = (BLACK,WHITE,OFF) + +# Dialog box title color +title_color = (RED,WHITE,ON) + +# Dialog box border color +border_color = (WHITE,WHITE,ON) + +# Active button color +button_active_color = (WHITE,RED,ON) + +# Inactive button color +button_inactive_color = dialog_color + +# Active button key color +button_key_active_color = button_active_color + +# Inactive button key color +button_key_inactive_color = dialog_color + +# Active button label color +button_label_active_color = button_active_color + +# Inactive button label color +button_label_inactive_color = (BLACK,WHITE,ON) + +# Input box color +inputbox_color = dialog_color + +# Input box border color +inputbox_border_color = dialog_color + +# Search box color +searchbox_color = dialog_color + +# Search box title color +searchbox_title_color = title_color + +# Search box border color +searchbox_border_color = border_color + +# File position indicator color +position_indicator_color = title_color + +# Menu box color +menubox_color = (YELLOW,BLUE,OFF) + +# Menu box border color +menubox_border_color = screen_color + +# Item color +item_color = menubox_color + +# Selected item color +item_selected_color = screen_color + +# Tag color +tag_color = screen_color + +# Selected tag color +tag_selected_color = screen_color + +# Tag key color +tag_key_color = menubox_color + +# Selected tag key color +tag_key_selected_color = (WHITE,BLUE,ON) + +# Check box color +check_color = menubox_color + +# Selected check box color +check_selected_color = screen_color + +# Up arrow color +uarrow_color = screen_color + +# Down arrow color +darrow_color = screen_color + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = tag_key_selected_color + +# Form text color +form_text_color = (WHITE,CYAN,ON) + +# Readonly form item color +form_item_readonly_color = (CYAN,WHITE,ON) + +# Dialog box gauge color +gauge_color = (BLUE,WHITE,ON) + +# Dialog box border2 color +border2_color = dialog_color + +# Input box border2 color +inputbox_border2_color = dialog_color + +# Search box border2 color +searchbox_border2_color = dialog_color + +# Menu box border2 color +menubox_border2_color = screen_color diff --git a/contrib/dialog/samples/with-dquotes b/contrib/dialog/samples/with-dquotes new file mode 100755 index 0000000..604f51b --- /dev/null +++ b/contrib/dialog/samples/with-dquotes @@ -0,0 +1,3 @@ +#!/bin/sh +# $Id: with-dquotes,v 1.1 2012/07/03 09:40:19 tom Exp $ +DIALOGOPTS="$DIALOGOPTS --quoted" "$@" diff --git a/contrib/dialog/samples/with-squotes b/contrib/dialog/samples/with-squotes new file mode 100755 index 0000000..6a08f9f --- /dev/null +++ b/contrib/dialog/samples/with-squotes @@ -0,0 +1,3 @@ +#!/bin/sh +# $Id: with-squotes,v 1.1 2012/07/03 09:40:29 tom Exp $ +DIALOGOPTS="$DIALOGOPTS --single-quoted" "$@" diff --git a/contrib/dialog/samples/yesno b/contrib/dialog/samples/yesno new file mode 100755 index 0000000..fa1ea44 --- /dev/null +++ b/contrib/dialog/samples/yesno @@ -0,0 +1,21 @@ +#!/bin/sh +# $Id: yesno,v 1.9 2010/01/14 01:11:11 tom Exp $ + +. ./setup-vars + +DIALOG_ERROR=254 +export DIALOG_ERROR + +$DIALOG --title "YES/NO BOX" --clear "$@" \ + --yesno "Hi, this is a yes/no dialog box. You can use this to ask \ + questions that have an answer of either yes or no. \ + BTW, do you notice that long lines will be automatically \ + wrapped around so that they can fit in the box? You can \ + also control line breaking explicitly by inserting \ + 'backslash n' at any place you like, but in this case, \ + auto wrap around will be disabled and you will have to \ + control line breaking yourself." 15 61 + +retval=$? + +. ./report-yesno diff --git a/contrib/dialog/samples/yesno-both b/contrib/dialog/samples/yesno-both new file mode 100755 index 0000000..a408bdb --- /dev/null +++ b/contrib/dialog/samples/yesno-both @@ -0,0 +1,24 @@ +#!/bin/sh +# $Id: yesno-both,v 1.5 2010/01/13 10:40:39 tom Exp $ + +. ./setup-vars + +$DIALOG --title "YES/NO/MAYBE BOX" \ + --clear \ + --ok-label "Next" \ + --no-label "Cancel" \ + --extra-label "Previous" --extra-button \ + --help-button "$@" \ + --yesno "Hi, this is a yes/no dialog box with its labels changed. \ + You can use this to ask \ + questions that have an answer of either yes or no (or maybe). \ + BTW, do you notice that long lines will be automatically \ + wrapped around so that they can fit in the box? You can \ + also control line breaking explicitly by inserting \ + 'backslash n' at any place you like, but in this case, \ + auto wrap around will be disabled and you will have to \ + control line breaking yourself." 15 61 + +retval=$? + +. ./report-yesno diff --git a/contrib/dialog/samples/yesno-extra b/contrib/dialog/samples/yesno-extra new file mode 100755 index 0000000..ce31b81 --- /dev/null +++ b/contrib/dialog/samples/yesno-extra @@ -0,0 +1,23 @@ +#!/bin/sh +# $Id: yesno-extra,v 1.5 2010/01/13 10:40:39 tom Exp $ + +. ./setup-vars + +$DIALOG --title "YES/NO/MAYBE BOX" \ + --clear \ + --ok-label "Next" \ + --no-label "Cancel" \ + --extra-label "Previous" --extra-button "$@" \ + --yesno "Hi, this is a yes/no dialog box with its labels changed. \ + You can use this to ask \ + questions that have an answer of either yes or no (or maybe). \ + BTW, do you notice that long lines will be automatically \ + wrapped around so that they can fit in the box? You can \ + also control line breaking explicitly by inserting \ + 'backslash n' at any place you like, but in this case, \ + auto wrap around will be disabled and you will have to \ + control line breaking yourself." 15 61 + +retval=$? + +. ./report-yesno diff --git a/contrib/dialog/samples/yesno-help b/contrib/dialog/samples/yesno-help new file mode 100755 index 0000000..1333f1c --- /dev/null +++ b/contrib/dialog/samples/yesno-help @@ -0,0 +1,18 @@ +#!/bin/sh +# $Id: yesno-help,v 1.5 2010/01/13 10:40:39 tom Exp $ + +. ./setup-vars + +$DIALOG --title "YES/NO BOX" --clear --help-button "$@" \ + --yesno "Hi, this is a yes/no dialog box. You can use this to ask \ + questions that have an answer of either yes or no. \ + BTW, do you notice that long lines will be automatically \ + wrapped around so that they can fit in the box? You can \ + also control line breaking explicitly by inserting \ + 'backslash n' at any place you like, but in this case, \ + auto wrap around will be disabled and you will have to \ + control line breaking yourself." 15 61 + +retval=$? + +. ./report-yesno diff --git a/contrib/dialog/samples/yesno-utf8 b/contrib/dialog/samples/yesno-utf8 new file mode 100755 index 0000000..4a6be30 --- /dev/null +++ b/contrib/dialog/samples/yesno-utf8 @@ -0,0 +1,14 @@ +#! /bin/sh +# $Id: yesno-utf8,v 1.7 2010/01/14 01:11:23 tom Exp $ + +. ./setup-vars + +. ./setup-utf8 + +DIALOG_ERROR=254 +export DIALOG_ERROR + +$DIALOG "$@" --yesno "Are you a DOG?" 0 0 +retval=$? + +. ./report-yesno diff --git a/contrib/dialog/samples/yesno2 b/contrib/dialog/samples/yesno2 new file mode 100755 index 0000000..d022352 --- /dev/null +++ b/contrib/dialog/samples/yesno2 @@ -0,0 +1,18 @@ +#!/bin/sh +# $Id: yesno2,v 1.7 2010/01/13 10:40:39 tom Exp $ + +. ./setup-vars + +$DIALOG --title "YES/NO BOX" "$@" \ + --yesno "Hi, this is a yes/no dialog box. You can use this to ask \ +questions that have an answer of either yes or no. \ +BTW, do you notice that long lines will be automatically \ +wrapped around so that they can fit in the box? You can \ +also control line breaking explicitly by inserting \ +'backslash n' at any place you like, but in this case, \ +auto wrap around will be disabled and you will have to \ +control line breaking yourself." 0 0 + +retval=$? + +. ./report-yesno diff --git a/contrib/dialog/samples/yesno3 b/contrib/dialog/samples/yesno3 new file mode 100755 index 0000000..f67fb85 --- /dev/null +++ b/contrib/dialog/samples/yesno3 @@ -0,0 +1,18 @@ +#!/bin/sh +# $Id: yesno3,v 1.6 2010/01/13 10:40:39 tom Exp $ + +. ./setup-vars + +$DIALOG --timeout 20 --title "YES/NO BOX" "$@" \ + --yesno "Hi, this is a yes/no dialog box. You can use this to ask \ +questions that have an answer of either yes or no. \ +BTW, do you notice that long lines will be automatically \ +wrapped around so that they can fit in the box? You can \ +also control line breaking explicitly by inserting \ +'backslash n' at any place you like, but in this case, \ +auto wrap around will be disabled and you will have to \ +control line breaking yourself." 0 0 + +retval=$? + +. ./report-yesno diff --git a/contrib/dialog/samples/yesno4 b/contrib/dialog/samples/yesno4 new file mode 100755 index 0000000..99f65e8 --- /dev/null +++ b/contrib/dialog/samples/yesno4 @@ -0,0 +1,18 @@ +#!/bin/sh +# $Id: yesno4,v 1.1 2010/01/14 10:26:40 tom Exp $ + +. ./setup-vars + +$DIALOG --title "YES/NO BOX" "$@" \ + --yesno "Hi, this is a yes/no dialog box. You can use this to ask \ +questions that have an answer of either yes or no. \ +BTW, do you notice that long lines will be automatically \ +wrapped around so that they can fit in the box? You can \ +also control line breaking explicitly by inserting \ +'backslash n' at any place you like, but in this case, \ +auto wrap around will be disabled and you will have to \ +control line breaking yourself." 6 30 + +retval=$? + +. ./report-yesno |