aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lxdialog/menubox.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/menubox.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/menubox.c')
-rw-r--r--scripts/lxdialog/menubox.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c
index ff3a6179833d..ebfe6a3c8ccc 100644
--- a/scripts/lxdialog/menubox.c
+++ b/scripts/lxdialog/menubox.c
@@ -189,20 +189,7 @@ int dialog_menu(const char *title, const char *prompt, int height, int width,
189 wbkgdset(dialog, dialog_attr & A_COLOR); 189 wbkgdset(dialog, dialog_attr & A_COLOR);
190 waddch(dialog, ACS_RTEE); 190 waddch(dialog, ACS_RTEE);
191 191
192 if (title != NULL && strlen(title) >= width - 2) { 192 print_title(dialog, title, width);
193 /* truncate long title -- mec */
194 char *title2 = malloc(width - 2 + 1);
195 memcpy(title2, title, width - 2);
196 title2[width - 2] = '\0';
197 title = title2;
198 }
199
200 if (title != NULL) {
201 wattrset(dialog, title_attr);
202 mvwaddch(dialog, 0, (width - strlen(title)) / 2 - 1, ' ');
203 waddstr(dialog, (char *)title);
204 waddch(dialog, ' ');
205 }
206 193
207 wattrset(dialog, dialog_attr); 194 wattrset(dialog, dialog_attr);
208 print_autowrap(dialog, prompt, width - 2, 1, 3); 195 print_autowrap(dialog, prompt, width - 2, 1, 3);