summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-11-02 01:41:52 +0000
committerache <ache@FreeBSD.org>1994-11-02 01:41:52 +0000
commit08d6168872f2417e5666243ce4ea5c6abb7bcf4b (patch)
treec4afa6ceb55f3c823559f59fcf7d2252f56e167f /gnu
parent96d73d00f3a20f9bd26a7b104fb5c7aafc973c3d (diff)
downloadFreeBSD-src-08d6168872f2417e5666243ce4ea5c6abb7bcf4b.zip
FreeBSD-src-08d6168872f2417e5666243ce4ea5c6abb7bcf4b.tar.gz
Enhance inputbox to pass initial prompt (optional)
Diffstat (limited to 'gnu')
-rwxr-xr-xgnu/usr.bin/dialog/TESTS/inputbox2
-rw-r--r--gnu/usr.bin/dialog/dialog.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/gnu/usr.bin/dialog/TESTS/inputbox b/gnu/usr.bin/dialog/TESTS/inputbox
index 902798f..6e1e33a 100755
--- a/gnu/usr.bin/dialog/TESTS/inputbox
+++ b/gnu/usr.bin/dialog/TESTS/inputbox
@@ -10,7 +10,7 @@ width of the input box, in that case, the \n\
input field will be automatically scrolled. \n\
You can use BACKSPACE, LEFT, RIGHT, HOME, END \n\
to correct errors. \n\n\
-Try inputing your name below:" 16 51 2> /tmp/inputbox.tmp.$$
+Try inputing your name below:" 16 51 "John Smith" 2> /tmp/inputbox.tmp.$$
retval=$?
diff --git a/gnu/usr.bin/dialog/dialog.c b/gnu/usr.bin/dialog/dialog.c
index ead70f0..bc4edad 100644
--- a/gnu/usr.bin/dialog/dialog.c
+++ b/gnu/usr.bin/dialog/dialog.c
@@ -289,10 +289,14 @@ int main(int argc, unsigned char *argv[])
return retval;
}
else if (!strcmp(argv[offset+1], "--inputbox")) {
- if (argc-offset != 5) {
+ if (argc-offset != 5 && argc-offset != 6) {
Usage(argv[0]);
exit(-1);
}
+ if (argc-offset == 6)
+ strcpy(result, argv[offset+5]);
+ else
+ *result = '\0';
init_dialog();
retval = dialog_inputbox(title, argv[offset+2], atoi(argv[offset+3]),
atoi(argv[offset+4]), result);
@@ -333,7 +337,7 @@ void Usage(unsigned char *name)
\n --msgbox <text> <height> <width>\
\n --prgbox \"<command line>\" <height> <width>\
\n --infobox <text> <height> <width>\
-\n --inputbox <text> <height> <width>\
+\n --inputbox <text> <height> <width> [<init string>]\
\n --textbox <file> <height> <width>\
\n --menu <text> <height> <width> <menu height> <tag1> <item1>...\
\n --checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...\
OpenPOWER on IntegriCloud