From fa7009d5b59b8acd8071f7b3057d36eeeaf08146 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sat, 19 Nov 2005 23:38:06 +0100 Subject: 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 --- scripts/lxdialog/textbox.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'scripts/lxdialog/textbox.c') diff --git a/scripts/lxdialog/textbox.c b/scripts/lxdialog/textbox.c index fa8d92ea02b6..77848bb8e07f 100644 --- a/scripts/lxdialog/textbox.c +++ b/scripts/lxdialog/textbox.c @@ -103,20 +103,8 @@ int dialog_textbox(const char *title, const char *file, int height, int width) wbkgdset(dialog, dialog_attr & A_COLOR); waddch(dialog, ACS_RTEE); - if (title != NULL && strlen(title) >= width - 2) { - /* truncate long title -- mec */ - char *title2 = malloc(width - 2 + 1); - memcpy(title2, title, width - 2); - title2[width - 2] = '\0'; - title = title2; - } + print_title(dialog, title, width); - if (title != NULL) { - wattrset(dialog, title_attr); - mvwaddch(dialog, 0, (width - strlen(title)) / 2 - 1, ' '); - waddstr(dialog, (char *)title); - waddch(dialog, ' '); - } print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); wnoutrefresh(dialog); getyx(dialog, cur_y, cur_x); /* Save cursor position */ -- cgit v1.2.2