summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2004-02-03 17:52:21 +0000
committerhpa <hpa>2004-02-03 17:52:21 +0000
commit8748e73a7428094d60f72bfb3cfe05e299854bae (patch)
tree01a54ae8c3b5fb035296ca68f6eed1939432ea2f
parent587dd00cdbbca5b7a0754366acb29431284d299b (diff)
downloadsyslinux-8748e73a7428094d60f72bfb3cfe05e299854bae.tar.gz
Handle menu width properlysyslinux-2.09-pre6
-rw-r--r--menu/menu.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/menu/menu.c b/menu/menu.c
index 26d6b17f..e786b924 100644
--- a/menu/menu.c
+++ b/menu/menu.c
@@ -338,23 +338,25 @@ void unreg_handler()
int add_menu(const char *title) // Create a new menu and return its position
{
- const int num = (unsigned char)menusystem.nummenus;
+ t_menu *m;
- if (num >= MAXMENUS) return -1;
- menusystem.menus[num].numitems = 0;
- menusystem.menus[num].menuwidth = 0;
- if (title)
- {
+ if (menusystem.nummenus >= MAXMENUS)
+ return -1;
+
+ m = &menusystem.menus[(unsigned int)menusystem.nummenus];
+
+ m->numitems = 0;
+ if (title) {
if (strlen(title) > MENULEN - 2) {
- strcpy(menusystem.menus[num].title," TITLE TOO LONG ");
+ strcpy(m->title," TITLE TOO LONG ");
} else {
- strcpy(menusystem.menus[num].title,title);
+ strcpy(m->title,title);
}
+ } else {
+ strcpy(m->title,"");
}
- else
- {
- strcpy(menusystem.menus[num].title,"");
- }
+
+ m->menuwidth = strlen(m->title);
return menusystem.nummenus++;
}