Implement --hline "line" and --hfile file

This commit is contained in:
Andrey A. Chernov 1995-02-23 22:42:44 +00:00
parent fdcf149868
commit e6c16d383f
4 changed files with 52 additions and 5 deletions

View File

@ -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\

View File

@ -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 \

View File

@ -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

View File

@ -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\