summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-02-23 22:42:44 +0000
committerache <ache@FreeBSD.org>1995-02-23 22:42:44 +0000
commit53a0d9e088063a53a4fb93f7892634c49846c6d3 (patch)
tree4eb67899cf82067280d1fbe945a23a722c2599c3 /gnu
parente062767a522d941f0c5c2e0e4f60087cf9247105 (diff)
downloadFreeBSD-src-53a0d9e088063a53a4fb93f7892634c49846c6d3.zip
FreeBSD-src-53a0d9e088063a53a4fb93f7892634c49846c6d3.tar.gz
Implement --hline "line" and --hfile file
Diffstat (limited to 'gnu')
-rwxr-xr-xgnu/usr.bin/dialog/TESTS/menubox1
-rwxr-xr-xgnu/usr.bin/dialog/TESTS/yesno2
-rw-r--r--gnu/usr.bin/dialog/dialog.127
-rw-r--r--gnu/usr.bin/dialog/dialog.c27
4 files changed, 52 insertions, 5 deletions
diff --git a/gnu/usr.bin/dialog/TESTS/menubox b/gnu/usr.bin/dialog/TESTS/menubox
index 0309dd5..f5d4e92 100755
--- a/gnu/usr.bin/dialog/TESTS/menubox
+++ b/gnu/usr.bin/dialog/TESTS/menubox
@@ -2,6 +2,7 @@
DIALOG=${DIALOG=/usr/bin/dialog}
$DIALOG --clear --title "MENU BOX" \
+ --hline "Press 1-9, Up/Down, first letter or Enter" \
--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\
diff --git a/gnu/usr.bin/dialog/TESTS/yesno b/gnu/usr.bin/dialog/TESTS/yesno
index 2282893..36e95c8 100755
--- a/gnu/usr.bin/dialog/TESTS/yesno
+++ b/gnu/usr.bin/dialog/TESTS/yesno
@@ -2,6 +2,8 @@
DIALOG=${DIALOG=/usr/bin/dialog}
$DIALOG --title "YES/NO BOX" --clear \
+ --hline "Press F1 or ? to see GNU GPL" \
+ --hfile ../COPYING \
--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 \
diff --git a/gnu/usr.bin/dialog/dialog.1 b/gnu/usr.bin/dialog/dialog.1
index 3ab1119..82495c9 100644
--- a/gnu/usr.bin/dialog/dialog.1
+++ b/gnu/usr.bin/dialog/dialog.1
@@ -8,12 +8,17 @@ dialog \- display dialog boxes from shell scripts
.br
.B dialog
[
-.B \-\-title
-.I title
+.BI "\-\-title " title
]
[
.B \-\-clear
]
+[
+.BI "\-\-hline " line
+]
+[
+.BI "\-\-hfile " file
+]
.B box-options
.SH DESCRIPTION
.B Dialog
@@ -22,8 +27,8 @@ display messages using dialog boxes from a shell script. Currently,
these types of dialog boxes are implemented:
.LP
.BR yes/no " box," " menu" " box," " input" " box,"
-.BR message " box," " text" " box," " info" " box, and"
-.BR checklist " box."
+.BR message " box," " text" " box," " info" " box,"
+.BR checklist " box and" " program" " box."
.SH OPTIONS
.TP
.B \-\-clear
@@ -41,6 +46,16 @@ Specifies a
.I title
string to be displayed at the top of the dialog box.
.TP
+.BI \-\-hline " line"
+Specifies a
+.I line
+string to be displayed at the bottom of the dialog box.
+.TP
+.BI \-\-hfile " file"
+Specifies a
+.I file
+to be displayed by pressing ? or F1.
+.TP
.B Box Options
.TP
.BI \-\-yesno " text height width"
@@ -139,6 +154,10 @@ exits, the
.I tag
of the chosen menu entry will be printed on
.IR stderr "."
+.TP
+.BI \-\-prgbox " command height width"
+.RB A " program" " box lets you display output of command in"
+dialog box.
.IP "\fB\-\-checklist \fItext height width list-height \fR[ \fItag item status \fR] \fI..."
.RB "A " checklist " box is similar to a " menu " box in that there are"
multiple entries presented in the form of a menu. Instead of choosing
diff --git a/gnu/usr.bin/dialog/dialog.c b/gnu/usr.bin/dialog/dialog.c
index 060ad75..3056f1e 100644
--- a/gnu/usr.bin/dialog/dialog.c
+++ b/gnu/usr.bin/dialog/dialog.c
@@ -90,6 +90,7 @@ int main(int argc, unsigned char *argv[])
int offset = 0, clear_screen = 0, end_common_opts = 0, retval;
unsigned char *title = NULL;
unsigned char result[MAX_LEN];
+ char *hline = NULL, *hfile = NULL;
if (argc < 2) {
Usage(argv[0]);
@@ -120,6 +121,28 @@ int main(int argc, unsigned char *argv[])
offset += 2;
}
}
+ else if (!strcmp(argv[offset+1], "--hline")) {
+ if (argc-offset < 3 || hline != NULL) { /* No two "--hline" please! */
+ Usage(argv[0]);
+ exit(-1);
+ }
+ else {
+ hline = argv[offset+2];
+ use_helpline(hline);
+ offset += 2;
+ }
+ }
+ else if (!strcmp(argv[offset+1], "--hfile")) {
+ if (argc-offset < 3 || hfile != NULL) { /* No two "--hfile" please! */
+ Usage(argv[0]);
+ exit(-1);
+ }
+ else {
+ hfile = argv[offset+2];
+ use_helpfile(hfile);
+ offset += 2;
+ }
+ }
else if (!strcmp(argv[offset+1], "--clear")) {
if (clear_screen) { /* Hey, "--clear" can't appear twice! */
Usage(argv[0]);
@@ -325,12 +348,14 @@ void Usage(unsigned char *name)
fprintf(stderr, "\
\ndialog version 0.3, by Savio Lam (lam836@cs.cuhk.hk).\
\n patched to version %s by Stuart Herbert (S.Herbert@shef.ac.uk)\
+\n Changes Copyright (C) 1995 by Andrey A. Chernov, Moscow, Russia\
\n\
\n* Display dialog boxes from shell scripts *\
\n\
\nUsage: %s --clear\
\n %s --create-rc <file>\
-\n %s [--title <title>] [--clear] <Box options>\
+\n %s [--title <title>] [--clear] [--hline <line>] [--hfile <file>]\\\
+\n <Box options>\
\n\
\nBox options:\
\n\
OpenPOWER on IntegriCloud