aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lxdialog/msgbox.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2005-11-19 17:38:06 -0500
committerSam Ravnborg <sam@mars.ravnborg.org>2005-11-19 17:38:06 -0500
commitfa7009d5b59b8acd8071f7b3057d36eeeaf08146 (patch)
treeba88e9f448aed4c047d8ce311ba44c8731ee96c2 /scripts/lxdialog/msgbox.c
parenta06104af7dcf2f5bafaf18f373c8b2554cbfe014 (diff)
kconfig: Add print_title helper in lxdialog
Simplify check for long title and use a helper function in util.c Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/lxdialog/msgbox.c')
-rw-r--r--scripts/lxdialog/msgbox.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/scripts/lxdialog/msgbox.c b/scripts/lxdialog/msgbox.c
index b39405717da..7323f5471f6 100644
--- a/scripts/lxdialog/msgbox.c
+++ b/scripts/lxdialog/msgbox.c
@@ -42,20 +42,8 @@ int dialog_msgbox(const char *title, const char *prompt, int height, int width,
42 42
43 draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); 43 draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
44 44
45 if (title != NULL && strlen(title) >= width - 2) { 45 print_title(dialog, title, width);
46 /* truncate long title -- mec */
47 char *title2 = malloc(width - 2 + 1);
48 memcpy(title2, title, width - 2);
49 title2[width - 2] = '\0';
50 title = title2;
51 }
52 46
53 if (title != NULL) {
54 wattrset(dialog, title_attr);
55 mvwaddch(dialog, 0, (width - strlen(title)) / 2 - 1, ' ');
56 waddstr(dialog, (char *)title);
57 waddch(dialog, ' ');
58 }
59 wattrset(dialog, dialog_attr); 47 wattrset(dialog, dialog_attr);
60 print_autowrap(dialog, prompt, width - 2, 1, 2); 48 print_autowrap(dialog, prompt, width - 2, 1, 2);
61 49