aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lxdialog/util.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/util.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/util.c')
-rw-r--r--scripts/lxdialog/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/lxdialog/util.c b/scripts/lxdialog/util.c
index ce411474d729..f82cebb9ff06 100644
--- a/scripts/lxdialog/util.c
+++ b/scripts/lxdialog/util.c
@@ -177,6 +177,20 @@ void end_dialog(void)
177 endwin(); 177 endwin();
178} 178}
179 179
180/* Print the title of the dialog. Center the title and truncate
181 * tile if wider than dialog (- 2 chars).
182 **/
183void print_title(WINDOW *dialog, const char *title, int width)
184{
185 if (title) {
186 int tlen = MIN(width - 2, strlen(title));
187 wattrset(dialog, title_attr);
188 mvwaddch(dialog, 0, (width - tlen) / 2 - 1, ' ');
189 mvwaddnstr(dialog, 0, (width - tlen)/2, title, tlen);
190 waddch(dialog, ' ');
191 }
192}
193
180/* 194/*
181 * Print a string of text in a window, automatically wrap around to the 195 * Print a string of text in a window, automatically wrap around to the
182 * next line if the string is too long to fit on one line. Newline 196 * next line if the string is too long to fit on one line. Newline