aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-19 16:41:44 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-19 16:51:24 -0800
commit04d9aac1064ebec403d2015bfc9416987896e050 (patch)
tree258d7be8bd51e2805b6b6e8e0391ea098d588c15
parent93a9bb39ba16c67f4782621675ee3cc5edf2ad18 (diff)
downloadsyslinux-04d9aac1064ebec403d2015bfc9416987896e050.tar.gz
syslinux-04d9aac1064ebec403d2015bfc9416987896e050.tar.xz
syslinux-04d9aac1064ebec403d2015bfc9416987896e050.zip
Allow MENU LABEL <-> MENU TITLE for submenus to work both ways
Allow either "MENU LABEL" or "MENU TITLE" to default for each other.
-rw-r--r--com32/menu/menu.h1
-rw-r--r--com32/menu/menumain.c2
-rw-r--r--com32/menu/readconfig.c21
3 files changed, 16 insertions, 8 deletions
diff --git a/com32/menu/menu.h b/com32/menu/menu.h
index 99d378e5..22880230 100644
--- a/com32/menu/menu.h
+++ b/com32/menu/menu.h
@@ -147,6 +147,7 @@ struct menu {
int allowedit;
int timeout;
+ const char *title;
const char *ontimeout;
const char *onerror;
const char *menu_master_passwd;
diff --git a/com32/menu/menumain.c b/com32/menu/menumain.c
index fb6a99f9..9058efb1 100644
--- a/com32/menu/menumain.c
+++ b/com32/menu/menumain.c
@@ -297,7 +297,7 @@ draw_menu(int sel, int top, int edit_line)
printf("k\033[%d;%dH\1#1x\017\1#2 %s \1#1\016x",
VSHIFT+2,
HSHIFT+MARGIN+1,
- pad_line(cm->messages[MSG_TITLE], 1, WIDTH-2*MARGIN-4));
+ pad_line(cm->title, 1, WIDTH-2*MARGIN-4));
printf("\033[%d;%dH\1#1t", VSHIFT+3, HSHIFT+MARGIN+1);
for ( x = 2+HSHIFT ; x <= (WIDTH-2*MARGIN-1)+HSHIFT ; x++ )
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index e94fddfe..3bbca3be 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -38,7 +38,6 @@ static struct menu_entry *all_entries;
static struct menu_entry **all_entries_end = &all_entries;
static const struct messages messages[MSG_COUNT] = {
- [MSG_TITLE] = { "title", "" },
[MSG_AUTOBOOT] = { "autoboot", "Automatic boot in # second{,s}..." },
[MSG_TAB] = { "tabmsg", "Press [Tab] to edit options" },
[MSG_NOTAB] = { "notabmsg", "" },
@@ -132,14 +131,12 @@ static struct menu * new_menu(struct menu *parent,
for (i = 0; i < MSG_COUNT; i++)
m->messages[i] = refstr_get(parent->messages[i]);
- refstr_put(m->messages[MSG_TITLE]);
- m->messages[MSG_TITLE] = refstr_get(empty_string);
-
memcpy(m->mparm, parent->mparm, sizeof m->mparm);
m->allowedit = parent->allowedit;
m->timeout = parent->timeout;
+ m->title = refstr_get(empty_string);
m->ontimeout = refstr_get(parent->ontimeout);
m->onerror = refstr_get(parent->onerror);
m->menu_master_passwd = refstr_get(parent->menu_master_passwd);
@@ -569,10 +566,20 @@ static void parse_config_file(FILE *f)
refstr_put(m->parent_entry->displayname);
m->parent_entry->displayname = refstrdup(skipspace(p+5));
consider_for_hotkey(m, m->parent_entry);
- if (!m->messages[MSG_TITLE][0]) {
+ if (!m->title[0]) {
/* MENU LABEL -> MENU TITLE on submenu */
- refstr_put(m->messages[MSG_TITLE]);
- m->messages[MSG_TITLE] = refstr_get(m->parent_entry->displayname);
+ refstr_put(m->title);
+ m->title = refstr_get(m->parent_entry->displayname);
+ }
+ }
+ } else if ( looking_at(p, "title") ) {
+ refstr_put(m->title);
+ m->title = refstrdup(skipspace(p+5));
+ if (m->parent_entry) {
+ /* MENU TITLE -> MENU LABEL on submenu */
+ if (m->parent_entry->displayname == m->parent_entry->label) {
+ refstr_put(m->parent_entry->displayname);
+ m->parent_entry->displayname = refstr_get(m->title);
}
}
} else if ( looking_at(p, "default") ) {