From 734d3eaf7182b509127093faf34d45c927841348 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Wed, 2 Nov 1994 01:41:52 +0000 Subject: [PATCH] Enhance inputbox to pass initial prompt (optional) --- gnu/usr.bin/dialog/TESTS/inputbox | 2 +- gnu/usr.bin/dialog/dialog.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gnu/usr.bin/dialog/TESTS/inputbox b/gnu/usr.bin/dialog/TESTS/inputbox index 902798f0f584..6e1e33a3c01b 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 ead70f0f3dd3..bc4edad7fa03 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 \ \n --prgbox \"\" \ \n --infobox \ -\n --inputbox \ +\n --inputbox []\ \n --textbox \ \n --menu ...\ \n --checklist ...\