diff options
author | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-11-19 17:38:06 -0500 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2005-11-19 17:38:06 -0500 |
commit | fa7009d5b59b8acd8071f7b3057d36eeeaf08146 (patch) | |
tree | ba88e9f448aed4c047d8ce311ba44c8731ee96c2 /scripts/lxdialog/yesno.c | |
parent | a06104af7dcf2f5bafaf18f373c8b2554cbfe014 (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/yesno.c')
-rw-r--r-- | scripts/lxdialog/yesno.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/scripts/lxdialog/yesno.c b/scripts/lxdialog/yesno.c index 84f3e8e005e4..cb2568aae3ed 100644 --- a/scripts/lxdialog/yesno.c +++ b/scripts/lxdialog/yesno.c | |||
@@ -61,20 +61,7 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) | |||
61 | wattrset(dialog, dialog_attr); | 61 | wattrset(dialog, dialog_attr); |
62 | waddch(dialog, ACS_RTEE); | 62 | waddch(dialog, ACS_RTEE); |
63 | 63 | ||
64 | if (title != NULL && strlen(title) >= width - 2) { | 64 | print_title(dialog, title, width); |
65 | /* truncate long title -- mec */ | ||
66 | char *title2 = malloc(width - 2 + 1); | ||
67 | memcpy(title2, title, width - 2); | ||
68 | title2[width - 2] = '\0'; | ||
69 | title = title2; | ||
70 | } | ||
71 | |||
72 | if (title != NULL) { | ||
73 | wattrset(dialog, title_attr); | ||
74 | mvwaddch(dialog, 0, (width - strlen(title)) / 2 - 1, ' '); | ||
75 | waddstr(dialog, (char *)title); | ||
76 | waddch(dialog, ' '); | ||
77 | } | ||
78 | 65 | ||
79 | wattrset(dialog, dialog_attr); | 66 | wattrset(dialog, dialog_attr); |
80 | print_autowrap(dialog, prompt, width - 2, 1, 3); | 67 | print_autowrap(dialog, prompt, width - 2, 1, 3); |