[syslinux] [PATCH] gfxboot: allow boot entry to start with label instead of menu_label

Colin Watson cjwatson at ubuntu.com
Wed Jul 14 06:12:33 PDT 2010


menu_ptr->menu_label is human-readable (perhaps even translatable!) text
if the MENU LABEL command is used, which isn't very convenient at the
start of a boot entry.  Allow the entry to start with menu_ptr->label
(an identifier) as an alternative.

Signed-off-by: Colin Watson <cjwatson at ubuntu.com>
---
 com32/gfxboot/gfxboot.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c
index dd4d641..77a3275 100644
--- a/com32/gfxboot/gfxboot.c
+++ b/com32/gfxboot/gfxboot.c
@@ -790,7 +790,7 @@ void boot(int index)
 {
   char *arg, *alt_kernel;
   menu_t *menu_ptr;
-  int i, label_len;
+  int i, label_len, menu_label_len;
   unsigned ipapp;
   const struct syslinux_ipappend_strings *ipappend;
 
@@ -802,18 +802,22 @@ void boot(int index)
   if(!menu_ptr || !menu_ptr->menu_label) return;
 
   arg = skip_spaces(cmdline);
-  label_len = strlen(menu_ptr->menu_label);
+  label_len = strlen(menu_ptr->label);
+  menu_label_len = strlen(menu_ptr->menu_label);
 
   // if it does not start with label string, assume first word is kernel name
-  if(strncmp(arg, menu_ptr->menu_label, label_len)) {
+  if(!strncmp(arg, menu_ptr->label, label_len)) {
+    arg += label_len;
+  }
+  else if(!strncmp(arg, menu_ptr->menu_label, menu_label_len)) {
+    arg += menu_label_len;
+  }
+  else {
     alt_kernel = arg;
     arg = skip_nonspaces(arg);
     if(*arg) *arg++ = 0;
     if(*alt_kernel) menu_ptr->alt_kernel = alt_kernel;
   }
-  else {
-    arg += label_len;
-  }
 
   arg = skip_spaces(arg);
 
-- 
1.7.1




More information about the Syslinux mailing list