summaryrefslogtreecommitdiff
path: root/gnu/lib/libdialog/inputbox.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1994-11-16 14:37:37 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1994-11-16 14:37:37 +0000
commit5f5d7caab1c5b509d30df5bd914f2b15998fca65 (patch)
tree6d42ce10ce8c7263feab1c0a86525a16826ae40e /gnu/lib/libdialog/inputbox.c
parent0066ef2281a7155ad3416190995f8398372b0816 (diff)
Notes
Diffstat (limited to 'gnu/lib/libdialog/inputbox.c')
-rw-r--r--gnu/lib/libdialog/inputbox.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/lib/libdialog/inputbox.c b/gnu/lib/libdialog/inputbox.c
index 197b4dfaedf7..11e3566580e3 100644
--- a/gnu/lib/libdialog/inputbox.c
+++ b/gnu/lib/libdialog/inputbox.c
@@ -28,11 +28,19 @@
*/
int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int width, unsigned char *result)
{
- int i, x, y, box_y, box_x, box_width, first,
+ int i, j, x, y, box_y, box_x, box_width, first,
key = 0, button = -1;
unsigned char instr[MAX_LEN+1];
WINDOW *dialog;
+ if (height < 0)
+ height = strheight(prompt)+2+4;
+ if (width < 0) {
+ i = strwidth(prompt);
+ j = strwidth(title);
+ width = MAX(i,j) + 4;
+ }
+
/* center dialog box on screen */
x = (COLS - width)/2;
y = (LINES - height)/2;