summaryrefslogtreecommitdiff
path: root/gnu/lib/libdialog/msgbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/lib/libdialog/msgbox.c')
-rw-r--r--gnu/lib/libdialog/msgbox.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/lib/libdialog/msgbox.c b/gnu/lib/libdialog/msgbox.c
index e405f3b5a26a..fda3b40641a9 100644
--- a/gnu/lib/libdialog/msgbox.c
+++ b/gnu/lib/libdialog/msgbox.c
@@ -29,9 +29,17 @@
*/
int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int width, int pause)
{
- int i, x, y, key = 0;
+ int i, j, x, y, key = 0;
WINDOW *dialog;
+ if (height < 0)
+ height = strheight(prompt)+2+2*(!!pause);
+ 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;