diff options
Diffstat (limited to 'contrib/dialog/samples')
178 files changed, 8883 insertions, 0 deletions
diff --git a/contrib/dialog/samples/README b/contrib/dialog/samples/README new file mode 100644 index 0000000..91f668f --- /dev/null +++ b/contrib/dialog/samples/README @@ -0,0 +1,40 @@ +-- $Id: README,v 1.3 2007/01/11 22:52:19 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. + +-- Here is the original README for the samples directory. + +There is no documentation at the moment for cdialog 0.9a, but here are a +small installer (copismall) for 'points' fido-like, that uses cdialog 0.9a. +It can demonstrate some of the new features... run "copismall" paying +attention because after asking for some things, it then installs and/or +configures programs like as Inn, Ifmail, Smail to make the 'point'. +It's in Italian language only at moment, but the code is bash...... +If you want look at other much professional products FREE realized with +cdialog and that use much of the other new characteristics, look for one of +the ComeOn Point Suites v1.1+. Makers are a sub-group of the ComeOn Linux +Development Team... ComeOn Linux! follows GNU philosophy. + +Mail demarco_p@abramo.it to have the actual location of these Suites and +of other free ComeOn Linux! software, or if you want more info about +ComeOn Linux! + +To run the "ComeOn Point Installer! v0.9a.small", type: +$ copismall + +Other external samples could be: + +copa - ComeOn Point Administrator! v0.8 +copm - ComeOn Point Maintainer! v0.2 +copi - ComeOn Point Installer! v0.9 (system-wide version of copi) +coepi - ComeOn Expert Point Installer! v1.3 (Professional) + +cops - ComeOn Point Suite! v1.1 +copsp - ComeOn Point Suite Professional! v1.1 + +coui - ComeOn UUCP Installer! v0.1 (makes dialup networks in a moment) + 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/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/copifuncs/admin.funcs b/contrib/dialog/samples/copifuncs/admin.funcs new file mode 100755 index 0000000..27800dc --- /dev/null +++ b/contrib/dialog/samples/copifuncs/admin.funcs @@ -0,0 +1,200 @@ +#!/bin/bash +# $Id: admin.funcs,v 1.2 2001/01/15 22:20:11 tom Exp $ +# +# ComeOn Point Functions! v0.9.2 +# - usate da vari altri moduli ComeOn Point... +# +# AUTHOR: Beppe (beppe.dem@nsm.it) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# Args: source_file, domain, nldir +install_nodelist() { + + NODELIST="$1" + FOR_DOMAIN="$2" + NODEDIR="$3" + + dialog --backtitle "$TITLE" --infobox "Installo la nodelist '$NODELIST' per il domain $FOR_DOMAIN, attendere prego..." 0 0 + + cp "$NODELIST" $NODEDIR/$FOR_DOMAIN.ndl + chown fnet.uucp $NODEDIR/$FOR_DOMAIN.ndl + + echo "y" | su -l fnet -c "ifindex" >/dev/null +} + +# Args: source, dest +add_alias() { + + SOURCE=$1 + DEST=$2 + ALIASES=/etc/aliases + ENTRY="`grep $SOURCE: $ALIASES`" + + dialog --backtitle "$TITLE" --infobox "Creo un alias per redirigere le mail per $SOURCE a $DEST ..." 0 0 + + if [ ! "$ENTRY" ] + then + echo "$SOURCE: $DEST" >>$ALIASES + else + OLDDEST="`echo $ENTRY | cut -f2 -d:`" + mkstemp alias + sed /"$SOURCE:"/s/"$OLDDEST"/" $DEST"/ $ALIASES >$tmp_alias + cat $tmp_alias >$ALIASES + rm $tmp_alias + fi + mkaliases >/dev/null +} + +# Args: Areas_pathname, newsgroup, area_ftn, description [, expire_days] +# Returns: 1 - innd not running +# 2 - already existing newsgroup +# 3 - already existing ftn_area +create_newsgroup() { + + AREAS="$1" + NEWSGROUP="$2" + AREA="$3" + DESCRIPTION="$4" + EXPIRE_DAYS="$5" + + NEWSGROUPS=~news/newsgroups + EXPIRECTL=~news/expire.ctl + + dialog --backtitle "$TITLE" --infobox "Creo il newsgroup $NEWSGROUP per contenere i messaggi dell'area $AREA..." 0 0 + + if [ ! "`ps ax | grep ~news/etc/innd`" ] + then + return 1 + fi + + if [ "`cut $NEWSGROUPS -f1 | cut -f1 -d\ | grep -x $NEWSGROUP`" ] + then + return 2 + fi + + if [ "`cut $AREAS -f1 | cut -f1 -d\ | grep -x $AREA`" ] + then + return 3 + fi + + su -l news -c "bin/ctlinnd newgroup $NEWSGROUP" >/dev/null + echo -e "$NEWSGROUP\t$DESCRIPTION" >> $NEWSGROUPS + echo -e "$AREA\t$NEWSGROUP\t`echo $NEWSGROUP | cut -f1 -d.`" >> $AREAS + + if [ "$EXPIRE_DAYS" ]; then + echo "$NEWSGROUP:A:2:$EXPIRE_DAYS:$EXPIRE_DAYS" >> $EXPIRECTL + fi + + chown news.news $NEWSGROUPS $EXPIRECTL + chmod 440 $EXPIRECTL + chown fnet.uucp $AREAS +} + +# Returns: 0 if ok, 1 if (innd not running), 2 if (no that newsgroup) +# Args: Areas_pathname, newsgroup +rmgroup() { + + AREAS=$1 + NEWSGR=$2 + NEWSGROUPS=~news/newsgroups + EXPIRE=~news/expire.ctl + + dialog --backtitle "$TITLE" --infobox "Elimino il newsgroup $NEWSGR ed i messaggi in esso contenuti, attendere prego. Questa operazione potrebbe durare alcuni minuti." 0 0 + + if [ ! "`ps x | grep ~news/etc/innd`" ] + then + return 1 + fi + + if [ ! "`cut -f1 $NEWSGROUPS | cut -f1 -d\ | grep -x $NEWSGR`" ] + then + return 2 + else + +# Updating newsgroups file + if [ -f $NEWSGROUPS ] + then + mkstemp groups + mv $NEWSGROUPS $NEWSGROUPS~ + grep -v $NEWSGR $NEWSGROUPS~ >$tmp_groups + mv $tmp_groups $NEWSGROUPS + else + :> $NEWSGROUPS + fi + chown news.news $NEWSGROUPS + +# Updating Areas file + if [ -f $AREAS ] + then + mkstemp areas + mv $AREAS $AREAS~ + grep -v $NEWSGR $AREAS~ >$tmp_areas + mv $tmp_areas $AREAS + else + :> $AREAS + fi + chown fnet.uucp $AREAS + +# Updating expire.ctl file + if [ -f $EXPIRE ] + then + mkstemp expire + mv $EXPIRE $EXPIRE~ + grep -v "$NEWSGR:" $EXPIRE~ >$tmp_expire + mv $tmp_expire $EXPIRE + else + :> $EXPIRE + fi + chown news.news $EXPIRE + chmod 444 $EXPIRE +# Remove pending articles + echo -e "\n$NEWSGR:A:0:0:0" >>$EXPIRE + su -l news -c "bin/news.daily" >/dev/null + mkstemp expire + grep -v $NEWSGR $EXPIRE >$tmp_expire + mv $tmp_expire $EXPIRE + chown news.news $EXPIRE + chmod 444 $EXPIRE + +# Updating active file + su -l news -c "bin/ctlinnd rmgroup $NEWSGR" >/dev/null + fi +} + +# Args: newsgroups_wildmat, days_to_keep +set_expire_time() { + + NEWSGROUP="$1" + KEEPDAYS="$2" + EXPIRE=~news/expire.ctl + + dialog --backtitle "$TITLE" --infobox "Imposto a $KEEPDAYS il numero di giorni di mantenimento dei messaggi del newsgroup $NEWSGROUP..." 0 0 + + if [ ! -f $EXPIRE ] + then + :> $EXPIRE + + elif [ "`cut $EXPIRE -s -f1 -d: | grep -x $NEWSGROUP`" ] + then + mkstemp expire + grep -v "$NEWSGROUP:" $EXPIRE >$tmp_expire + mv $tmp_expire $EXPIRE + fi + echo -e "\n$NEWSGROUP:A:2:$KEEPDAYS:$KEEPDAYS" >>$EXPIRE + chown news.news $EXPIRE + chmod 444 $EXPIRE +} diff --git a/contrib/dialog/samples/copifuncs/common.funcs b/contrib/dialog/samples/copifuncs/common.funcs new file mode 100755 index 0000000..04eca9a --- /dev/null +++ b/contrib/dialog/samples/copifuncs/common.funcs @@ -0,0 +1,338 @@ +# +# ComeOn Point Functions! v0.9.2 +# - usate da vari altri moduli ComeOn Point... +# +# AUTHOR: Beppe (beppe.dem@nsm.it) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +save() { + if [ -f $1 ] + then + mv $1 $1~ + fi +} + +# Returns $PKG_TO_REMOVE +find_incompatible_packages() { + dialog --backtitle "$TITLE" --infobox "Vediamo innanzitutto se c'e' qualche pacchetto di troppo ... ;-)" 0 0 + + PKG_TO_REMOVE="" + for i in sendmail smailcfg cnews + do + if [ -f /var/adm/packages/$i ] + then + PKG_TO_REMOVE="$PKG_TO_REMOVE $i" + fi + done +} + +# Returns $PKG_TO_INSTALL +find_necessary_packages() { + dialog --backtitle "$TITLE" --infobox "Controlliamo se manca qualche pacchetto..." 0 0 + + PKG_TO_INSTALL="" + for i in tcpip mailx inn + do + if [ ! -f /var/adm/packages/$i ] + then + PKG_TO_INSTALL="$PKG_TO_INSTALL $i" + fi + done +} + +# Args: user, editor +configure_trn() { + dialog --backtitle "$TITLE" --infobox "Configuro trn all'user $1..." 0 0 + + SHELL_USED="`basename \`cut /etc/passwd -f1,7 -d: | grep $1: | cut -f2 -d:\``" + USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $1: | cut -f2 -d:`" + TRNRC="$USER_HOME/.trnrc" + + case $SHELL_USED in + bash) + if [ -f $USER_HOME/.bash_profile ] + then + PROF=$USER_HOME/.bash_profile + else + PROF=$USER_HOME/.profile + fi;; + zsh) + PROF=$USER_HOME/.zprofile;; + *) + PROF=$USER_HOME/.profile;; + esac + + if [ ! -f $PROF ] + then + :>$PROF + chown $1.mail $PROF + elif [ ! "`grep -x \". ~/.trnrc\" $PROF`" ] + then + echo -e "\n. ~/.trnrc" >>$PROF + fi + + save $TRNRC + + echo "EDITOR=\"$2\"" > $TRNRC + cat copi.trnrc >> $TRNRC + chown $1.mail $TRNRC +} + +# Args: user, editor +configure_elm() { + USER=$1 + EDIT=$2 + + dialog --backtitle "$TITLE" --infobox "Configuro elm all'user $USER..." 0 0 + + USER_HOME="`cut /etc/passwd -f1,6 -d: | grep $USER: | cut -f2 -d:`" + DIRRC="$USER_HOME/.elm" + ELMRC="$DIRRC/elmrc" + + mkdir -p $DIRRC -m 700 + chown $USER.mail $USERHOME $DIRRC + + save $ELMRC + + cat <<EOF >$ELMRC +# +# .elm/elmrc - options file for the ELM mail system +# +# Generated by $PKTNAME for $USER +# + +# For yes/no settings with ?, ON means yes, OFF means no + +# how to sort the alias list, "Name" by default +### aliassortby = Name + +# name of editor to use for replies that have text +alteditor = $EDIT + +# alternative addresses that I could receive mail from (usually a +# forwarding mailbox) and don't want to have listed... +### alternatives = + +# should the default be to delete messages we've marked for deletion? +alwaysdelete = ON + +# should the default be to keep unread messages in the incoming mailbox? +alwayskeep = ON + +# should the default be to store read messages to the "received" folder? +alwaysstore = OFF + +# should we use the "->" rather than the inverse video bar? +arrow = OFF + +# should the message disposition questions be displayed(ON) or +# auto-answered(OFF) with the default answers when we resync or +# change folders? +ask = OFF + +# would you like to be asked for Carbon-Copies information each msg? +askcc = OFF + +# attribution string for replies ('%s' is the author of original message) +attribution = %s wrote: + +# automatically copy message being replied to into buffer? +autocopy = ON + +# threshold for bouncing copies of remote uucp messages... +# zero = disable function. +### bounceback = 0 + +# This is used to determine if the builtin pager should be used on some +# messages even if you would usually use an external pager program. +# There are two ways of determining whether the builtin pager should be +# used. If you want any message that is shorter than "n" lines to use the +# internal pager, set the parameter to "n". If you want the builtin +# pager to be used if the message is "m" lines shorter than the number of +# lines on your screen set the parameter to be "-m". Setting the +# parameter to zero will result in the message always being sent through +# your external pager. +### builtinlines = -3 + +# where to save calendar entries +#calendar = /root/calendar + +# list of options that can be configured at the "o)ptions" screen +configoptions = ^_cdefsopyv_am_un + +# Should elm always ask the user to confirm before it appends +# messages to any existing file? +# This is used for both folders in the user's mail directory +# and ordinary files. +confirmappend = OFF + +# Should elm always ask the user to confirm before it creates +# any new files? +# This is used for both folders in the user's mail directory +# and ordinary files. +confirmcreate = OFF + +# Should elm ask for confirmation before it appends a message +# to an existing file that is not a folder in the user's Mail +# directory? +# This is used for ordinary files only and does not affect +# folders in the user's mail directory. +confirmfiles = OFF + +# Should elm ask for confirmation before it creates a new folder +# in the user's Mail directory? +# This is used only for folders in the user's mail directory and +# does not affect ordinary files. +confirmfolders = OFF + +# save a copy of all outbound messages? +copy = ON + +# name of editor for ~e command (when editor="builtin") +easyeditor = $EDIT + +# what editor to use ("none" means simulate Berkeley Mail) +editor = $EDIT + +# the character to use in the builtin editor for entering commands +### escape = ~ + +# save outbound messages by login name of sender/recipient even if the +# associated folder doesn't already exist? +### forcename = OFF + +# do we want to be able to mail out AT&T Mail Forms? +### forms = OFF + +# The full user name for outbound mail +### fullname = $PKTNAME User + +# should we keep folders from which all messages are deleted? +### keepempty = OFF + +# are we running on an HP terminal and want HOME, PREV, NEXT, etc...? +### keypad = OFF + +# local ".signature" file to append to appropriate messages... +localsignature = ~/.signature + +# where to save my mail to, default directory is "Mail" +maildir = ~/Mail + +# should we display the three-line 'mini' menu? +menu = ON + +# would you like a copy of a message you send to an alias you are on? +### metoo = OFF + +# when using the page commands (+ - <NEXT> <PREV>) change the current +# message pointer...? +### movepage = OFF + +# just show the names when expanding aliases? +names = OFF + +# when messages are copied into the outbound buffer, don't include headers? +noheader = ON + +# program to use for displaying messages ('builtin' is recommended) +### pager = builtin+ + +# start up by pointing to the first new message received, if possible? +### pointnew = ON + +# list of delivery precedences allowed, or empty to allow anything +# precedence may be followed by optional ":priority" specification +### precedences = + +# prefix sequence for indenting included message text in outgoing messages... +prefix = _:>_ + +# how to print a message ('%s' is the filename) +### print = /bin/cat %s | /usr/bin/lpr + +# prompt for a command after the external pager exits? +### promptafter = ON + +# Value by which message count is incremented while reading a new mailbox. +# Setting this value to a number larger than one will speed up the time it +# takes to read a large mailbox when using a slow terminal. +### readmsginc = 1 + +# where to save received messages to, default file is "=received" +receivedmail = =received + +# remote ".signature" file to append to appropriate messages... +remotesignature = ~/.signature + +# emulate the mailx message increment mode (only increment after +# something has been 'done' to a message, either saved or deleted, +# as opposed to simply each time something is touched)? +### resolve = ON + +# save messages, incoming and outbound, by login name of sender/recipient? +savename = ON + +# where to save copies of outgoing mail to, default file is "=sent" +sentmail = =sent + +# The shell to use for shell escapes +shell = /bin/sh + +# do we want dashes above signatures? (News 2.11 compatibility and convention) +### sigdashes = ON + +# time in seconds which Elm will wait after displaying a transient message +# and before erasing it. Can be 0 or positive integer. +### sleepmsg = 2 + +# are we running on an HP terminal and want softkeys available too? +# (this implies "keypad=ON" too) +### softkeys = OFF + +# how to sort folders, "Reverse Sent" by default +### sortby = Reverse-Sent + +# Set the main prompt timeout for resynching... +### timeout = 600 + +# display message title when displaying pages of message? +titles = ON + +# where to place temporary files, default directory is "/tmp" +### tmpdir = /tmp/ + +# are we good at it? 0=beginner, 1=intermediate, 2+ = expert! +userlevel = 0 + +# would you like to use termcap/terminfo ti/te entries? +usetite = ON + +# name of editor for ~v command (when editor="builtin") +visualeditor = $EDIT + +# enable the weedout list to be read? +### weed = ON + +# what headers I DON'T want to see, ever. +weedout = "*end-of-user-headers*" + +EOF + + chmod 600 $ELMRC + chown $USER.mail $ELMRC +} diff --git a/contrib/dialog/samples/copifuncs/copi.funcs b/contrib/dialog/samples/copifuncs/copi.funcs new file mode 100755 index 0000000..7be4bdb --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.funcs @@ -0,0 +1,1303 @@ +#!/bin/bash +# $Id: copi.funcs,v 1.3 2001/01/15 22:24:26 tom Exp $ +# ComeOn Point Functions! v0.9.2 +# - usate da vari altri moduli ComeOn Point... +# +# AUTHOR: Beppe (beppe.dem@nsm.it) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +HOST=`hostname` +DOMAIN=`hostname -d` +PKTNAME="ComeOn Point Installer!" +COMEONDIR=/usr/lib/ComeOn + +AKASETUP=$COMEONDIR/point/.akasetup +COPIUSER=$COMEONDIR/point/.copi.user +EMSIFILE=$COMEONDIR/point/.emsi +PNTSETUP=$COMEONDIR/point/.pntsetup + +mkstemp() { + eval 'tmp_'$1'=`tempfile 2>/dev/null` || tmp_'$1'=/tmp/'$1'$$' +} + +# Args: [start_uid] +# Returns: $FOUND_UID +find_unused_uid() { + + if [ $1 ]; then + FOUND_UID=$1 + else + FOUND_UID=501 + fi + + while [ "`cut -f3 -d: /etc/passwd | grep -x $FOUND_UID`" ] + do + FOUND_UID=$[$FOUND_UID+1] + done +} + +int2fido() { + _RETVAL="`echo $1 | cut -f3 -d. | cut -c2-`:\ +`echo $1 | cut -f2 -d. | cut -c2-`/\ +`echo $1 | cut -f1 -d. | cut -c2-`" +} +int2fidonet() { + _RETVAL="`echo $1 | cut -f3 -d. | cut -c2-`:\ +`echo $1 | cut -f2 -d. | cut -c2-`/\ +`echo $1 | cut -f1 -d. | cut -c2-`@\ +`echo $1 | cut -f4- -d.`" +} +fido2int() { + _RETVAL="f\ +`echo $1 | cut -f2 -d '/'`.n\ +`echo $1 | cut -f1 -d '/' | cut -f2 -d:`.z\ +`echo $1 | cut -f1 -d '/' | cut -f1 -d:`" +} +fidonet2int() { + _RETVAL="f\ +`echo $1 | cut -f2 -d/ | cut -f1 -d@`.n\ +`echo $1 | cut -f1 -d/ | cut -f2 -d:`.z\ +`echo $1 | cut -f1 -d/ | cut -f1 -d:`.\ +`echo $1 | cut -f2 -d@`" +} +fidonetpoint2int() { + _RETVAL="p\ +`echo $1 | cut -f2 -d. | cut -f1 -d@`.f\ +`echo $1 | cut -f2 -d/ | cut -f1 -d.`.n\ +`echo $1 | cut -f2 -d: | cut -f1 -d/`.z\ +`echo $1 | cut -f1 -d/ | cut -f1 -d:`.\ +`echo $1 | cut -f2 -d@`.org" +} + +# Parameters: fqdn +configure_loopback() { + dialog --backtitle "$TITLE" --infobox "Configuro la rete (in modo loopback)..." 0 0 + + FQDN=$1 + HOST=`echo $FQDN | cut -f1 -d.` + DOMAIN=`echo $FQDN | cut -f2- -d.` + + save /etc/hostname + echo $FQDN >/etc/HOSTNAME + export HOSTNAME=$FQDN + hostname $HOST + + save /etc/rc.d/rc.inet1 + cat <<EOF >/etc/rc.d/rc.inet1 +#! /bin/sh +# +# rc.inet1 This shell script boots up the base INET system. + +# Attach the loopback device. +/sbin/ifconfig lo 127.0.0.1 +/sbin/route add -net 127.0.0.0 + +# End of rc.inet1 +EOF + chmod 755 /etc/rc.d/rc.inet1 + + + save /etc/networks + cat <<EOF >/etc/networks +# +# networks This file describes a number of netname-to-address +# mappings for the TCP/IP subsystem. It is mostly +# used at boot time, when no name servers are running. +# + +loopback 127.0.0.0 + +# End of networks. +EOF + chmod 644 /etc/networks + + + save /etc/hosts + cat <<EOF >/etc/hosts +# +# hosts This file describes a number of hostname-to-address +# mappings for the TCP/IP subsystem. It is mostly +# used at boot time, when no name servers are running. +# On small systems, this file can be used instead of a +# "named" name server. Just add the names, addresses +# and any aliases to this file... +# +# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1 +# should NEVER be named with the name of the machine. It causes problems +# for some (stupid) programs, irc and reputedly talk. :^) +# +# But we (ComeOn Linux!) says that this is not valid for you, because +# you resulted to have not a network at the installation time. + +# For loopbacking. +127.0.0.1 localhost $FQDN $HOST + +# End of hosts. +EOF + chmod 644 /etc/hosts + + save /etc/resolv.conf + echo domain $DOMAIN >/etc/resolv.conf + chmod 644 /etc/resolv.conf + + save /etc/host.conf + cat <<EOF >/etc/host.conf +order hosts,bind +multi on +EOF + chmod 644 /etc/host.conf + + /etc/rc.d/rc.inet1 +} + +# Private function, adds an user to a group. Args: user, group +add_to_group() { + + if [ ! "`groups \"$1\" | grep \" $2 \"`" ] + then + USERS="`grep \"$2:\" /etc/group | cut -s -f4 -d:`" + + mkstemp group + if [ "$USERS" ]; then + sed "/$2:/s/:$USERS/:$USERS,$1/" /etc/group >$tmp_group + else + sed "/$2:/s/:/:$1/3" /etc/group >$tmp_group + fi + + save /etc/group + mv $tmp_group /etc/group + fi +} + +# Arguments: user, fullname +add_postmaster() { + dialog --backtitle "$TITLE" --infobox "Creo l'user principale e/o ne adatto le informazioni..." 0 0 + + USER="$1" + NAME="$2" + HOMEDIR="/home/$USER" + +# echo "$USER" >$COPIUSER # you've to do this in any other location + ENTRY="`cut /etc/passwd -s -f1,2,5 -d: | grep $USER:`" + if [ "$ENTRY" ] + then + OLDNAME="`echo $ENTRY | cut -f3 -d:`" + PASW="`echo $ENTRY | cut -f2 -d:`" + if [ "$OLDNAME" != "$NAME" ] + then + mkstemp passwd + sed "/$USER:$PASW:/s/:$OLDNAME:/:$NAME:/" /etc/passwd >$tmp_passwd + save /etc/passwd + mv $tmp_passwd /etc/passwd + fi + + add_to_group "$USER" mail + else + if [ -f /bin/bash ]; then USERSHELL=/bin/bash; else USERSHELL=""; fi + find_unused_uid + echo "$USER:*:$FOUND_UID:12:$NAME:$HOMEDIR:$USERSHELL" >>/etc/passwd + mkdir -p $HOMEDIR -m 755 + chown $USER.mail $HOMEDIR + fi +} + +comment_nntp_in_inetdconf() { + dialog --backtitle "$TITLE" --infobox "Commento la riga 'nntp' in /etc/inetd.conf..." 0 0 + + mkstemp inetd + sed "/in.nntpd/s/nntp/#&/" /etc/inetd.conf >$tmp_inetd + save /etc/inetd.conf + mv $tmp_inetd /etc/inetd.conf + killall -1 inetd +} + +# Args: organization +set_organization() { + dialog --backtitle "$TITLE" --infobox "Imposto l' origin..." 0 0 + + ORGANIZATION=/etc/organization + save $ORGANIZATION + + NEW_ORGANIZATION="$1" + echo "$NEW_ORGANIZATION" >$ORGANIZATION +} + +create_innconf_newsfeeds_distrib() { + dialog --backtitle "$TITLE" --infobox "Creo i files di configurazione principali di InterNet News (inn)..." 0 0 + +# File: inn.conf + INNCONF=~news/inn.conf + save $INNCONF + + cat <<EOF >$INNCONF +## $Revision: 1.3 $ +## inn.conf -- inn configuration data +## Format: +## <parameter>:<whitespace><value> +## Used by various programs and libinn. The following parameters are defined: +## domain Local domain, without leading period. +## fromhost What to put in the From line; default is FQDN +## of the local host. +## moderatormailer Where to mail moderated postings, if not found +## in the moderators file; see moderators(5). +## pathhost What to put in the Path and Xref headers; default +## is FQDN of the local host. +## organization If $ORGANIZATION doesn't exist. What to put in +## the Organization header if blank. +## server If $NNTPSERVER doesn't exist. Local NNTP server +## host to connect to. +## + +server: $HOST.$DOMAIN +domain: $DOMAIN +pathhost: $HOST +EOF + + chmod 444 $INNCONF + chown news.news $INNCONF + + +# File: newsfeeds + NEWSFEEDS=~news/newsfeeds + save $NEWSFEEDS + + echo -e "ME:*::\n" >$NEWSFEEDS + + IAKA=1 + OK=1 + while [ "$OK" != 0 ] + do + AKA="`cut $AKASETUP -f$IAKA -d:`" + if [ ! "$AKA" ] + then + OK=0 + else + if [ $IAKA != 1 ] + then + TMPAKA="`echo $AKA | cut -f-4 -d.`" + SENDCRON="$SENDCRON $TMPAKA" + echo -n "$TMPAKA/" >>$NEWSFEEDS + fi + TMPAKA="`echo $AKA | cut -f1-2 -d.`" + if [ $IAKA = 1 ]; then + SENDCRON="$SENDCRON $TMPAKA" + fi + echo -e "$TMPAKA\\" >>$NEWSFEEDS + echo -e "\t:!*,`echo $AKA | cut -f4 -d.`.*\\" >>$NEWSFEEDS + echo -e "\t:Tf,Wfb,B4096/1024:\n" >>$NEWSFEEDS + fi + IAKA=$[$IAKA+1] + done + + chmod 444 $NEWSFEEDS + chown news.news $NEWSFEEDS + + +# File: distrib.pats + DISTRIB=~news/distrib.pats + save $DISTRIB + + IAKA=1 + OK=1 + while [ "$OK" != 0 ]; do + AKA="`cut $AKASETUP -f$IAKA -d:`" + IAKA=$[$IAKA+1] + if [ "$AKA" = "" ]; then + OK=0 + else + DOM="`echo $AKA | cut -f4 -d.`" + echo "10:$DOM.*:$DOM" >>$DISTRIB + fi + done + + chmod 444 $DISTRIB + chown news.news $DISTRIB +} + +# Args: num_of_days +create_expirectl() { + dialog --backtitle "$TITLE" --infobox "Imposto il periodo di transito dei messaggi..." 0 0 + + EXPIRECTL=~news/expire.ctl + save $EXPIRECTL + + EXPIRE_DAYS=$1 + + echo -e "/remember/:14\n\n*:A:2:$EXPIRE_DAYS:$EXPIRE_DAYS" >$EXPIRECTL + + chmod 440 $EXPIRECTL + chown news.news $EXPIRECTL +} + +create_nnrpaccess() { + dialog --backtitle "$TITLE" --infobox "Rendo accessibili le news in lettura..." 0 0 + + NNRPACCESS=~news/nnrp.access + save $NNRPACCESS + + cat <<EOF >$NNRPACCESS +## $Revision: 1.3 $ +## nnrp.access - access file for on-campus NNTP sites +## Format: +## <host>:<perm>:<user>:<pass>:<groups> +## Connecting host must be found in this file; the last match found is +## used, so put defaults first. +## <host> Wildcard name or IP address +## <perm> R to read; P to post +## <user> Username for authentication before posting +## <pass> Password, for same reason +## <groups> Newsgroup patterns that can be read or not read +## To disable posting put a space in the <user> and <pass> fields, since +## there is no way for client to enter one. +## +## Default is no access, no way to authentication, and no groups. +# *:: -no- : -no- :!* +## Foo, Incorporated, hosts have no password, can read anything. +# *.foo.com:Read Post:::* + +*:: -no- : -no- :!* +localhost.$DOMAIN:Read Post:::* +$HOST.$DOMAIN:Read Post:::* + +EOF + + chmod 440 $NNRPACCESS + chown news.news $NNRPACCESS +} + +create_hostsnntp() { + dialog --backtitle "$TITLE" --infobox "Rendo accessibili le news in scrittura..." 0 0 + + HOSTSNNTP=~news/hosts.nntp + save $HOSTSNNTP + + cat <<EOF >$HOSTSNNTP +## $Revision: 1.3 $ +## hosts.nntp - names and addresses that feed us news +## Format +## <host>: +## <host>:<password> +## <host> can be a name or IP address; no wildcards. Any hosts not +## listed here are handed off to nnrpd. + +$HOST.$DOMAIN: + +EOF + + chmod 440 $HOSTSNNTP + chown news.news $HOSTSNNTP +} + +create_dirs_and_files() { + + CURMASK=`umask` + . ./copi.wheel + pushd /var/log >/dev/null + mkdir -p news -m 755; chown news.news news + cd /var/log/news; mkdir -p OLD -m 755; chown news.news OLD + cd /var/spool; mkdir -p news -m 775; chown news.news news + cd /var/spool/news; umask 02 + mkdir -p out.going control junk in.coming + chown news.news out.going control junk in.coming + cd in.coming; mkdir -p bad tmp; chown news.news bad tmp; umask $CURMASK + ln -sf ~news /usr/local/lib/ + ln -sf ~news/inews /usr/bin/ + chmod 1777 /var/tmp + + cd /var/spool + mkdir -p uucppublic + chown uucp.uucp uucppublic + chmod 1777 uucppublic + + cd ~news + touch history history.dir history.pag errlog log + chown news.news history* log errlog + chmod 664 history* log errlog + + save active + echo "control 0000000000 0000000001 y" > active + echo "junk 0000000000 0000000001 y" >> active + chown news.news active + + save active.times + echo "control 814573260 usenet" > active.times + echo "junk 814573260 usenet" >> active.times + chown news.news active.times + + save newsgroups + :>newsgroups + chown news.news newsgroups + + popd >/dev/null +} + +install_rcnews() { + dialog --backtitle "$TITLE" --infobox "Avvio l'InterNet News daemon (innd) e l'installo negli script di boot, attendere... attenzione che e' probabile che in questa fase non sia possibile entrare da un'altra VC come root." 0 0 + + RCLOCAL=/etc/rc.d/rc.local + RCNEWS=~news/etc/rc.news + RCLINE="`grep $RCNEWS $RCLOCAL`" + + if [ ! "$RCLINE" -o `echo $RCLINE | cut -c1` = '#' ] + then + save $RCLOCAL + echo -e "\n$RCNEWS" >>$RCLOCAL + fi + + cp copi.rcnews $RCNEWS + chmod 550 $RCNEWS + chown news.news $RCNEWS + + if [ -f ~news/innd/innd.pid ]; then + su -l news -c "bin/ctlinnd shutdown x" >/dev/null + sleep 2 # wait for server to shutdown + fi + + killall innd 2>/dev/null # make sure it's gone down + $RCNEWS +} + +install_crontab_news() { + dialog --backtitle "$TITLE" --infobox "Imposto la crontab di news per l'automantenimento del sistema (cancellazione giornaliera dei messaggi vecchi et similia)..." 0 0 + + + if [ -f $COPIUSER ]; then + POSTMST="`cat $COPIUSER`" + else + POSTMST="root" + fi + + NEWSHOME=~news + save /var/spool/cron/crontabs/news + cat <<EOF | crontab - -u news +#------------------------------------------------------------------------------- +# /var/spool/cron/crontabs/news +SHELL=/bin/sh +# +MAILTO=$POSTMST +# +#=============================================================================== +# +# inn-1.4 (Inter Net News) +# +#=============================================================================== +# +#------------------------------------------------------------------------------- +# Daily housekeeping ... expires news and other things ... +#------------------------------------------------------------------------------- +# +51 16 * * * $NEWSHOME/bin/news.daily < /dev/null +# +#------------------------------------------------------------------------------- +# offer spooled news - that was spooled into the incoming directory when the +# innd server wasn't available - again to the innd server. +#------------------------------------------------------------------------------- +# +18 * * * * $NEWSHOME/rnews -U +# +#------------------------------------------------------------------------------- +# send news batches to your fidonet(-like) news feeds +#------------------------------------------------------------------------------- +# +49 16 * * * $NEWSHOME/send-ifmail$SENDCRON +# +#------------------------------------------------------------------------------- +# +EOF + + echo $NEWSHOME/send-ifmail$SENDCRON >/etc/point.ifsend +} + +# Private func +# Args: dir_with_sources, bindir, cfgdir, logdir, version +copi.ifmCfg() { + + SRCDIR="$1" + BINDIR="$2" + CFGDIR="$3" + LOGDIR="$4" + VERSION="$5" + SOURCE="$SRCDIR/CONFIG" + CONFIGFILE="$CFGDIR/config" + + cat <<EOF >$SOURCE +# Compile-time configuration for ifmail FidoNet mailer and gateway +COPYRIGHT = "Eugene G. Crosser, 1993-1995" +VERSION = "$VERSION" + +# Main configuration file. This default may be overwritten by -I key. +CONFIGFILE = $CONFIGFILE + +# Debug messages turned on by -x key are written here. +# Some error messages may occationally appear here too. +# This may be changed in the 'config' file. +DEBUGFILE = "$LOGDIR/ifdebug" + +# Procession log. Usually gets several lines for each invocation. +# Also look for error diagnostics here. If HAS_SYSLOG defined, +# only stdout and stderr from the packers and unpackers go to this +# file, while actual logging is done via syslog() calls. +# This may be changed in the 'config' file. +LOGFILE = "$LOGDIR/iflog" + +# Use syslog() facility codes for mail gate, news gate and ifcico. +# Define -DHAS_SYSLOG (see below) +#MAILLOG = LOG_MAIL +MAILLOG = LOG_LOCAL0 +#NEWSLOG = LOG_NEWS +NEWSLOG = LOG_LOCAL0 +#CICOLOG = LOG_UUCP +CICOLOG = LOG_LOCAL0 + +# Directory where UUCP lock files reside. +#LOCKDIR = "/var/lock" +LOCKDIR = "/var/spool/uucp" + +# Directory from which file requests are resolved. +# This may be changed from the 'config' file. +#PUBDIR = "/home/ftp/pub" +PUBDIR = "/var/spool/uucppublic" + +# Compile-time system-dependant options. + +# If you specify "-DHAS_NDBM_H", ndbm calls will be used instead +# of dbm ones, and the feature will be activated of Cnews log processing +# to add entries to SEEN-BY if echo message is exported to several FTN +# nodes by Cnews mechanism. This works with INN too. + +# If you specify "-DHAS_STATFS" or "-DHAS_STATVFS", statfs() (or statvfs() +# respectivly) call will be used to check available disk space. For statfs() +# call, you must also specify which .h file to use: "-DSTATFS_IN_VFS_H" or +# "-DSTATFS_IN_STATFS_H" or "-DSTATFS_IN_STATVFS_H" or "-DSTATFS_IN_MOUNT_H". +# For statvfs() call, statvfs.h is included. + +# define -DSCO_STYLE_STATFS if your statfs() call requires 4 arguments. + +# If you specify "-DHAS_SETSID", setsid() call is used to detach from the +# control terminal. Otherwise setpgrp() call is used, and in this case you +# may specify "-DBSD_SETPGRP" to use BSD-style call. Used in ifcico only. + +# If you specify "-DDONT_HAVE_TM_GMTOFF", timezone offset will be calculated +# from the difference between the results of localtime() and gmtime() calls +# instead of using tm_gmtoff field of struct tm. + +# If you specify "-DDONT_HAVE_GETOPT", local definitions for getopt will +# be used (but not the function itself) + +# For ifcico, you must specify -DHAS_TERMIOS_H (preffered), -DHAS_TERMIO_H +# or -DHAS_SGTTY_H to use POSIX-y, SysV-ish of BSD-ish terminal control. + +# in SVR4 you should specify -DHAS_DIAL (and maybe -DHAS_DIAL_H) to use +# dial() library function instead of regular open(). Lock files are +# not used in this case. + +# for uucp lock files, you must specify either -DASCII_LOCKFILES or +# -DBINARY_LOCKFILES + +# define -DHAS_FSYNC if there is a fsync() system call (to update .flo +# files) + +# define -DPARANOID if you want iftoss to deny packets with wrong password. + +# define -DRELAXED if you want iftoss to accept packets that are not +# addressed to your node. + +# define -DFORCEINTL if you want ifmail to create ^aINTL even if this is +# not an inter-zone netmail. + +# define -DNEED_UUCPFROM if your MTA needs a uucp "From" line in mail. + +# define -DHAS_TCP if you want ifmail to be able to originate outgoing +# connections over TCP/IP (socket library needed) + +# define -DHAS_TERM if you want ifmail to be able to originate outgoing +# connections over TERM (TCP "extention", client.a needed) + +# define -DHAS_REGEX_H or -DHAS_LIBGEN_H if you have either of these +# header files for regular expression handlers. + +# define -DHAS_SYSLOG to use syslog() instead of logging to files. +# Files are necessary anyway, external programs' stdout and stderr +# are redirected there. + +# define -DNEED_BSY if you want ifpack and ifcico to create .bsy +# files preventing simultaneous processing of the same node. + +# define -DNEED_FORK if your system is uncapable of getting rid of the +# control terminal unless you are running not as a group leader. + +# define -DREGEX_NEED_CARET if your re_comp/re_exec require that the +# mask starts with a '^' to match the beginning of the string. + +# as of June 1994, FreeBSD has a nasty bug in the kernel lseek() code: +# if you make lseek() to a point before the start of the file, it +# succeeds and the writing point becomes negative. Fortunately, +# subsequent write()s fail :-). To overwork this, define +# -DNEGATIVE_SEEK_BUG, this will add an extra fseek() to restore +# zero writing point where necessary. + +# define -DNEED_TRAP if you want debugging information when the programs +# are aborted with segmentation fault etc. Currently tested and works +# only with Linux, and only with newer kernels (1.1.20+) + +# define -DSLAVE_SENDS_NAK_TOO if you have problems answering incoming +# EMSI sessions originated by FrontDoor. FrontDoor does not follow +# EMSI specifications when originating calls, this is a workaround. + +# define -DDONT_HAVE_DIRENT if there is no working opendir()/readdir() +# etc. in your libc. You will aso need to add "dirent.o" to the NEEDED +# (see below). + +# Linux: +OPTS = -DHAS_STATFS -DSTATFS_IN_VFS_H -DHAS_SETSID -DHAS_NDBM_H \\ + -DDONT_HAVE_TM_GMTOFF -DHAS_TERMIOS_H -DASCII_LOCKFILES \\ + -DHAS_FSYNC -DHAS_IOCTL_H -DHAS_REGEX_H -DHAS_TCP \\ + -DFORCEINTL -DHAS_SYSLOG -DNEED_UUCPFROM -DNEED_BSY \\ + -DREGEX_NEED_CARET -DNEED_TRAP -DSLAVE_SENDS_NAK_TOO \\ + -DNEED_FORK -DLESS_RFC_KLUDGES + +# 386BSD: +#OPTS = -DHAS_STATFS -DSTATFS_IN_MOUNT_H -DHAS_SETSID -DHAS_NDBM_H \\ + -DHAS_TERMIOS_H -DASCII_LOCKFILES -DHAS_FSYNC -DHAS_IOCTL_H \\ + -DHAS_REGEX_H -DHAS_TCP -DHAS_SYSLOG -DNEED_UUCPFROM \\ + -DNEED_BSY -DNEED_FORK -DNEGATIVE_SEEK_BUG \\ + -DREGEX_NEED_CARET + +# SVR4: +#OPTS = -DHAS_STATVFS -DDONT_HAVE_TM_GMTOFF -DHAS_SETSID -DHAS_NDBM_H \\ + -DHAS_TERMIOS_H -DHAS_DIAL -DHAS_DIAL_H -DASCII_LOCKFILES \\ + -DHAS_FSYNC -DHAS_IOCTL_H -DHAS_LIBGEN_H -DHAS_TCP \\ + -DHAS_SYSLOG -DREGEX_NEED_CARET +# SunOS: +#OPTS = -DHAS_STATFS -DSTATFS_IN_VFS_H -DHAS_SETSID -DHAS_NDBM_H \\ + -DDONT_HAVE_GETOPT -DHAS_TERMIOS_H -DASCII_LOCKFILES \\ + -DHAS_FSYNC -DHAS_TCP -DHAS_SYSLOG \\ + -DREGEX_NEED_CARET + +# SCO Unix 3.2v4.2 +#OPTS = -DHAS_STATFS -DSTATFS_IN_STATFS_H -DSCO_STYLE_STATFS \\ + -DHAS_TERMIOS_H -DDONT_HAVE_TM_GMTOFF -DDO_NEED_TIME \\ + -DDONT_HAVE_GETOPT -DASCII_LOCKFILES -DHAS_IOCTL_H \\ + -DHAS_TCP -DHAS_SYSLOG \\ + -DREGEX_NEED_CARET + +# ISC Unix 3.2 v3.0 +#OPTS = -DHAS_STATFS -DSTATFS_IN_STATFS_H -DHAS_TERMIO_H \\ + -DDONT_HAVE_TM_GMTOFF -DDONT_HAVE_GETOPT \\ + -DASCII_LOCKFILES -DHAS_IOCTL_H -DSCO_STYLE_STATFS \\ + -DUSE_POLL -DHAS_NET_ERRNO_H -DSHORT_PID_T \\ + -DHAS_TCP -DHAS_SYSLOG \\ + -DREGEX_NEED_CARET +# On ISC, if you are suing gcc, you can run into a trouble with sscanf() +# function. It appears that sscanf(string,"%d.%d",&int1,&int2) where +# string is a constant segfaults unless you specify "-fwritable-strings" +# to gcc. I would say that this is a bug in ISC libc. If nessecary, +# add this to the defines above. If you have ISC version 4.0 or later, +# you can add "-posix", remove "-DSHORT_PID_T" and specify "-DHAS_TERMIOS" +# to get benefit of posix terminal control. + +# for make install, where to put binaries and what owner to set +BINDIR = $BINDIR +OWNER = fnet +GROUP = uucp +MODE = 0711 +SMODE = 4711 + +INSTALL = install +RANLIB = ranlib +#RANLIB = touch +SHELL = /bin/sh +ECHO = echo -e +CC = gcc +YACC = bison -y +#YACC = yacc +LEX = flex +#LEX = lex +AWK = awk +TAR = tar + +#CFLAGS = -g -Wall +# Linux, 386BSD, SunOS: +CFLAGS = -O2 -Wall -m486 -s +# SVR4: +#CFLAGS = -O -Xa + +LDFLAGS = -s + +# For LIBS, you may need to add "-lfl" if you are using flex 2.4.x +# If you need TERM also add e.g. "/usr/src/term112/client.a" + +# Linux +LIBS = -ldbm +# SunOS: +#LIBS = +# 386BSD: +#LIBS = -lgdbm -lgnuregex +# SVR4 +#LIBS = -ldbm -lform -lnsl -lsocket -lc -L/usr/ucblib -lucb +# SCO +#LIBS = -ldbm -lsocket -lintl +# ISC +#LIBS = -lcposix -lmalloc -ldbm -linet -lPW + +INCLUDES = -I\${INCDIR} +# ISC +#INCLUDES = -I/usr/include/rpcsvc -I\${INCDIR} + +# What programs are absent at your system? +#NEEDED = strcasestr.o strncasecmp.o strcasecmp.o rename.o mkdir.o usleep.o \\ + regexpr.o +# Linux +NEEDED = +# SVR4 +#NEEDED = regexpr.o +# SCO +#NEEDED = strcasestr.o strncasecmp.o strcasecmp.o usleep.o regexpr.o +# SunOS and 386BSD +#NEEDED = signal.o +# ISC +#NEEDED = usleep.o regexpr.o vsyslog.o +EOF + +} + +# Args: package.tgz, bin_dir, cfg_dir, log_dir, version, where_to_put_src +install_ifmail() { + dialog --backtitle "$TITLE" --infobox "Installo e compilo Ifmail..." 0 0 + + AKAPRI="`cut $AKASETUP -f1 -d:`" + int2fido $AKAPRI + AKAPRIFTN=$_RETVAL + + if [ -f $COPIUSER ] + then + POST="`cat $COPIUSER`" + else + POST=root + fi + + TGZ="$1" + BINDIR="$2" + CFGDIR="$3" + LOGDIR="$4" + VERSION="$5" + SRC="$6" + +################################################### +## passwd e group +#################################### + + if [ "`cut /etc/passwd -f1 -d: | grep -x fnet`" ] + then + mkstemp passwd + grep -v "fnet:" /etc/passwd >$tmp_passwd + save /etc/passwd + mv $tmp_passwd /etc/passwd + fi + + find_unused_uid 92 + echo "fnet:*:$FOUND_UID:14:Fidonet Gate:$BINDIR:" >>/etc/passwd + + +#################################################### +#### dirs and files +################################### + mkdir -p $CFGDIR $LOGDIR /var/spool/ifmail/{BAK,nl.d} $BINDIR/magic + chown fnet.uucp $BINDIR{,/magic} $CFGDIR $LOGDIR /var/spool/ifmail/{,BAK,nl.d} + touch $LOGDIR/{ifdebug,iflog,sysiflog,TheLog} + chown fnet.uucp $LOGDIR/{ifdebug,iflog,sysiflog,TheLog} + +########################################################################## +#### COMPILAZIONE +#################################### + + SRC="$SRC/`tar zxvf $TGZ -C $SRC | head -1`" +# ora in $SRC c'e' il path completo dei source Ifmail + + copi.ifmCfg $SRC $BINDIR $CFGDIR $LOGDIR $VERSION + patch -N -d $SRC <ifpatch 2>/dev/null + make clean -C $SRC + make -C $SRC +########################################################################## +#### INSTALLAZIONE +#################################### + make install -C $SRC +} + + +# Args: bin_dir, cfg_dir, log_dir, passwords +# note: passwords are colon-separated (":") +configure_ifmail() { + dialog --backtitle "$TITLE" --infobox "Configuro Ifmail..." 0 0 + + BINDIR=$1 + CFGDIR=$2 + LOGDIR=$3 + PASSWDS=$4 + + SPD="` cut $EMSIFILE -f1`" + SYSNAME="` cut $EMSIFILE -f2`" + LOCATION="` cut $EMSIFILE -f3`" + COMPLETE_PHONE="` cut $EMSIFILE -f4`" + INTERCOUNTRYPREF="`cut $EMSIFILE -f5`" + LONG_DIST_PREFIX="`cut $EMSIFILE -f6`" + NODEFLAGS="` cut $EMSIFILE -f7`" + DIALSTRING="` cut $EMSIFILE -f8`" + SYSOP="` cut $EMSIFILE -f9`" + + COUNTRYPREF="`echo $COMPLETE_PHONE | cut -f1 -d'-'`" + PREF="` echo $COMPLETE_PHONE | cut -f2 -d'-'`" + PHONE="` echo $COMPLETE_PHONE | cut -f3 -d'-'`" + + FNETCFG=$CFGDIR/config + AREAS=$CFGDIR/Areas + + POINTS="`cat $PNTSETUP`" + POST="`cat $COPIUSER`" + AKAPRI="`cut $AKASETUP -f1 -d:`" + int2fido "$AKAPRI" + AKAPRIFTN="$_RETVAL" + +#invece di "cp $SRC/misc/inn/send-ifmail ~news" +#----------------------------------------------------------------------------- + cp copi.sendifm1 ~news/send-ifmail + cat <<EOF >>~news/send-ifmail +-p"$BINDIR/ifnews %s" \\ +EOF + cat copi.sendifm2 >>~news/send-ifmail + + chmod 550 ~news/send-ifmail + chown news.news ~news/send-ifmail + +#invece di "cp $SRC/misc/contrib/ifreq $BINDIR" +#----------------------------------------------------------------------------- + cp copi.ifreq1 $BINDIR/ifreq + cat <<EOF >>$BINDIR/ifreq +# ifcico-config-file: +\$config = "$CFGDIR/config"; + +# change this to the default node, where requests should go to. +\$node = "$AKAPRIFTN"; +EOF + cat copi.ifreq2 >>$BINDIR/ifreq + + chmod 755 $BINDIR/ifreq + chown fnet.uucp $BINDIR/ifreq + +#invece di "cp $SRC/misc/contrib/ifman $BINDIR" +#----------------------------------------------------------------------------- + cp copi.ifman1 $BINDIR/ifman + cat <<EOF >>$BINDIR/ifman +\$cfgfile="$CFGDIR/config"; # where the config is +\$ifowner="fnet"; # who is the owner of the ifmail + +EOF + cat copi.ifman2 >>$BINDIR/ifman + + chmod 755 $BINDIR/ifman + chown fnet.uucp $BINDIR/ifman + +#invece di "cp $SRC/misc/contrib/ifpoll $BINDIR" +#----------------------------------------------------------------------------- + cp copi.ifpoll1 $BINDIR/ifpoll + cat <<EOF >>$BINDIR/ifpoll +FIDOPATH=$BINDIR +LOGPATH=$LOGDIR + +# sysop of fido stuff +IFCICO_SYSOP=$POST + +# my boss node (default address to poll) +NODE=$AKAPRI +EOF + cat copi.ifpoll2 >> $BINDIR/ifpoll + + chmod 755 $BINDIR/ifpoll + chown fnet.uucp $BINDIR/ifpoll + + +######################################################### +##### se in syslog.conf non c'e' "local0.*", lo aggiunge +################################ + + SYSLOG="`grep \"local0.* \" /etc/syslog.conf`" + SYSCHECK_A="`echo \"$SYSLOG\" | cut -f1 | grep -x \"local0.*\"`" + SYSCHECK_B="`echo \"$SYSLOG\" | cut -f2- | grep $LOGDIR/sysiflog`" + MYSYSLOG="local0.*\t\t\t\t\t$LOGDIR/sysiflog" + + if [ ! "$SYSCHECK_A" -o ! "$SYSCHECK_B" ] + then + echo -e "\n# For ifmail" >> /etc/syslog.conf + echo -e "$MYSYSLOG" >>/etc/syslog.conf + killall -1 syslogd + fi + + +######################## + save $AREAS + :> $AREAS + chown fnet.uucp $AREAS + + save $FNETCFG + cat <<EOF >$FNETCFG +# Configuration file for ifmail (ifgate+ifcico) package by Eugene Crosser +# Compile-time default name of this file may be overridden by -I key. +# +# Lines with the first nonblank character '#' are comments. +# +# Log file name. Overrides compile-time default. +logfile $LOGDIR/iflog + +# Debug file name. Overrides compile-time default. +debugfile $LOGDIR/ifdebug + +# Debugging verbosity level (is overidden by -x key). Default is 0. +# WARNING: if >0 your messages will go in /tmp/ifmail !!!!!!!!!!!!!!!!!! +verbose 0 + +# The first is the main address: +EOF +#---------------------------- + + AKA="any" + IAKA=0 + while [ "$AKA" ] + do + IAKA=$[$IAKA+1] + AKA="`cut $AKASETUP -f$IAKA -d:`" + if [ "$AKA" ] + then + int2fidonet $AKA + AKAFTN="`echo $_RETVAL | cut -f1 -d.`" + echo "# aka for `echo $AKAFTN | cut -f2 -d '@'`" >> $FNETCFG + + POINT="`echo $POINTS | cut -f$IAKA -d:`" + + AKAFTN="`echo $AKAFTN | cut -f1 -d '@'`.$POINT@`echo $AKAFTN | cut -f2 -d '@'`" + + echo "address $AKAFTN" >> $FNETCFG + fi + done + +#---------------------------- + cat <<EOF >>$FNETCFG + +# Passwords for nodes. Not checked by iftoss (unless -DPARANOID specified +# at compile-time), checked by ifcico. +# Inserted into outgoing mail packets, EMSI and yoohoo packets. +EOF +#---------------------------- + + AKA="any" + IAKA=0 + while [ "$AKA" ] + do + IAKA=$[$IAKA+1] + AKA="`cut $AKASETUP -f$IAKA -d:`" + if [ "$AKA" ] + then + int2fido $AKA + AKAFTN=$_RETVAL + + PASSWD="`echo $PASSWDS | cut -f$IAKA -d:`" + if [ "$PASSWD" ] + then + echo "password $AKAFTN $PASSWD" >> $FNETCFG + fi + fi + done + +#---------------------------- + cat <<EOF >>$FNETCFG + +# Include config extention file (here: file with real passwords). +# Includes may be nested. If the nesting is cyclic, the program cycles too. +# You are warned. +# include $CFGDIR/passwds + +# System alias file - try to fetch ftn-style aliases from there. +# If "from" address of a message from FidoNet matches _right_ side +# of some entry in sysalias file, then the Reply-To: header is created +# in the RFC message with the name part taken from the left side of the +# sysalis entry and domain part taken from myfqdn (below). E.g., if a +# fidonet message comes from "John Smith of 1:234/567.89@fidonet" and +# there is an entry in the sysalias file: +# "jsmith: John.Smith@p89.f567.n234.z1.fidonet.org" +# and fqdn value is "pccross.msk.su", then the resulting message will +# contain a line: "Reply-To: jsmith@pccross.msk.su". +sysalias /etc/aliases + +# This host fully qualified domain name to add to the alias above +myfqdn `hostname -f` + +# Directory for incoming packets/files: +inbound /var/spool/ifmail/inb +# Directories for "listed" and "protected" sessions +listinbound /var/spool/ifmail/inb +protinbound /var/spool/ifmail/inb + +# Directory for outgoing packets (default domain and zone): +# other zones will be like "/var/spool/ifmail/outb.003", +# other domains will be like "/var/spool/ifmail/<domain>.<zone>" +outbound /var/spool/ifmail/outb + +# Directory from which the file requests are satisfied +public /var/spool/uucppublic + +# Directory with executables to satisfy "magic" file requests +# if requested a file present in this directory, it will be +# executed and stdout sent to the remote system. It is dangerous! +# You are warned. +magic $BINDIR/magic + +# Primary nodelist (serves "outbound" directory and domain from the +# first "address" statement). Name expanded with ".NNN" if neccessary. +nodelist /var/spool/ifmail/nl.d/`cut $AKASETUP -f1 -d: | cut -f4 -d.`.ndl + +# Secondary nodelists and nodelists for other domains. +# use directory name from the first "nodelist" statement. +# filename originating address +EOF +#---------------------------- + + AKA="any" + IAKA=0 + while [ "$AKA" ] + do + IAKA=$[$IAKA+1] + AKA="`cut $AKASETUP -f$IAKA -d:`" + if [ "$AKA" ] + then + int2fidonet $AKA + AKAFTN="`echo $_RETVAL | cut -f1 -d.`" + echo -e "nodelist `echo $AKAFTN | cut -f2 -d '@'`.ndl\t$AKAFTN" >> $FNETCFG + fi + done + +#---------------------------- + cat <<EOF >>$FNETCFG + +# domain translations, just context substitution. Leading dot recommended. +# May contain '@'-sign too. First matching used. +# NOTE: If you specify at least one domtrans line, there will be _NO_ +# default for fidonet <--> fidonet.org. Don't forget to specify it +# explicitly as a last line. +# FTN side Internet side +#domtrans f720.n335.z2.fidonet.org giuda.deis.unical.it +#domtrans .fidonet .fidonet.org + +# Automatically updated alias database. If omitted or inaccessible, +# ^aREPLYADDR and ^aREPLYTO kludges are generated in fido messages. +database /var/spool/ifmail/ifdbm + +# Sequencer file (used to generate unique IDs) +sequencer /var/spool/ifmail/seq + +# Areas file (format: "AREA newsgroup distribution") +areas $CFGDIR/Areas + +# Bad groups prefixes - do not pass to fido if appear in Newsgroups header +# This is NOT the same as "!news.group" in the cnews "sys" file. +# badgroup relcom.ads. +# badgroup relcom.commerce. + +# Maximum allowed number of groups in the Newsgroups header, article will +# not be gated if exeeds. If zero or umitted - no limit. +# maxgroup 5 + +# Internet -> FidoNet (outgoing) character mapping table (a la mapchan) +# outtab $BINDIR/outkoi8alt + +# FidoNet -> Internet (incoming) character mapping table +# intab $BINDIR/outaltkoi8 + +# Toss program, used by ifunpack +iftoss $BINDIR/iftoss + +EOF + + cat copi.ifmcfg2 >>$FNETCFG + + if [ $[$[SPD] > $[19200]] = 1 ]; then + SPDLOCK="L38400" + elif [ $[$[SPD] > $[9600]] = 1 ]; then + SPDLOCK="L19200" + elif [ $[$[SPD] > $[2400]] = 1 ]; then + SPDLOCK="9600" + elif [ $[$[SPD] > $[1200]] = 1 ]; then + SPDLOCK="2400" + elif [ $[$[SPD] > $[300]] = 1 ]; then + SPDLOCK="1200" + else + SPDLOCK="300" + fi + + echo "ModemPort modem:$SPDLOCK" >>$FNETCFG + cat copi.ifmcfg5 >>$FNETCFG + + echo "PhoneTrans $COUNTRYPREF-$PREF- /" >>$FNETCFG + echo "PhoneTrans $COUNTRYPREF- / $LONG_DIST_PREFIX" >>$FNETCFG + echo "PhoneTrans / $INTERCOUNTRYPREF" >>$FNETCFG + echo "ModemReset ATZ\r" >>$FNETCFG + echo "ModemDial \d$DIALSTRING\T\r" >>$FNETCFG + + cat copi.ifmcfg4 >>$FNETCFG + + echo "Name $SYSNAME" >>$FNETCFG + echo "Location $LOCATION" >>$FNETCFG + echo "SysOp $SYSOP" >>$FNETCFG + echo "Phone $COUNTRYPREF-$PREF-$PHONE" >>$FNETCFG + echo "Speed $SPD" >>$FNETCFG + echo "Flags $NODEFLAGS" >>$FNETCFG + + chown fnet.uucp $FNETCFG +} + +# Args: cfg_dir +configure_smail() { + dialog --backtitle "$TITLE" --infobox "Configuro Smail..." 0 0 + + USER="`cat $COPIUSER`" + FNETHOME=~fnet + + SMAIL=$1 + SMAILCONF=$SMAIL/config + ALIASES=$SMAIL/aliases + DIRECTORS=$SMAIL/directors + ROUTERS=$SMAIL/routers + TRANSPORTS=$SMAIL/transports + FTNPATHS=$SMAIL/ftnpaths + +# File: config + save $SMAILCONF + + cat <<EOF >$SMAILCONF +# +# smail configuration for $HOST.$DOMAIN +# (see smail(5) man page for details and other options) +# +hostnames=$HOST:$HOST.$DOMAIN +domains=$DOMAIN +postmaster=$USER +smtp_banner="\$primary_name Linux Smail\$version #\$compile_num ready at \$date" +spool_mode=0600 +received_field="Received: \\ + \${if def:sender_host \\ + {from \$sender_host by \$primary_name \\ + \${if def:sender_proto: with \$sender_proto}\\ + \n\t(Linux Smail\$version #\$compile_num) }\\ + else{by \$primary_name \${if def:sender_proto:with \$sender_proto }\\ + (Linux Smail\$version #\$compile_num)\n\t}}\\ + id \$message_id; \$spool_date" +trusted_users=root:uucp:daemon:fnet +EOF + + +# File: routers + save $ROUTERS + + cat <<EOF >$ROUTERS +ifmail: driver=pathalias, + transport=ifmail; + + file=ftnpaths, + proto=lsearch, + domain=ftn:org +EOF + + +# File: transports + save $TRANSPORTS + + cat <<EOF >$TRANSPORTS +local: driver = appendfile, + return_path, + local, + from, + unix_from_hack; + + file = /var/spool/mail/\${lc:user}, + group = mail, + mode = 0660, + suffix = "\n", + append_as_user + +ifmail: driver=pipe, + from, + -received, + max_addrs=5, + max_chars=200; + + pipe_as_sender, + cmd="$FNETHOME/ifmail -r\$host \$((\${strip:user})\$)" + +EOF + + +# File: directors + save $DIRECTORS + + +# File: aliases + for i in $ALIASES /etc/aliases /usr/lib/aliases + do + if [ ! -L $i -a -f $i ] + then + mv $i $i~ + fi + done + + USERNAME="`cut /etc/passwd -f1,5 -d: | grep $USER: | cut -f2 -d: | sed y/\" \"/./`" + echo "news: $USER" >> $ALIASES + echo "usenet: $USER" >> $ALIASES + echo "$USERNAME: $USER" >> $ALIASES + + ln -sf $ALIASES /etc/ + ln -sf $ALIASES /usr/lib/ + + cd $SMAIL # is this necessary?? E-mail me if you know,please + mkaliases >/dev/null + +# File: ftnpaths + save $FTNPATHS + + OK=1 + IAKA=1 + while [ $OK != 0 ]; do + AKA="`cut $AKASETUP -f$IAKA -d:`" + IAKA=$[$IAKA+1] + if [ ! "$AKA" ]; then + OK=0 + else + echo -e ".`echo $AKA | cut -f4 -d.`\t\t$AKA!%s" >>$FTNPATHS + fi + done + + +# misc section + + chmod 1775 /var/spool/mail + chgrp mail /var/spool/mail + + cd $SMAIL + touch forward + /usr/lib/smail/mkdbm forward + +# reload sendmail + killall sendmail 2>/dev/null + /usr/sbin/sendmail -bd -q15m # if inetd handles smtp port, this will not load +} diff --git a/contrib/dialog/samples/copifuncs/copi.ifman1 b/contrib/dialog/samples/copifuncs/copi.ifman1 new file mode 100755 index 0000000..3e271a5 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifman1 @@ -0,0 +1,29 @@ +#! /usr/bin/perl +# +# This is a utility script to manipulate Fidonet-related issues +# using Eugene Crosser's ifmail package +# +# Version 0.1 +# +# (C) Michael Bravo and The Communication Tube, 1994 +# +# You can do whatever you want with this script. I take no responsibility +# whatsoever in anything related to this script. If you make some useful +# additions to this, please think of sending them to me so I could partake +# of your wisdom. +# +# This script was written to help attaching and requesting files from the +# commandline, much like you do with Squish under DOS or OS/2. It is certainly +# not perfect - I used it as an exercise in Perl. It also probably lacks +# some other useful features, like ability to specify trunc/sent or kill/sent +# attributes etc etc. If you really want this or some other features +# implemented, write me at mbravo@tctube.spb.su or mbravo@octopus.spb.su +# and I will try to do what I can. +# +# Note - files don't get copied to any spool dir, so if you move attached +# files somewhere, they won't get sent. +# +# This script is supposed to read ifmail's config to determine where outbound +# directory and logfile are. The only two parameters to modify in most cases +# are below. + diff --git a/contrib/dialog/samples/copifuncs/copi.ifman2 b/contrib/dialog/samples/copifuncs/copi.ifman2 new file mode 100755 index 0000000..0b6dbb7 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifman2 @@ -0,0 +1,137 @@ +if ( getpwuid($<) ne $ifowner ) { print "You must be owner of ifmail\n"; exit 1; } + +if ( (@ARGV < 3) || $ARGV[0] eq "-?" || $ARGV[0] eq "-h" ) { + &usage; +} + +$ARGV[0] =~ tr/A-Z/a-z/; +$ARGV[3] =~ tr/A-Z/a-z/; + +&parsecfg; + +if ( $logfile ne "" ) { + open(LOG, ">>".$logfile) || die "Can't open logfile"; +} + +if (substr($ARGV[1], 0, 1) ne "/") { + $cwd=`pwd`; + chop $cwd; + $ARGV[1] = $cwd."/".$ARGV[1]; +} + +if ($ARGV[3] eq "" || $ARGV[3] eq "normal") { + $flavour = 'f'; +} elsif ($ARGV[3] eq "crash") { + $flavour = 'c'; +} elsif ($ARGV[3] eq "hold") { + $flavour = 'h'; +} else { + print "Unknown flavour, assuming normal\n"; + $flavour = 'f'; +} + +if ($ARGV[0] eq "send") { + &attach($ARGV[1], $ARGV[2]); +} elsif ($ARGV[0] eq "get") { + &request($ARGV[1], $ARGV[2]); +} else { + print "Unknown command, try ifman -h\n"; + exit 1; +} + +close(LOG); + +exit 0; + +####################################################################### + +sub attach { + local($fspec, $address) = @_; + + $floname = &resolve($address); + + open(FLO, ">>".$outbound."/".$floname) || die "Can't open flo-file $outbound/$floname"; + open(FIND, "find $fspec -print |") || die "Can't generate list of files"; + + if ( eof(FIND) ) { + print "No matching files, nothing to send\n"; + exit 1; + } + + while (<FIND>) { + + chop; + $datestamp = `date \"+%D %T\"`; + chop $datestamp; + printf LOG "%s %s %s\n", $datestamp, $$, "ifman: sending $_ to $address"; + printf FLO "%s\n", $_; + } + + close(FLO); + close(FIND); +} + +sub request { + local($fspec, $address) = @_; + + $reqname = &resolve($address); + + $reqname =~ s/\.[fch]lo/\.req/; + + open(REQ, ">>".$outbound."/".$reqname) || die "Can't open req-file"; + + $datestamp = `date \"+%D %T\"`; + chop $datestamp; + printf LOG "%s %s %s\n", $datestamp, $$, "ifman: requesting $fspec from $address"; + printf REQ "%s\n", $fspec; + + close(REQ); +} + +sub resolve { + local($addr) = @_; + + if ( index($addr, ":") >=0 ) { + print "I cannot resolve addresses with zones!\n"; + exit 1; + } elsif ( index($addr, "/") == -1 ) { + print "Not a valid address!\n"; + exit 1; + } + + ($net, $node, $point) = split(/\/|\./, $addr); + + if ( defined $point ) { + $pointdir = sprintf("%04x%04x.pnt", $net, $node); + if ( ! -e $outbound."/".$pointdir ) { + mkdir ($outbound."/".$pointdir, 0755) || die "Can't create point directory"; + } + $flo = sprintf("0000%04x.%01slo", $point, $flavour); + return $pointdir."/".$flo; + } else { + $flo = sprintf("%04x%04x.%01slo", $net, $node, $flavour); + return $flo; + } +} + +sub usage { + print "ifmail manager script\n"; + print "usage: ifman <cmd> <filespec> <address> [flavour]\n"; + print " commands: send, get\n"; + print " flavours: normal, crash, hold. Default is normal.\n"; + print "Only 2d addresses with points are supported - no zones!\n"; + exit 1; +} + +sub parsecfg { + open(CFG, $cfgfile) || die "Can't open ifmail config file"; + + while (<CFG>) { + chop; + if (/^#/) { next; } + if (/^outbound\s+(\S+)/) { $outbound = $1; } + if (/^logfile\s+(\S+)/) { $logfile = $1; } + } + + close(CFG); +} diff --git a/contrib/dialog/samples/copifuncs/copi.ifmcfg2 b/contrib/dialog/samples/copifuncs/copi.ifmcfg2 new file mode 100755 index 0000000..c8a8c03 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifmcfg2 @@ -0,0 +1,68 @@ +# Transport programs for mail and news, used by iftoss +sendmail /usr/lib/sendmail -f $F $T +rnews /usr/lib/news/rnews + +# Unpackers, used by ifunpack. +# $F expands to archieve file name +unzip /usr/bin/unzip -oq $F +unarj /usr/bin/unarj e $F +#unarc /usr/bin/unpack $F +unzoo /usr/bin/zoo -extract $F +unlzh /usr/bin/lharc -x $F + +# Packer program, used by ifpack +# $F expands to archieve file name, $P - to list of packet names +packer /usr/bin/zip $F $P + +# Maximum arcmail file size, will start new arcmail file if exceeds +maxfsize 65000 + +# Maximum packet size, ifmail/ifnews will start new packet if exeeds. +# .out files are NOT created if nonzero specified, you must run ifpack +# to make packets out. (unimplemented) +maxpsize 65000 + +# cnews log file and (temporary) database for seen-bys +newslog /usr/lib/news/log +msgidbm /tmp/ifmsgids + +# From this line on, values may be prefixed by a logical expression in +# round brackets. Operators are: '!', '&', '|', 'Xor'. +# Possible elements are: +# - Nodelist flags (like "CM", "MNP", "V32" etc.) +# - speed <operator> <numeric> +# where <operator> is '=', '!=', '<', '>', '<=', '>=' +# - address <wildcard> +# where <wildcard> is an (possibly incomplete) fidonet address, +# e.g. "5020/*" +# - time <interval>[,<interval>,...] +# where <interval> is a day spec. with optional time spec., e.g. +# Wk2000-0900,Sat1800-0000,Sun +# - phone <prefix> +# e.g. "phone 7-095-" + +# Dialing parameters +# of multiple "ModemPort", "ModemReset", "ModemDial", "ModemHangup" lines, +# first matching is used. +# of multiple "PhoneTrans", "ModemConnect", "ModemError" lines, all matching +# are used. +# In send and expect strings, following substitutions are made: +# \\ '\' character +# \r carriage return (0x0d) +# \n new line (0x0a) +# \t tab (0x09) +# \b backspace (0x08) +# \s space (0x20) +# \NNN (where N is an octal digit) - character with octal code NNN +# \d 1 second delay (send strings only) +# \p 1/4 second pause (send strings only) +# \T translated telephone no. (send strings only) +# \D untranslated telephone no. (send strings only) + +# ModemPort present a blank-separated list of ports with possible speed +# extention (separated by colon); if speed is prefixed with 'L', it is +# a "locked" port speed, otherwise it is a maximum speed to be set, while +# actual speed is taken from the nodelist. If speed is omitted (or set +# to zero), previous port speed is not changed. +#ModemPort (time Any0000-0900,Sat,Sun) ttyS0 +#ModemPort cua0:L38400 diff --git a/contrib/dialog/samples/copifuncs/copi.ifmcfg4 b/contrib/dialog/samples/copifuncs/copi.ifmcfg4 new file mode 100755 index 0000000..4cb7a75 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifmcfg4 @@ -0,0 +1,30 @@ +ModemHangup +++ATH\r +ModemOK OK +ModemConnect CONNECT +ModemError BUSY +ModemError NO\sCARRIER +ModemError NO\sDIAL +ModemError RING\r +ModemError ERROR + +# Call options (time, address and nodelist flag dependant) +# All matching are applied in the order they are specified. +# Possible options are "[No]Call", "[No]Hold", "[No]PUA", "[No]EMSI", +# "[No]WaZOO", "[No]Freqs", "[No]Zmodem", "[No]ZedZap", "[No]Janus", +# "[No]Hydra". Here, WaZOO stands for YooHoo/2U2 handshake, not for +# the transfer scheme. FTS-0001 handshake and DietIFNA scheme cannot +# be disallowed (because they are mandatory by standart). "Hold" +# means really hold "hold" type packets and files: do not send them +# if our system initiated the session, "NoHold" means send "hold" +# packets when our system initiated the session. "NoPUA" stands for +# "No PickUp All", i.e. PUP ("Pick Up Primary"). NoCall means do not +# perform outbound call. This flag has no effect on the nodes +# explicitly specified in the command line. +# Default options are "everything allowed". +# options ((!CM) & time Any0700-0200) Nocall +#options (time Any0900-2100 & ! address 2:5020/*) Nocall + +# EMSI data for this node +# From this line on values CANNOT be prefixed with logical expression +# For now, escaping of '}' and ']' unimplemented, try to avoid these +# characters please! diff --git a/contrib/dialog/samples/copifuncs/copi.ifmcfg5 b/contrib/dialog/samples/copifuncs/copi.ifmcfg5 new file mode 100755 index 0000000..8221c1c --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifmcfg5 @@ -0,0 +1,14 @@ + +# PhoneTrans lines provide rules to change phone prefixes to make local +# or long-distance calls. In the example below, my country code is 7, +# and local dialing area is 095. From the numbers starting with "7-095-" +# the prefix is stripped and the 7-digit remainder is dialed. For +# the numbers starting with "7-" but not with "7-095-", the country prefix +# "7-" is stripped and the long-distance dialing prefix "8W" substituted. +# For the numbers not matching any of the above, international +# call is performed: international dialing prefix "8W10" is prepended +# to the unmodified 11-digit number. Generally, the syntax is: +# "PhoneTrans <what-to-strip> / <what-to-substitute-instead>" +#PhoneTrans 7-095- / +#PhoneTrans 7- / 8W +#PhoneTrans / 8W10 diff --git a/contrib/dialog/samples/copifuncs/copi.ifpoll1 b/contrib/dialog/samples/copifuncs/copi.ifpoll1 new file mode 100755 index 0000000..812c8e9 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifpoll1 @@ -0,0 +1,9 @@ +#!/bin/sh +# ver 0.7 +# ifpoll, poll my boss node or the node given as argument 1 +# +# i start this shell script every day by crond, but you can +# start it also by hand :) start it as the owner of ifcico. +# rasca, berlin 1993 (Rasca Gmelch, 2:2410/305.4) +# +# where "ifcico" and "ifpack" reside diff --git a/contrib/dialog/samples/copifuncs/copi.ifpoll2 b/contrib/dialog/samples/copifuncs/copi.ifpoll2 new file mode 100755 index 0000000..216bff0 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifpoll2 @@ -0,0 +1,107 @@ + +# Packets backup directory - You have to CREATE this directory +BAK=/var/spool/ifmail/BAK + +# logfile of ifcico +IFLOG=/var/log/ifmail/sysiflog + +# log archive +IFLOGARC=/var/log/ifmail/TheLog + +# owner of "ifcico" +IFCICO_OWNER=fnet + +# how often should i try to call NODE? +MaxTry=30 + +# delay between outgoing calls in seconds +DELAY=10 + +# where to log processing - file or tty/console +INFO_TTY=/dev/console + +# Lets backup the log and use a new one +if [ -e $IFLOG ]; then + echo Rearranging logs... + cat $IFLOG >> $IFLOGARC + cp /dev/null $IFLOG +fi + +echo "`date \"+%b %d %T\"` ifpoll[$$]: starting" # >> $INFO_TTY + +# remember me, not to run as root.. +# +if [ `whoami` != "$IFCICO_OWNER" ]; then + echo "*** run $0 as the owner of ifcico ***" + echo "`date \"+%b %d %T\"` ifpoll[$$]: wrong uid (rc 2)" # >> $INFO_TTY + exit 2 +fi + +# argv[1] is the optional node to call +# +if [ "$1" != "" ]; then + if [ "$1" = "-?" ] || [ "$1" = "-h" ]; then + echo "usage: ifpoll [<node>]" + exit 3 + else + NODE=$1 + fi +fi + +# let's pack the fido stuff.. +# +$FIDOPATH/ifpack + +# loop until ifcico could connect the node or MaxTry is encountered +# +i=1; errlv=1 +while let 'i <= MaxTry' && let 'errlv != 0' +do + echo -n "`date \"+%b %d %T\"` ifpoll[$$]: $i. try ($NODE) " # >> $INFO_TTY + # + # start ifcico in master mode .. + # + $FIDOPATH/ifcico -r 1 $NODE + errlv=$? + if [ $errlv != "0" ]; then + echo "failed" # >> $INFO_TTY + if [ $i != $MaxTry ]; then + sleep $DELAY + fi + let i=i+1 + else + echo "ok :)" # >> $INFO_TTY + fi +done + +# if the poll was fine, unpacking.. +# +if [ $errlv = "0" ]; then + echo "`date \"+%b %d %T\"` ifpoll[$$]: unpacking.. " # >> $INFO_TTY + cp -f /var/spool/ifmail/inb/*.* $BAK + $FIDOPATH/ifunpack + # add here some additional lines for processing tic files or + # incoming file-lists or simular.. +else + # write me a mail about the failed poll + tail --lines=20 $IFLOG | elm -s "ifpoll: failed" $IFCICO_SYSOP >/dev/null +fi + +echo "`date \"+%b %d %T\"` ifpoll[$$]: finished (rc $errlv)" # >> $INFO_TTY + +# Collect some infos... +echo "" +echo "*** Outgoing File Transfer Stats: ***" +grep sent $IFLOG +echo "*** Incoming File Transfer Stats: ***" +grep received $IFLOG +echo "" + +echo "---->> New mail: <<-----" +grep echomail $IFLOG +echo "---->> Personal mail: <<-----" +grep "mail from" $IFLOG +echo "" + +# return the errorlevel of ifcico +exit $errlv diff --git a/contrib/dialog/samples/copifuncs/copi.ifreq1 b/contrib/dialog/samples/copifuncs/copi.ifreq1 new file mode 100755 index 0000000..6372939 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifreq1 @@ -0,0 +1,20 @@ +#!/usr/bin/perl +$ver = "0.4"; +# +# this perl script is designed for the ifmail package by eugene grosser. +# +# request a file (first argument) from a fido-node (second argument), +# don't forget to quote if you use wildcards, e.g.: + +# ifreq 'files*' 2:2410/305 +# or +# ifreq 'files newfile' 2:2410/305 +# +# this perl script does only add an entry to the corresponding flo-file, +# the mailer ifcico is not started! +# +# rasca, berlin 1994 (rasca@marie.physik.tu-berlin.de, 2:2410/305.4) +# +# multi-zone support added by +# Roland Rosenfeld 15.05.1994 (roland@p13.flokiste.fido.de, 2:2450/300.13) + diff --git a/contrib/dialog/samples/copifuncs/copi.ifreq2 b/contrib/dialog/samples/copifuncs/copi.ifreq2 new file mode 100755 index 0000000..9ee78ff --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.ifreq2 @@ -0,0 +1,68 @@ +# this is the base directory, where the req-files are stored and the +# default outbound +$flo_path = "/var/spool/ifmail"; +$outbound = "/outb"; # don't be confused, it means "/var/spool/ifmail/outb" + +# end of configuration ############################################# + +# main() +# +if ((@ARGV < 1) || @ARGV > 2 || $ARGV[0] eq "-?") { + &usage; +} elsif ($ARGV[1] ne "") { + $node = $ARGV[1]; +} +$file = $ARGV[0]; + +if (! ($node =~ /\d+:\d+\/\d+/)) { + die "Wrong address: $node!!!"; +} + +($zone, $netnode) = split (/:/, $node); +$reqfile = sprintf("%04x%04x", split(/\//, $netnode)); + +if ($reqfile eq "00000000") { + print ("can't resolve the fido address \"$node\"\n"); + &usage; +} else { + if ( $zone == 2 ) { + $reqfile = $flo_path . $outbound . "/" . $reqfile . ".req"; + } elsif ( $zone < 7 ) { + $reqfile = $flo_path . $outbound . ".00$zone/" . $reqfile . ".req"; + } else { + $outbound = ""; + open (CONFIG, "< $config") || die "can't open $config"; + while ($_ = <CONFIG>) { + if ( /^address.*$zone:.*\@(\w*)/ ) { $outbound = $1; } + } + if ( $outbound eq "" ) { + die "No Zone $zone found in $config"; + } + $reqfile = $flo_path . "/$outbound/" . $reqfile . ".req"; + } + + # seperate the file names of the first argument + @files = split (/\s+/, $ARGV[0]); + + # open the flofile for appending + open(FLOFILE, ">>" . $reqfile) || die "can't open $reqfile"; + while (@files) { + print (FLOFILE shift(@files), "\n"); + } + close(FLOFILE); + + print ("--- fido request $ver ---------------------------\n"); + print ("requesting \"$file\" from fido-node $node\n"); + print ("--- executing ifstat .. ------------------------\n"); + system("ifstat"); +} + +# +# subroutine "usage" +# +sub usage { + printf ("--- fido request %s -------------\n", $ver); + printf ("usage: ifreq <file> [<3-d address>]\n"); + printf ("e.g. : ifreq FILES 2:2410/305\n"); + exit 1; +} diff --git a/contrib/dialog/samples/copifuncs/copi.rcnews b/contrib/dialog/samples/copifuncs/copi.rcnews new file mode 100755 index 0000000..957a272 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.rcnews @@ -0,0 +1,79 @@ +#! /bin/sh +## $Revision: 1.1 $ +## News boot script. + +## =()<. @<_PATH_SHELLVARS>@>()= +. /usr/lib/news/innshellvars + +## Pick ${INND} or ${INNDSTART} +WHAT=${INNDSTART} +## Set to true or false +DOINNWATCH=false +MAIL="${MAILCMD} -s 'Boot-time Usenet warning on `hostname`' ${NEWSMASTER}" + +## RFLAG is set below; set FLAGS as appropriate. +RFLAG="" +FLAGS="-i0 -c0" + +## Clean shutdown? +if [ -f ${SERVERPID} ] ; then + ( echo 'INND: PID file exists -- unclean shutdown!' >/dev/console ) + RFLAG="-r" +fi + +if [ ! -f ${NEWSLIB}/.news.daily ] ; then + echo 'No .news.daily file; need to run news.daily?' | eval ${MAIL} +else + case `find ${NEWSLIB} -name .news.daily -mtime +1 -print 2>/dev/null` in + "") + ;; + *) + echo 'Old .news.daily file; need to run news.daily?' | eval ${MAIL} + ;; + esac +fi + +## Active file recovery. +if [ ! -s ${ACTIVE} ] ; then + if [ -s ${NEWACTIVE} ] ; then + mv ${NEWACTIVE} ${ACTIVE} + else + if [ -s ${OLDACTIVE} ] ; then + cp ${OLDACTIVE} ${ACTIVE} + else + ( echo 'INND: No active file!' >/dev/console ) + exit 1 + fi + fi + RFLAG="-r" + # You might want to rebuild the DBZ database, too: + #echo "cd ${NEWSLIB} \ + # && makehistory -r \ + # && mv history.n.dir history.dir \ + # && mv history.n.pag history.pag" | su ${NEWSUSER} +fi + +## Remove temporary batchfiles and lock files. +( cd ${BATCH} && rm -f bch* ) +( cd ${LOCKS} && rm -f LOCK* ) +( cd ${TEMPSOCKDIR} && rm -f ${TEMPSOCK} ) +rm -f ${NEWSCONTROL} ${NNTPCONNECT} ${SERVERPID} + +## Start the show. +( echo 'Starting innd.' >/dev/console ) +eval ${WHAT} ${RFLAG} ${FLAGS} + +# Gee, looks like lisp, doesn't it? +${DOINNWATCH} && { + echo "( ( sleep 60 ; ${INNWATCH} ) & )" | su ${NEWSUSER} +} + +RMFILE=${MOST_LOGS}/expire.rm +if [ -s ${MOST_LOGS}/expire.rm ] ; then + ( echo "Removing articles from pre-downtime expire run." >/dev/console ) + ( + echo 'System shut down during expire. Unlinking articles listed in' + echo ${RMFILE} + ) | eval ${MAIL} + echo "${NEWSBIN}/expirerm ${RMFILE}" | su ${NEWSUSER} & +fi diff --git a/contrib/dialog/samples/copifuncs/copi.sendifm1 b/contrib/dialog/samples/copifuncs/copi.sendifm1 new file mode 100755 index 0000000..564b9c6 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.sendifm1 @@ -0,0 +1,74 @@ +#! /bin/sh +## $Revision: 1.1 $ +## SH script to send UUCP batches out. + +## =()<. @<_PATH_SHELLVARS>@>()= +. ~news/innshellvars + +PROGNAME=`basename $0` +LOCK=${LOCKS}/LOCK.${PROGNAME} +LOG=${MOST_LOGS}/${PROGNAME}.log + +MAXJOBS=200 +UUXFLAGS="- -r -gd" + +## Start logging. +test ! -f ${LOG} && touch ${LOG} +chmod 0660 ${LOG} +exec >>${LOG} 2>&1 +echo "${PROGNAME}: [$$] begin `date`" +cd ${BATCH} + +## Anyone else there? +trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15 +shlock -p $$ -f ${LOCK} || { + echo "${PROGNAME}: [$$] locked by [`cat ${LOCK}`]" + exit 0 +} + +## Who are we sending to? +if [ -n "$1" ] ; then + LIST="$*" +else + LIST=`ls /usr/spool/news/out.going|egrep "f[0-9]*.n[0-9]*$"` +fi + +case ${HAVE_UUSTAT} in +DONT) + TEMP=${TMPDIR}/uuq$$ + uuq -h |tr -d : >${TEMP} + ;; +esac + +## Do the work... + +for SITE in ${LIST}; do + + ## See if any data is ready for host. + BATCHFILE=${SITE}.uucp + if [ -f ${SITE}.work ] ; then + cat ${SITE}.work >>${BATCHFILE} + rm -f ${SITE}.work + fi + mv ${SITE} ${SITE}.work + ctlinnd -s -t30 flush ${SITE} || continue + cat ${SITE}.work >>${BATCHFILE} + rm -f ${SITE}.work + if [ ! -s ${BATCHFILE} ] ; then + echo "${PROGNAME}: [$$] no articles for ${SITE}" + rm -f ${BATCHFILE} + continue + fi + + ## Get the compression flags. + echo "${PROGNAME}: [$$] begin ${SITE}" + case "${SITE}" in + phreak) + COMPRESS="compress" + ;; + *) + COMPRESS="gzip" + ;; + esac + + time batcher \ diff --git a/contrib/dialog/samples/copifuncs/copi.sendifm2 b/contrib/dialog/samples/copifuncs/copi.sendifm2 new file mode 100755 index 0000000..1a34a1f --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.sendifm2 @@ -0,0 +1,15 @@ + ${SITE} ${BATCHFILE} + + echo "${PROGNAME}: [$$] end ${SITE}" +done + +case ${HAVE_UUSTAT} in +DONT) + rm -f ${TEMP} + ;; +esac + +## Remove the lock file. +rm -f ${LOCK} + +echo "${PROGNAME}: [$$] end `date`" diff --git a/contrib/dialog/samples/copifuncs/copi.trnrc b/contrib/dialog/samples/copifuncs/copi.trnrc new file mode 100644 index 0000000..7be596f --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.trnrc @@ -0,0 +1,13 @@ +TRNINIT="-x -e -X -F\" :> \"" +HIDELINE="^X-FTN" +NEWSHEADER="Newsgroups: %(%F=^\$?%C:%F) +Subject: %(%S=^\$?%\"\n\nSubject: \":%S) +%(%R=^\$?:References: %R +)Sender: +Distribution: %(%i=^\$?%\"\nDistribution: \":%D) +Organization: %o +X-Comment-To: %f\n\n" +ATTRIBUTION="%f writes:\n" +YOUSAID="In article %i \n of newsgroup %C you write about \"%s\":\n" +MAILCALL="(New Mail)" +export NEWSHEADER HIDELINE TRNINIT ATTRIBUTION MAILCALL YOUSAID EDITOR diff --git a/contrib/dialog/samples/copifuncs/copi.wheel b/contrib/dialog/samples/copifuncs/copi.wheel new file mode 100755 index 0000000..567e559 --- /dev/null +++ b/contrib/dialog/samples/copifuncs/copi.wheel @@ -0,0 +1,54 @@ +#!/bin/bash +# $Id: copi.wheel,v 1.2 2001/01/15 22:26:33 tom Exp $ + +mkstemp size +dialog --print-maxsize 2>$tmp_size +ROWS="`cut $tmp_size -f1 -d, | cut -f2 -d:`" +COLS="`cut $tmp_size -f2 -d,`" +rm $tmp_size + +# Takes an integer, multiplies it for COLS, divides for 132 +scalex() { + echo $[$1*$COLS/132] +} +scaley() { + echo $[$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 \ +--sleep 1 --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 \ +--begin `scaley 6` `scalex 25` --infobox "popd >/dev/null" 0 0 +sleep 1 diff --git a/contrib/dialog/samples/copifuncs/ifpatch b/contrib/dialog/samples/copifuncs/ifpatch new file mode 100644 index 0000000..1e7c7ee --- /dev/null +++ b/contrib/dialog/samples/copifuncs/ifpatch @@ -0,0 +1,101 @@ +--- ifgate/message.c.orig Mon Jul 24 15:17:47 1995 ++++ ifgate/message.c Mon Jul 24 15:18:00 1995 +@@ -48,12 +48,26 @@ + if (!strcasecmp(msg->key,"X-UUCP-From")) return 0; + if (!strcasecmp(msg->key,"X-Body-Start")) return 0; + if (!strncasecmp(msg->key,"X-FTN-",6)) return 0; +- if (!strcasecmp(msg->key,"Path")) return isftnpath(msg->val)?0:1; ++ if (!strcasecmp(msg->key,"Path")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return isftnpath(msg->val)?0:1; ++#endif ++ + if (!strcasecmp(msg->key,"Newsgroups")) return newsmode?0:2; + if (!strcasecmp(msg->key,"Xref")) return 0; + if (!strcasecmp(msg->key,"Return-Receipt-To")) return 1; + if (!strcasecmp(msg->key,"Received")) return newsmode?0:2; +- if (!strcasecmp(msg->key,"From")) return ftnorigin?0:2; ++ if (!strcasecmp(msg->key,"From")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return ftnorigin?0:2; ++#endif ++ + if (!strcasecmp(msg->key,"To")) + { + if (newsmode) return 0; +@@ -66,7 +80,14 @@ + } + if (!strcasecmp(msg->key,"Cc")) return 2; + if (!strcasecmp(msg->key,"Bcc")) return 2; +- if (!strcasecmp(msg->key,"Reply-To")) return 2; ++ if (!strcasecmp(msg->key,"Reply-To")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return 2; ++#endif ++ + if (!strcasecmp(msg->key,"Lines")) return 0; + if (!strcasecmp(msg->key,"Date")) return 0; + if (!strcasecmp(msg->key,"Subject")) +@@ -77,8 +98,22 @@ + if (!strcasecmp(msg->key,"Organization")) return removeorg?0:1; + if (!strcasecmp(msg->key,"Comment-To")) return 0; + if (!strcasecmp(msg->key,"X-Comment-To")) return 0; +- if (!strcasecmp(msg->key,"Keywords")) return 2; +- if (!strcasecmp(msg->key,"Summary")) return 2; ++ if (!strcasecmp(msg->key,"Keywords")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return 2; ++#endif ++ ++ if (!strcasecmp(msg->key,"Summary")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return 2; ++#endif ++ + if (!strcasecmp(msg->key,"MIME-Version")) return removemime?0:1; + if (!strcasecmp(msg->key,"Content-Type")) return removemime?0:1; + if (!strcasecmp(msg->key,"Content-Length")) return removemime?0:1; +@@ -86,8 +121,26 @@ + if (!strcasecmp(msg->key,"Content-Name")) return 2; + if (!strcasecmp(msg->key,"Content-Description")) return 2; + if (!strcasecmp(msg->key,"Message-ID")) return ftnorigin?0:1; +- if (!strcasecmp(msg->key,"References")) return removeref?0:1; +- if (!strcasecmp(msg->key,"Distribution")) return ftnorigin?0:1; ++ if (!strcasecmp(msg->key,"References")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return removeref?0:1; ++#endif ++ ++ if (!strcasecmp(msg->key,"Distribution")) ++ ++#ifdef LESS_RFC_KLUDGES ++ return 0; ++#else ++ return ftnorigin?0:1; ++#endif ++ ++#ifdef LESS_RFC_KLUDGES ++ if (!strcasecmp(msg->key,"NNTP-Posting-Host")) return 0; ++#endif ++ + /*if (!strcasecmp(msg->key,"")) return ;*/ + return 1; + } diff --git a/contrib/dialog/samples/copismall b/contrib/dialog/samples/copismall new file mode 100755 index 0000000..3dfb485 --- /dev/null +++ b/contrib/dialog/samples/copismall @@ -0,0 +1,296 @@ +#!/bin/bash +# $Id: copismall,v 1.8 2010/01/13 10:26:52 tom Exp $ +# +# ComeOn Point Installer! v0.9a.small (small version for cdialog v0.9a) +# - installa il point in modo visuale e auto-detecting. Versione light. +# +# AUTHOR: Beppe (beppe.dem@nsm.it) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# THIS IS NOT THE ORIGINAL VERSION!!!! This files was adequate to be +# a demo for cdialog v0.9a+. However it doesn't include all its features. +# Look for one of the free ComeOn Linux! tools to have a complete +# demo of cdialog. ComeOn Linux! follows the GNU philosophy. +# Send peacefully a mail to demarco_p@abramo.it for more info. + +. ./setup-vars + +#COMEONDIR=/usr/lib/ComeOn +#POINTDIR=$COMEONDIR/point +POINTDIR=`pwd` + +AKASETUP=$POINTDIR/.akasetup +PNTSETUP=$POINTDIR/.pntsetup +EMSIFILE=$POINTDIR/.emsi +COPIUSER=$POINTDIR/.copi.user +COPIVER=v0.9a.small +TITLE="ComeOn Point Installer! $COPIVER -+- (c) 1996 ComeOn Linux!" + +#FUNCSVER=v0.9.2 +#FUNCSDIR=$POINTDIR/funcs-$FUNCSVER +FUNCSDIR=$POINTDIR/copifuncs + +#COPIDIR=$POINTDIR/copi-$COPIVER +#. $COPIDIR/copishellvars + +#POINTVER="v1.1" # ComeOn Point version + +if [ $LOGNAME != root ] +then + $DIALOG --backtitle "$TITLE" --title "Error!" --beep --msgbox "Questo programma per funzionare correttamente deve essere avviato dall'amministratore di sistema (root)." 0 0 + exit +fi + + +$DIALOG --backtitle "$TITLE" --title "Are you sure?" --cr-wrap --msgbox "Questo installer procedera' in modalita' +auto-detect all'installazione del point. +Premi <Enter> per iniziare o <Esc> per uscire. " 0 0 + +if [ $? = $DIALOG_CANCEL -o $? = $DIALOG_ESC ]; then + exit +fi + + +pushd $FUNCSDIR >/dev/null +. ./copi.funcs +. ./common.funcs +. ./admin.funcs + +############################################################################### +find_incompatible_packages + +if [ "$PKG_TO_REMOVE" ] +then + $DIALOG --backtitle "$TITLE" --beep --title "Problem detected" --msgbox "Attenzione, prima di poter continuare bisogna avviare pkgtool e rimuovere i seguenti packages: $PKG_TO_REMOVE." 0 0 + exit +fi + +############################################################################### +mkstemp dialog + +find_necessary_packages + +if [ "$PKG_TO_INSTALL" ] +then + echo -n "Attenzione, prima di poter continuare bisogna avviare setup ed installare i seguenti packages dai disk sets N (quelli del Networking): $PKG_TO_INSTALL." >$tmp_dialog + + if [ "`echo $PKG_TO_INSTALL | grep tcpip`" ] + then + echo -n " Ricordarsi poi di effettuare lo shutdown per rendere effettive le modifiche." >>$tmp_dialog + fi + + $DIALOG --backtitle "$TITLE" --beep --title "Problem detected" --msgbox "`cat $tmp_dialog`" 0 0 + + rm $tmp_dialog + exit +fi + +############################################################################### +mkstemp smailp + +SMAILTGZ="" +if [ ! -d /usr/lib/smail ] +then + $DIALOG --backtitle "$TITLE" --title "Smail not found" --inputbox "Bisogna installare Smail, per cui inserire il percorso completo di dove trovarne i binari compressi" 0 0 "/cdrom/sunsite/system/Mail/delivery/smail-linuxbin-3.1.29.1.tar.gz" 2>$tmp_smailp + SMAILTGZ="`cat $tmp_smailp`" + rm $tmp_smailp + while [ ! -f "$SMAILTGZ" ] + do + $DIALOG --backtitle "$TITLE" --beep --title "Archive not found" --inputbox "Percorso di file \"$SMAILTGZ\" non valido, controllarne la correttezza." 0 0 "/cdrom/sunsite/system/Mail/delivery/smail-linuxbin-3.1.29.1.tar.gz" 2>$tmp_smailp + SMAILTGZ="`cat $tmp_smailp`" + rm $tmp_smailp + done +fi + +############################################################################### +mkstemp target +mkstemp asetup +mkstemp psetup + +AKA="" +while [ ! "$AKA" ] +do + $DIALOG --backtitle "$TITLE" --title "Primary address" --inputbox "Inserire il proprio address principale, completo di point e di domain. Il poll sara' effettuato per default dal boss corrispondente." 0 0 "2:335/722.7@fidonet" 2>$tmp_target + AKAFTN="`cat $tmp_target`" + rm $tmp_target + fidonetpoint2int $AKAFTN + AKA="$_RETVAL" +done +echo -n "`echo $AKA | cut -f2- -d.`:" >$tmp_asetup +echo -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >$tmp_psetup +AKASFTN="$AKAFTN" +AKAS="$AKA" +while [ "$AKAFTN" ] +do + $DIALOG --backtitle "$TITLE" --title "AKAs" --inputbox "Inserire un eventuale address secondario, oppure lasciare la riga vuota per proseguire. Attenzione: nel caso si abbiano piu' indirizzi sulla stessa rete, bisognera' configurare solo uno di questi. Gli indirizzi correntemente definiti sono: $AKASFTN" 0 0 2>$tmp_target + AKAFTN="`cat $tmp_target`" + rm $tmp_target + if [ "$AKAFTN" ] + then + fidonetpoint2int $AKAFTN + AKA="$_RETVAL" + if [ "`echo $AKAS | grep \".\`echo $AKA | cut -f5 -d.\`.\"`" ] + then + $DIALOG --backtitle "$TITLE" --beep --title "Invalid address" --msgbox "Non si possono avere piu' indirizzi sullo stesso dominio (net)." 0 0 + else + AKASFTN="$AKASFTN $AKAFTN" + AKAS="$AKAS $AKA" + echo -n "`echo $AKA | cut -f2- -d.`:" >>$tmp_asetup + echo -n "`echo $AKA | cut -f1 -d. | cut -c2-`:" >>$tmp_psetup + fi + fi +done +echo ":" >>$tmp_asetup +echo ":" >>$tmp_psetup +save $AKASETUP +save $PNTSETUP +mv $tmp_asetup $AKASETUP +mv $tmp_psetup $PNTSETUP + +############################################################################### +mkstemp hostnm + +$DIALOG --backtitle "$TITLE" --title "Hostname" --inputbox "Inserire l'hostname di questo computer qualora si abbia una rete gia' configurata, altrimenti inventarne uno fittizio da assegnare e questa macchina verra' configurata per il loopback." 0 0 "quark.comeon.org" 2>$tmp_hostnm +NEW_HOSTNAME="`cat $tmp_hostnm`" +rm $tmp_hostnm + +############################################################################### +mkstemp master + +$DIALOG --backtitle "$TITLE" --title "Point admin" --inputbox "Scegliere l'user principale per la gestione e l'uso del point. Se l'user non esiste, verra' creato. Se esiste, ne verranno adattate le informazioni quali nome, gruppi, etc." 0 0 "beppe" --and-widget --title "Insert SysOp's name" --inputbox "Inserire nome e cognome del gestore ed utilizzatore principale del point (il proprio nome)." 0 0 "Giuseppe De Marco" --and-widget --title "Choose editor" --inputbox "Scegliere l'editor da usare per scrivere i messaggi" 0 0 "vim" 2>$tmp_master +POST_USER="`cut $tmp_master -f1`" +POST_NAME="`cut $tmp_master -f2`" +POST_EDIT="`cut $tmp_master -f3`" +rm $tmp_master +save $COPIUSER +echo $POST_USER >$COPIUSER + +############################################################################### +mkstemp expire +mkstemp origin + +$DIALOG --backtitle "$TITLE" --title "Origin" --inputbox "Scegliere l'Origin del sistema" 9 60 "$POST_USER's linux box" 2>$tmp_origin +NEW_ORIGIN="`cat $tmp_origin`" +rm $tmp_origin + +$DIALOG --backtitle "$TITLE" --title "News expiring" --inputbox "Decidere per quanti giorni i messaggi echomail (le news) dovranno transitare sul sistema prima di venire cancellati automaticamente da news.daily. Inserire never se si vuole che non vengano mai cancellati. Sono ammesse cifre decimali (i.e. 25.5). Notare comunque che il valore qui inserito e' quello di default, ma per ogni singola area (newsgroup) sara' possibile specificare poi un valore appropriato." 0 0 "30" 2>$tmp_expire +KEEPDAYS="`cat $tmp_expire`" +rm $tmp_expire + +############################################################################### +mkstemp dialer +mkstemp ifmail +mkstemp mailvr +mkstemp passwd + +IFMAILTGZ="" +IFMAILVERS="" +if [ ! -d /usr/lib/ifmail -o ! -d /etc/ifmail -o ! -d /var/log/ifmail -o ! -f /usr/lib/ifmail/ifcico ] +then + $DIALOG --backtitle "$TITLE" --title "ifmail not found" --inputbox "Inserire il percorso COMPLETO dei sorgenti compressi di ifmail che verranno decompressi in /usr/src e compilati." 0 0 "/cdrom/sunsite/system/Mail/transport/ifmail-2.8b.tar.gz" 2>$tmp_ifmail + IFMAILTGZ="`cat $tmp_ifmail`" + rm $tmp_ifmail + while [ ! -f "$IFMAILTGZ" ] + do + $DIALOG --backtitle "$TITLE" --beep --title "invalid filename" --inputbox "Percorso di file \"$IFMAILTGZ\" non valido, controllarne la correttezza." 0 0 "/cdrom/sunsite/system/Mail/transport/ifmail-2.8b.tar.gz" 2>$tmp_ifmail + IFMAILTGZ="`cat $tmp_ifmail`" + rm $tmp_ifmail + done + + $DIALOG --backtitle "$TITLE" --title "ifmail version" --inputbox "Specificare la versione di ifmail" 0 0 "2.8b" 2>$tmp_mailvr + IFMAILVERS="`cat $tmp_mailvr` + ComeOn Point $POINTVER" + rm $tmp_mailvr +fi + +IAKA=1 +PASSW="" +AKA="`cut $AKASETUP -f$IAKA -d:`" +while [ "$AKA" ] +do + int2fido $AKA + AKAFTN="$_RETVAL" + $DIALOG --backtitle "$TITLE" --title "Password" --inputbox "Specificare la password di sessione e per i pacchetti per il nodo $AKAFTN -- attenzione che alcuni mailers accettano solo passwords da 8 caratteri in maiuscolo!!" 0 0 "MYPASSWD" 2>$tmp_passwd + PASSW="$PASSW`cat $tmp_passwd`:" + rm $tmp_passwd + IAKA=$[$IAKA+1] + AKA="`cut $AKASETUP -f$IAKA -d:`" +done +PASSW="$PASSW:" + +$DIALOG --backtitle "$TITLE" \ +--title "Modem speed" --inputbox "Specificare la velocita' del proprio modem (che sta su /dev/modem)" 0 0 "16800" --and-widget \ +--title "System name" --inputbox "Specificare il nome del sistema per il pacchetto EMSI" 0 0 "`cat $COPIUSER`'s linux point" --and-widget \ +--title "Location" --inputbox "Inserire la localita' fisica in cui risiede il sistema" 0 0 "Catanzaro, Italy - Europe" --and-widget \ +--title "Phone number" --inputbox "Inserire il proprio numero di telefono in formato internazionale, cioe' completo di doppio prefisso (xx-yyy-zzzzzz)" 0 0 "39-961-31997" --and-widget \ +--title "International call prefix" --inputbox "Specificare il prefisso da comporre per poter effettuare una chiamata internazionale (se ci si trova in Italia ad es. bisogna inserire 00)" 0 0 "00" --and-widget \ +--title "Long-distance call prefix" --inputbox "Specificare il prefisso da comporre per poter effettuare una chiamata interurbana in ambito nazionale, che verra' sostituito al prefisso della propria nazione quando incontrato in nodelist (per l'Italia ad es. bisogna inserire 0, che sostituira' il 39)" 0 0 "0" --and-widget \ +--title "Pointlist flags" --inputbox "Inserire eventuali flags stile pointlist per il pacchetto EMSI" 0 0 "MO,V32B,V42B,ZYX" --and-widget \ +--title "Modem dialing" --inputbox "Inserire la stringa da inviare al modem per comporre un numero telefonico" 0 0 "ATDT" 2>$tmp_dialer + +echo -en "\t$POST_NAME\t\t" >>$tmp_dialer +save $EMSIFILE +mv $tmp_dialer $EMSIFILE + +############################################################################### + +if [ -d /etc/smail ] +then + SMAILCFGDIR=/etc/smail +else + SMAILCFGDIR=/usr/lib/smail +fi + +############################################################################### + +$DIALOG --backtitle "$TITLE" --title "First step completed!" --msgbox "OK, ora ho tutte le informazioni necessarie per poter installare il point. Da qui in poi faro' tutto da solo, quindi ci si puo' tranquillamente andare a prendere un caffe'. :-)" 0 0 + +############################################################################### + +killall sendmail 2>/dev/null +if [ $SMAILTGZ ]; then tar zxvf $SMAILTGZ -C / >/dev/null; fi +/usr/sbin/sendmail -bd -q15m + +if [ ! "`ping -c1 $NEW_HOSTNAME | grep \"1 packets received\"`" ]; then + configure_loopback $NEW_HOSTNAME +fi + +add_postmaster "$POST_USER" "$POST_NAME" +add_alias "$POST_NAME" "$POST_USER" +configure_trn "$POST_USER" "$POST_EDIT" +configure_elm "$POST_USER" "$POST_EDIT" + +comment_nntp_in_inetdconf +set_organization "$NEW_ORIGIN" +create_innconf_newsfeeds_distrib +create_expirectl $KEEPDAYS +create_nnrpaccess +create_hostsnntp +create_dirs_and_files +install_rcnews +install_crontab_news +if [ $IFMAILTGZ ]; then + install_ifmail "$IFMAILTGZ" /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$IFMAILVERS" /usr/src +fi +configure_ifmail /usr/lib/ifmail /etc/ifmail /var/log/ifmail "$PASSW" +configure_smail $SMAILCFGDIR + +############################################################################### +$DIALOG --backtitle "$TITLE" \ +--title "-=[ Enjoy! ]=-" --msgbox "Il point e' stato installato con successo!" 0 0 --and-widget \ +--msgbox "trn (il newsreader, per leggere/scrivere gli echomail) ed elm (il mailreader, per leggere/scrivere i netmail) sono gia' stati configurati per l'user $POST_USER." 0 0 + +popd >/dev/null diff --git a/contrib/dialog/samples/debian.rc b/contrib/dialog/samples/debian.rc new file mode 100644 index 0000000..f624dba --- /dev/null +++ b/contrib/dialog/samples/debian.rc @@ -0,0 +1,117 @@ +# $Id: debian.rc,v 1.4 2005/12/01 01:18:57 tom Exp $ +# Run-time configuration file for dialog, matches Debian color scheme. +# (these are the default values for dialog) + +# 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 = (BLACK,WHITE,OFF) + +# Active button key color +button_key_active_color = (WHITE,BLUE,ON) + +# 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 = (BLACK,WHITE,OFF) + +# Input box border color +inputbox_border_color = (BLACK,WHITE,OFF) + +# Search box color +searchbox_color = (BLACK,WHITE,OFF) + +# Search box title color +searchbox_title_color = (BLUE,WHITE,ON) + +# Search box border color +searchbox_border_color = (WHITE,WHITE,ON) + +# File position indicator color +position_indicator_color = (BLUE,WHITE,ON) + +# Menu box color +menubox_color = (BLACK,WHITE,OFF) + +# Menu box border color +menubox_border_color = (WHITE,WHITE,ON) + +# Item color +item_color = (BLACK,WHITE,OFF) + +# Selected item color +item_selected_color = (WHITE,BLUE,ON) + +# Tag color +tag_color = (BLUE,WHITE,ON) + +# Selected tag color +tag_selected_color = (YELLOW,BLUE,ON) + +# Tag key color +tag_key_color = (RED,WHITE,OFF) + +# Selected tag key color +tag_key_selected_color = (RED,BLUE,ON) + +# Check box color +check_color = (BLACK,WHITE,OFF) + +# Selected check box color +check_selected_color = (WHITE,BLUE,ON) + +# Up arrow color +uarrow_color = (GREEN,WHITE,ON) + +# Down arrow color +darrow_color = (GREEN,WHITE,ON) + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = (WHITE,BLUE,ON) + +# Form text color +form_text_color = (WHITE,CYAN,ON) diff --git a/contrib/dialog/samples/dialog.py b/contrib/dialog/samples/dialog.py new file mode 100644 index 0000000..db66fd7 --- /dev/null +++ b/contrib/dialog/samples/dialog.py @@ -0,0 +1,353 @@ +# $Id: dialog.py,v 1.3 2004/09/21 00:52:15 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/dselect b/contrib/dialog/samples/dselect new file mode 100755 index 0000000..22995b4 --- /dev/null +++ b/contrib/dialog/samples/dselect @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: dselect,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "Please choose a directory" "$@" --dselect $HOME/ 14 48 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string 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..cfa8a4a --- /dev/null +++ b/contrib/dialog/samples/form1 @@ -0,0 +1,79 @@ +#! /bin/sh +# $Id: form1,v 1.14 2010/01/13 10:53:11 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_ERR) + echo "ERROR!" + 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/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..7f4599e --- /dev/null +++ b/contrib/dialog/samples/infobox5 @@ -0,0 +1,39 @@ +#! /bin/sh +# $Id: infobox5,v 1.6 2010/01/13 10:20:03 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..2e4505c --- /dev/null +++ b/contrib/dialog/samples/infobox6 @@ -0,0 +1,41 @@ +#! /bin/sh +# $Id: infobox6,v 1.6 2010/01/13 10:20:03 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..605382f2 --- /dev/null +++ b/contrib/dialog/samples/inputbox6-utf8 @@ -0,0 +1,17 @@ +#!/bin/sh +# $Id: inputbox6-utf8,v 1.8 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +. ./setup-tempfile + +. ./setup-utf8 + +$DIALOG \ +--title `printf "\xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\xe3\x81\x8a"` "$@" \ +--inputbox `printf "\xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\xe3\x81\x8a"` \ +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..5053cda --- /dev/null +++ b/contrib/dialog/samples/inputmenu @@ -0,0 +1,60 @@ +#! /bin/bash +# $Id: inputmenu,v 1.10 2010/01/13 10:29:22 tom Exp $ +# 2002 - written by Tobias Rittweiler <tobrit@freebits.de> + +. ./setup-vars + +user="$USER" ; uid="$UID" ; +gid="$GROUPS" ; 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="${value:8:${#value}}" + tag="${value%:*}" + item="${value#*: }" + + 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..22fce04 --- /dev/null +++ b/contrib/dialog/samples/inputmenu-stdout @@ -0,0 +1,53 @@ +#! /bin/bash +# $Id: inputmenu-stdout,v 1.8 2010/01/13 10:30:14 tom Exp $ +# 2002 - written by Tobias Rittweiler <tobrit@freebits.de> + +. ./setup-vars + +user="$USER" ; uid="$UID" ; +gid="$GROUPS" ; 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="${value:8:${#value}}" + tag="${value%:*}" + item="${value#*: }" + + 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..4e9bae2 --- /dev/null +++ b/contrib/dialog/samples/inputmenu1 @@ -0,0 +1,85 @@ +#! /bin/sh +# $Id: inputmenu1,v 1.8 2010/01/13 10:31:02 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..f560aba --- /dev/null +++ b/contrib/dialog/samples/inputmenu2 @@ -0,0 +1,97 @@ +#! /bin/sh +# $Id: inputmenu2,v 1.8 2010/01/13 10:32:04 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..e3250d8 --- /dev/null +++ b/contrib/dialog/samples/inputmenu3 @@ -0,0 +1,106 @@ +#! /bin/sh +# $Id: inputmenu3,v 1.10 2010/01/13 10:32:51 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..a872527 --- /dev/null +++ b/contrib/dialog/samples/inputmenu4 @@ -0,0 +1,86 @@ +#! /bin/sh +# $Id: inputmenu4,v 1.8 2010/01/13 10:33:35 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/install/FDISK.TEST b/contrib/dialog/samples/install/FDISK.TEST new file mode 100644 index 0000000..2ad568a --- /dev/null +++ b/contrib/dialog/samples/install/FDISK.TEST @@ -0,0 +1,28 @@ + +Disk /dev/hda: 14 heads, 62 sectors, 1018 cylinders +Units = cylinders of 868 * 512 bytes + + Device Boot Begin Start End Blocks Id System +/dev/hda1 1 1 3 1271 a OS/2 Boot Manager +/dev/hda2 4 4 287 123256 6 DOS 16-bit >=32M +/dev/hda3 * 288 288 649 157108 83 Linux native +/dev/hda4 650 650 1018 160146 83 Linux native + +Disk /dev/sda: 64 heads, 32 sectors, 511 cylinders +Units = cylinders of 2048 * 512 bytes + + Device Boot Begin Start End Blocks Id System +/dev/sda1 1 1 21 21488 82 Linux swap +/dev/sda2 22 22 511 501760 83 Linux native + +Disk /dev/sdb: 64 heads, 32 sectors, 4106 cylinders +Units = cylinders of 2048 * 512 bytes + + Device Boot Begin Start End Blocks Id System +/dev/sdb1 1 1 201 205808 83 Linux native +/dev/sdb2 202 202 402 205824 83 Linux native +/dev/sdb3 403 403 603 205824 83 Linux native +/dev/sdb4 604 604 4106 3587072 5 Extended +/dev/sdb5 604 604 1803 1228784 83 Linux native +/dev/sdb6 1024 1804 3003 1228784 83 Linux native +/dev/sdb7 2048 3004 4106 1129456 83 Linux native diff --git a/contrib/dialog/samples/install/makefile.in b/contrib/dialog/samples/install/makefile.in new file mode 100644 index 0000000..3dcdc09 --- /dev/null +++ b/contrib/dialog/samples/install/makefile.in @@ -0,0 +1,35 @@ +# $Id: makefile.in,v 1.1 2000/10/08 17:22:53 tom Exp $ +# template makefile for DIALOG sample 'install' +# +SHELL = /bin/sh + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +srcdir = @srcdir@ +top_builddir = ../.. + +DESTDIR = +bindir = $(DESTDIR)@bindir@ + +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ @DEFS@ -I$(top_builddir) -I$(srcdir)/../.. -I. -I$(srcdir) +EXTRA_CFLAGS = @EXTRA_CFLAGS@ +CC = @CC@ +LDFLAGS = @LDFLAGS@ +LIBS = -L../.. -ldialog @LIBS@ +RANLIB = @RANLIB@ + +RM = rm -f + +all: setup + +setup: setup.o + $(CC) -o $@ setup.o $(LIBS) + +clean: + rm -f *.o setup + +test: setup + ./setup + diff --git a/contrib/dialog/samples/install/setup.c b/contrib/dialog/samples/install/setup.c new file mode 100644 index 0000000..ae56981 --- /dev/null +++ b/contrib/dialog/samples/install/setup.c @@ -0,0 +1,371 @@ +/* Copyright (C) 1995 Florian La Roche */ +/* Who wants to help coding? I don't like doing this... */ + +/* You can just start setup as normal user and see how far it is coded + right now. This will do a fake installation and won't actually chnage + any data on your computer. */ + +/* TODO: write a good package selection code + change functions to return better error code + */ + +/* Show an extra text-box with the contents of all external commands, + before they are executed. So you can abort the installation, if any + wrong commands are to be executed. (So don't format wrong partition.) */ +#define VERBOSE 1 + +/* If defined, don't actually execute any comands and don't actually modify + any files. So you can test any possible installation without doing any + damage to your computer. + The file FDISK.TEST is used instead of real "fdisk -l" output, so that + it can be started as normal user. */ +#define DEBUG_THIS 1 + +#include <dialog.h> + +/* max length of a partition name like e.g. '/dev/hda1' */ +#define MAX_DEV_NAME 25 + +/* max number of possible Linux/Swap/MsDos partitions */ +#define MAX_PARTS 20 + +char *progname = NULL; + +static void +error(const char *s) +{ + fprintf(stderr, "%s: %s\n", progname, s); + exit(1); +} + +static int +my_system(const char *s,...) +{ + int ret, i; + va_list ap; + char sh[200]; + + va_start(ap, s); + vsprintf(sh, s, ap); + va_end(ap); + +#ifdef VERBOSE + i = dialog_msgbox("I will run the following command:", sh, 10, 65, 1); + dialog_clear(); +#ifdef DEBUG_THIS + return 0; +#endif +#endif + ret = system(sh); + if (!(ret >> 8)) + return 0; + i = dialog_msgbox("Error-Exit on the following command:", + sh, 12, 73, 1); + dialog_clear(); + return 1; +} + +/* We support to install from DOS/Linux-partitions. */ +enum partition_type { + MsDos, + Linux, + Swap +}; + +struct partition { + enum partition_type type; + char name[MAX_DEV_NAME]; + int blocks; + int flag; +} partitions[MAX_PARTS]; +int num_partition = 0; +int num_linux = 0; +int num_swap = 0; +int num_msdos = 0; + +static int +get_line(char *line, int size, FILE * f) +{ + char *ptr = line; + int c; + + if (feof(f)) + return -1; + while (size-- && ((c = getc(f)) != EOF) && (c != '\n')) + *ptr++ = c; + *ptr++ = '\0'; + return (int) (ptr - line); +} + +static void +read_partitions(void) +{ + FILE *f; + char line[200]; + int length; +#ifndef DEBUG_THIS + int ret = system("fdisk -l 2>/dev/null 1>/tmp/fdisk.output"); + if ((ret >> 8) != 0) { + error("fdisk didn't run"); + } + if ((f = fopen("/tmp/fdisk.output", "r")) == NULL) +#else + if ((f = fopen("FDISK.TEST", "r")) == NULL) +#endif + error("cannot read fdisk output"); + + while (num_partition <= MAX_PARTS + && (length = get_line(line, 200, f)) >= 0) { + if (strncmp(line, "/dev/", 5) == 0) { + int n = 0; + char *s = line + 5; + char *t = partitions[num_partition].name; + strcpy(t, "/dev/"); + t += 5; + while (n < MAX_DEV_NAME && *s != '\0' + && !isspace((unsigned char) *s)) { + *t++ = *s++; + n++; + } + *t = '\0'; + /* Read the size of the partition. */ + t = line + 37; + while (isspace((unsigned char) *t)) + t++; + partitions[num_partition].blocks = atoi(t); + if (strstr(line, "Linux native")) { + partitions[num_partition].type = Linux; + num_partition++; + num_linux++; + } else if (strstr(line, "Linux swap")) { + partitions[num_partition].type = Swap; + num_partition++; + num_swap++; + } else if (strstr(line, "DOS")) { + partitions[num_partition].type = MsDos; + num_partition++; + num_msdos++; + } + } + } + fclose(f); +#ifndef DEBUG_THIS + unlink("/tmp/fdisk.output"); +#endif +} + +static int +select_partition(const char *title, const char *prompt, int y, int x) +{ + int i, num, ret; + char info[MAX_PARTS][40]; + char *items[MAX_PARTS * 2]; + int num_pa[MAX_PARTS]; + + num = 0; + for (i = 0; i < num_partition; i++) { + if (partitions[i].type == Linux) { + items[num * 2] = partitions[i].name; + sprintf(info[num], "Linux partition with %d blocks", + partitions[i].blocks); + items[num * 2 + 1] = info[num]; + num_pa[num] = i; + num++; + } + } + ret = dialog_menu(title, prompt, y + num, x, num, num, items); + dialog_clear(); + if (ret >= 0) /* item selected */ + ret = num_pa[ret]; + return ret; +} + +static int +select_install_partition(void) +{ + return select_partition("Select Install Partition", + "\\nWhere do you want to install Linux?\\n", 9, 60); +} + +static int +select_source_partition(void) +{ + return select_partition("Select Source Partition", + "\\nOn which partition is the source?\\n", 9, 60); +} + +const char *null = ">/dev/null 2>/dev/null"; +const char *install_partition = NULL; + +static void +extract_packages(const char *source_path) +{ +#ifndef DEBUG_THIS + FILE *f; +#endif + + if (my_system("mkdir -p /install/var/installed/packages %s", null)) + return; + if (my_system("cd /install; for i in /source%s/*.tgz; do " + "tar xzplvvkf $i >> var/installed/packages/base " + "2>>var/installed/packages/ERROR; done", source_path)) + return; +#ifndef DEBUG_THIS + if ((f = fopen("/install/etc/fstab", "w")) == NULL) { + /* i = */ dialog_msgbox("Error", "Cannot write /etc/fstab", + 12, 40, 1); + return; + } + fprintf(f, "%s / ext2 defaults 1 1\n", install_partition); + fprintf(f, "none /proc proc defaults 0 2\n"); + /* XXX write swap-partitions */ + fclose(f); +#endif +} + +static void +install_premounted(void) +{ + extract_packages(""); +} + +static void +install_harddisk(void) +{ + const char *name; + int part, ret; + + if ((part = select_source_partition()) <= -1) + return; + name = partitions[part].name; + + if (my_system("mount -t ext2 %s /source %s", name, null)) + return; + ret = dialog_inputbox("Path in partition", + "Please enter the directory in which the " + "source files are.", 13, 50, "", FALSE); + dialog_clear(); + if (ret != 0) + return; + /* XXX strdup */ + extract_packages(strdup(dialog_input_result)); + if (my_system("umount /source %s", null)) + return; +} + +static void +install_nfs(void) +{ + if (my_system("ifconfig eth0 134.96.81.36 netmask 255.255.255.224 " + "broadcast 134.96.81.63 %s", null)) + return; + if (my_system("route add -net 134.96.81.32 %s", null)) + return; + if (my_system("mount -t nfs 134.96.81.38:" + "/local/ftp/pub/linux/ELF.binary/tar /source %s", null)) + return; + extract_packages("/base"); + if (my_system("umount /source %s", null)) + return; + if (my_system("ifconfig eth0 down %s", null)) + return; +} + +static void +main_install(void) +{ + int part, ret; + const char *name; + char *items1[] = + { + "1", "Harddisk Install", + "2", "Network Install(NFS)", + "3", "Premounted on /source" + }; + + if (num_linux == 0) { + /* XXX */ + return; + } + if ((part = select_install_partition()) <= -1) + return; + install_partition = name = partitions[part].name; + if (my_system("mke2fs %s %s", name, null)) + return; + if (my_system("mount -t ext2 %s /install %s", name, null)) + return; + ret = dialog_menu("Choose install medium", + "\\nPlease say from where you want to install.\\n", + 12, 62, 3, 3, items1); + dialog_clear(); + switch (ret) { + case 0: + install_harddisk(); + break; + case 1: + install_nfs(); + break; + case 2: + install_premounted(); + break; + case -2: /* cancel */ + case -1: + break; /* esc */ + } + if (my_system("umount /install %s", null)) + return; +} + +int +main(int argc, char **argv) +{ + int stop = 0; + int ret; + char *items1[] = + { + "1", "Display a help text", + "2", "Start an installation", + "3", "Exit to the shell" + }; + + progname = argv[0]; + + read_partitions(); + if (num_linux == 0) { + printf("\n\nPlease start \"fdisk\" or \"cfdisk\" and create a" + "\nnative Linux-partition to install Linux on.\n\n"); + exit(1); + } + + init_dialog(); + + while (!stop) { + ret = dialog_menu("Linux Install Utility", + "\\nCopyright (C) 1995 Florian La Roche\\n" + "\\nPre-Alpha version, be careful, read the doc!!!" + "\\nemail: florian@jurix.jura.uni-sb.de, " + "flla@stud.uni-sb.de\\n", + 15, 64, 3, 3, items1); + dialog_clear(); + switch (ret) { + case 0: + ret = dialog_textbox("Help Text", + "setup.help", 20, 70); + dialog_clear(); + break; + case 1: + main_install(); + break; + case 2: + stop = 1; + break; + case -2: /* cancel */ + case -1: + stop = 1; /* esc */ + } + } + end_dialog(); + printf("\nExecute \"reboot\" to restart your computer...\n"); + + exit(0); +} diff --git a/contrib/dialog/samples/install/setup.help b/contrib/dialog/samples/install/setup.help new file mode 100644 index 0000000..7ac8369 --- /dev/null +++ b/contrib/dialog/samples/install/setup.help @@ -0,0 +1,49 @@ +At the moment, only installation from a harddisk +is supported. All commands are shown to you on +the screen before executing. This is just to make +sure that nothing bad is done to your harddisk :-) + +You can also select to install from a premounted dir. +Then the "tar/base" directory must be mounted on +"/install", so that all tar-packages from the basic +stuff are in "/install/*.tgz". (So you could be able +to install via NFS...) + +Good luck..., +anyone wants to help programming this tool?, + +Florian La Roche + +Contents: +========= +- overview about what "setup" does. +- creating a Linux-partition before starting "setup" +- about lilo +- how to use "setup", what keys are supported + +What does "setup" do on my computer? +==================================== +Setup will ask you for a partition on your harddisk, +where you would like to have Linux installed. +You can then choose to install this distribution from +your local harddisk or via network (NFS). +setup will install a very basic system. +At the end, you can install lilo, the Linux Loader. +Rebooting your computer with this little linux system +and then runing the setup-program on it, will give +the possibility to install more packages. + +Creating a Linux-partition: +=========================== +To install this Linux distribution, you need to +create an extra partition on your harddisk for +Linux. + +What is lilo and how should I install it? +========================================= +Read the lilo-documentation for this... + + + +Florian La Roche + diff --git a/contrib/dialog/samples/killall b/contrib/dialog/samples/killall new file mode 100755 index 0000000..9d233f0 --- /dev/null +++ b/contrib/dialog/samples/killall @@ -0,0 +1,13 @@ +#! /bin/sh +# $Id: killall,v 1.2 2004/09/17 19:56:18 tom Exp $ +# Linux has a program that does this correctly. +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 -1 $pid || \ + kill -15 $pid || \ + kill -9 $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/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/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-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/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/report-button b/contrib/dialog/samples/report-button new file mode 100644 index 0000000..e13b03a --- /dev/null +++ b/contrib/dialog/samples/report-button @@ -0,0 +1,20 @@ +# $Id: report-button,v 1.2 2010/01/13 09:59:14 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..f17b6d3 --- /dev/null +++ b/contrib/dialog/samples/report-edit @@ -0,0 +1,22 @@ +# $Id: report-edit,v 1.3 2010/01/13 09:59:43 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..a674517 --- /dev/null +++ b/contrib/dialog/samples/report-string @@ -0,0 +1,23 @@ +# $Id: report-string,v 1.2 2010/01/13 10:00:11 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..5a88d44 --- /dev/null +++ b/contrib/dialog/samples/report-tempfile @@ -0,0 +1,23 @@ +# $Id: report-tempfile,v 1.3 2010/01/13 09:59:05 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.";; + $DIALOG_EXTRA) + echo "Extra button pressed.";; + $DIALOG_ITEM_HELP) + echo "Item-help button pressed.";; + $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..81da89b --- /dev/null +++ b/contrib/dialog/samples/report-yesno @@ -0,0 +1,20 @@ +# $Id: report-yesno,v 1.1 2010/01/13 10:40:14 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..df86297 --- /dev/null +++ b/contrib/dialog/samples/setup-edit @@ -0,0 +1,6 @@ +# $Id: setup-edit,v 1.1 2010/01/13 01:56:07 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" 0 1 2 5 15 diff --git a/contrib/dialog/samples/setup-tempfile b/contrib/dialog/samples/setup-tempfile new file mode 100644 index 0000000..6db551f --- /dev/null +++ b/contrib/dialog/samples/setup-tempfile @@ -0,0 +1,5 @@ +# $Id: setup-tempfile,v 1.1 2010/01/13 01:41:02 tom Exp $ +# vile:shmode + +tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$ +trap "rm -f $tempfile" 0 1 2 5 15 diff --git a/contrib/dialog/samples/setup-utf8 b/contrib/dialog/samples/setup-utf8 new file mode 100644 index 0000000..2fd70d4 --- /dev/null +++ b/contrib/dialog/samples/setup-utf8 @@ -0,0 +1,11 @@ +# $Id: setup-utf8,v 1.1 2010/01/13 01:51:44 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..cf79353 --- /dev/null +++ b/contrib/dialog/samples/setup-vars @@ -0,0 +1,11 @@ +# $Id: setup-vars,v 1.1 2010/01/13 00:16:38 tom Exp $ +# vile:shmode + +: ${DIALOG=dialog} + +: ${DIALOG_OK=0} +: ${DIALOG_CANCEL=1} +: ${DIALOG_HELP=2} +: ${DIALOG_EXTRA=3} +: ${DIALOG_ITEM_HELP=4} +: ${DIALOG_ESC=255} diff --git a/contrib/dialog/samples/slackware.rc b/contrib/dialog/samples/slackware.rc new file mode 100644 index 0000000..9942db6 --- /dev/null +++ b/contrib/dialog/samples/slackware.rc @@ -0,0 +1,124 @@ +# $Id: slackware.rc,v 1.6 2005/12/01 01:20:16 tom Exp $ +# 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 = (BLACK,CYAN,OFF) + +# Active button key color +button_key_active_color = (WHITE,BLUE,ON) + +# Inactive button key color +button_key_inactive_color = (RED,CYAN,OFF) + +# Active button label color +button_label_active_color = (WHITE,BLUE,ON) + +# 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 = (CYAN,CYAN,ON) + +# Search box color +searchbox_color = (YELLOW,WHITE,ON) + +# Search box title color +# FIXME +searchbox_title_color = (WHITE,WHITE,ON) + +# Search box border color +searchbox_border_color = (RED,WHITE,OFF) + +# File position indicator color +position_indicator_color = (RED,CYAN,OFF) + +# Menu box color +menubox_color = (BLACK,CYAN,OFF) + +# Menu box border color +menubox_border_color = (CYAN,CYAN,ON) + +# Item color +item_color = (BLACK,CYAN,OFF) + +# Selected item color +item_selected_color = (WHITE,BLUE,OFF) + +# Tag color +tag_color = (YELLOW,CYAN,ON) + +# Selected tag color +tag_selected_color = (WHITE,BLUE,OFF) + +# Tag key color +tag_key_color = (RED,CYAN,OFF) + +# Selected tag key color +tag_key_selected_color = (RED,BLUE,ON) + +# Check box color +check_color = (BLACK,CYAN,OFF) + +# Selected check box color +check_selected_color = (WHITE,CYAN,ON) + +# Up arrow color +uarrow_color = (GREEN,CYAN,ON) + +# Down arrow color +darrow_color = (GREEN,CYAN,ON) + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = (BLUE,WHITE,OFF) + +# Form text color +form_text_color = (CYAN,BLUE,ON) diff --git a/contrib/dialog/samples/sourcemage.rc b/contrib/dialog/samples/sourcemage.rc new file mode 100644 index 0000000..bf187ea --- /dev/null +++ b/contrib/dialog/samples/sourcemage.rc @@ -0,0 +1,123 @@ +# $Id: sourcemage.rc,v 1.3 2005/12/01 01:20:45 tom Exp $ +# 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 = (BLACK,WHITE,OFF) + +# Active button key color +button_key_active_color = (WHITE,RED,ON) + +# 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 = (BLACK,WHITE,OFF) + +# Input box border color +inputbox_border_color = (BLACK,WHITE,OFF) + +# Search box color +searchbox_color = (BLACK,WHITE,OFF) + +# Search box title color +searchbox_title_color = (RED,WHITE,ON) + +# Search box border color +searchbox_border_color = (WHITE,WHITE,ON) + +# File position indicator color +position_indicator_color = (RED,WHITE,ON) + +# Menu box color +menubox_color = (BLACK,WHITE,OFF) + +# Menu box border color +menubox_border_color = (WHITE,WHITE,ON) + +# Item color +item_color = (BLACK,WHITE,OFF) + +# Selected item color +item_selected_color = (WHITE,RED,ON) + +# Tag color +tag_color = (RED,WHITE,ON) + +# Selected tag color +tag_selected_color = (RED,RED,ON) + +# Tag key color +tag_key_color = (RED,WHITE,ON) + +# Selected tag key color +tag_key_selected_color = (WHITE,RED,ON) + +# Check box color +check_color = (BLACK,WHITE,OFF) + +# Selected check box color +check_selected_color = (WHITE,RED,ON) + +# Up arrow color +uarrow_color = (RED,WHITE,ON) + +# Down arrow color +darrow_color = (RED,WHITE,ON) + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = (BLACK,WHITE,OFF) + +# Form text color +form_text_color = (RED,BLACK,ON) diff --git a/contrib/dialog/samples/suse.rc b/contrib/dialog/samples/suse.rc new file mode 100644 index 0000000..233157d --- /dev/null +++ b/contrib/dialog/samples/suse.rc @@ -0,0 +1,126 @@ +# $Id: suse.rc,v 1.2 2007/02/25 17:49:12 tom Exp $ +# 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 = (BLACK,WHITE,OFF) + +# Active button key color +button_key_active_color = (WHITE,BLUE,ON) + +# 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 = (BLACK,WHITE,OFF) + +# Input box border color +inputbox_border_color = (BLACK,WHITE,OFF) + +# Search box color +searchbox_color = (BLACK,WHITE,OFF) + +# Search box title color +searchbox_title_color = (YELLOW,WHITE,ON) + +# Search box border color +searchbox_border_color = (WHITE,WHITE,ON) + +# File position indicator color +position_indicator_color = (YELLOW,WHITE,ON) + +# Menu box color +menubox_color = (BLACK,WHITE,OFF) + +# Menu box border color +menubox_border_color = (WHITE,WHITE,ON) + +# Item color +item_color = (BLACK,WHITE,OFF) + +# Selected item color +item_selected_color = (WHITE,BLUE,ON) + +# Tag color +tag_color = (YELLOW,WHITE,ON) + +# Selected tag color +tag_selected_color = (YELLOW,BLUE,ON) + +# Tag key color +tag_key_color = (RED,WHITE,OFF) + +# Selected tag key color +tag_key_selected_color = (RED,BLUE,ON) + +# Check box color +check_color = (BLACK,WHITE,OFF) + +# Selected check box color +check_selected_color = (WHITE,BLUE,ON) + +# Up arrow color +uarrow_color = (GREEN,WHITE,ON) + +# Down arrow color +darrow_color = (GREEN,WHITE,ON) + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = (WHITE,BLUE,ON) + +# Form text color +form_text_color = (WHITE,CYAN,ON) + +# Readonly form item color +form_item_readonly_color = (CYAN,WHITE,ON) 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..957d774 --- /dev/null +++ b/contrib/dialog/samples/tailboxbg @@ -0,0 +1,22 @@ +#!/bin/sh +# $Id: tailboxbg,v 1.9 2010/01/13 10:20:03 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 -3 `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..2955ad0 --- /dev/null +++ b/contrib/dialog/samples/tailboxbg1 @@ -0,0 +1,32 @@ +#!/bin/sh +# $Id: tailboxbg1,v 1.9 2010/01/13 10:20:03 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 -3 $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..0617708 --- /dev/null +++ b/contrib/dialog/samples/tailboxbg2 @@ -0,0 +1,33 @@ +#!/bin/sh +# $Id: tailboxbg2,v 1.9 2010/01/13 10:20:03 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 -3 $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..7810f9e --- /dev/null +++ b/contrib/dialog/samples/testdata-8bit @@ -0,0 +1,39 @@ +#!/bin/sh +# $Id: testdata-8bit,v 1.1 2004/12/19 16:19:12 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 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.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/wheel b/contrib/dialog/samples/wheel new file mode 100755 index 0000000..ff75f71 --- /dev/null +++ b/contrib/dialog/samples/wheel @@ -0,0 +1,64 @@ +#!/bin/sh +# $Id: wheel,v 1.7 2010/01/13 01:44:12 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() { + echo $[$1*$COLS/132] +} +scaley() { + echo $[$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..47d5032 --- /dev/null +++ b/contrib/dialog/samples/whiptail.rc @@ -0,0 +1,116 @@ +# $Id: whiptail.rc,v 1.2 2005/12/01 01:21:31 tom Exp $ +# Run-time configuration file for dialog, matches whiptail's color scheme. + +# 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 = (BLACK,WHITE,OFF) + +# Active button key color +button_key_active_color = (WHITE,RED,ON) + +# Inactive button key color +button_key_inactive_color = (BLACK,WHITE,OFF) + +# Active button label color +button_label_active_color = (WHITE,RED,ON) + +# Inactive button label color +button_label_inactive_color = (BLACK,WHITE,ON) + +# Input box color +inputbox_color = (BLACK,WHITE,OFF) + +# Input box border color +inputbox_border_color = (BLACK,WHITE,OFF) + +# Search box color +searchbox_color = (BLACK,WHITE,OFF) + +# Search box title color +searchbox_title_color = (RED,WHITE,ON) + +# Search box border color +searchbox_border_color = (WHITE,WHITE,ON) + +# File position indicator color +position_indicator_color = (RED,WHITE,ON) + +# Menu box color +menubox_color = (YELLOW,BLUE,OFF) + +# Menu box border color +menubox_border_color = (YELLOW,BLUE,ON) + +# Item color +item_color = (YELLOW,BLUE,OFF) + +# Selected item color +item_selected_color = (YELLOW,BLUE,ON) + +# Tag color +tag_color = (YELLOW,BLUE,ON) + +# Selected tag color +tag_selected_color = (YELLOW,BLUE,ON) + +# Tag key color +tag_key_color = (YELLOW,BLUE,OFF) + +# Selected tag key color +tag_key_selected_color = (WHITE,BLUE,ON) + +# Check box color +check_color = (YELLOW,BLUE,OFF) + +# Selected check box color +check_selected_color = (YELLOW,BLUE,ON) + +# Up arrow color +uarrow_color = (YELLOW,BLUE,ON) + +# Down arrow color +darrow_color = (YELLOW,BLUE,ON) + +# Item help-text color +itemhelp_color = (WHITE,BLACK,OFF) + +# Active form text color +form_active_text_color = (WHITE,BLUE,ON) + +# Form text color +form_text_color = (WHITE,CYAN,ON) 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 |