diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-02-19 16:41:44 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-02-19 16:51:24 -0800 |
commit | 04d9aac1064ebec403d2015bfc9416987896e050 (patch) | |
tree | 258d7be8bd51e2805b6b6e8e0391ea098d588c15 /com32/menu/readconfig.c | |
parent | 93a9bb39ba16c67f4782621675ee3cc5edf2ad18 (diff) | |
download | syslinux-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.
Diffstat (limited to 'com32/menu/readconfig.c')
-rw-r--r-- | com32/menu/readconfig.c | 21 |
1 files changed, 14 insertions, 7 deletions
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") ) { |