summaryrefslogtreecommitdiffstats
path: root/src/hci
diff options
context:
space:
mode:
authorChristian Hesse2012-07-03 15:12:47 +0200
committerMichael Brown2012-07-03 15:12:47 +0200
commitb3adabd07bcee35ced80fc8230b677e90ac50372 (patch)
tree8a03bf34f0d441cbecc7d981689386d8c136a278 /src/hci
parent[arp] Prevent ARP cache entries from being deleted mid-transmission (diff)
downloadipxe-b3adabd07bcee35ced80fc8230b677e90ac50372.tar.gz
ipxe-b3adabd07bcee35ced80fc8230b677e90ac50372.tar.xz
ipxe-b3adabd07bcee35ced80fc8230b677e90ac50372.zip
[menu] Truncate menu title when necessary
Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/tui/menu_ui.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c
index 61625622..e9250099 100644
--- a/src/hci/tui/menu_ui.c
+++ b/src/hci/tui/menu_ui.c
@@ -307,6 +307,7 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,
const char *select, struct menu_item **selected ) {
struct menu_item *item;
struct menu_ui ui;
+ char buf[ MENU_COLS + 1 /* NUL */ ];
int labelled_count = 0;
int rc;
@@ -348,8 +349,8 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,
/* Draw initial content */
attron ( A_BOLD );
- mvprintw ( TITLE_ROW, ( ( COLS - strlen ( ui.menu->title ) ) / 2 ),
- "%s", ui.menu->title );
+ snprintf ( buf, sizeof ( buf ), "%s", ui.menu->title );
+ mvprintw ( TITLE_ROW, ( ( COLS - strlen ( buf ) ) / 2 ), "%s", buf );
attroff ( A_BOLD );
draw_menu_items ( &ui );
draw_menu_item ( &ui, ui.selected );