aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-02-22 11:16:45 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-02-22 11:16:45 -0800
commit6152d7affa392c8233b527b5800299f0b38246f0 (patch)
treefdf9d85e539e7b7f40181ae7947fcc7ab2eead39
parent44e9cab0e6bc5a7a75d8470e7a4ba41d739f4a37 (diff)
downloadsyslinux-elf-6152d7affa392c8233b527b5800299f0b38246f0.tar.gz
syslinux-elf-6152d7affa392c8233b527b5800299f0b38246f0.tar.xz
syslinux-elf-6152d7affa392c8233b527b5800299f0b38246f0.zip
Allow MENU EXIT to specify a menu tagsyslinux-3.62-pre15
Allow MENU EXIT to "exit" to an arbitrary menu. This is really just a variant of "MENU GOTO", but it allows displaying an exit marker.
-rw-r--r--com32/menu/menu.h3
-rw-r--r--com32/menu/readconfig.c18
-rw-r--r--doc/menu.doc5
3 files changed, 20 insertions, 6 deletions
diff --git a/com32/menu/menu.h b/com32/menu/menu.h
index b1a98a27..b8c28687 100644
--- a/com32/menu/menu.h
+++ b/com32/menu/menu.h
@@ -34,6 +34,8 @@
struct menu;
+/* Note: the _UNRES variants must always be immediately after their
+ "normal" versions. */
enum menu_action {
MA_NONE, /* Undefined value */
MA_CMD, /* Execute a command */
@@ -43,6 +45,7 @@ enum menu_action {
MA_GOTO_UNRES, /* Unresolved go to */
MA_QUIT, /* Quit to CLI */
MA_EXIT, /* Exit to higher-level menu */
+ MA_EXIT_UNRES, /* Unresolved exit */
};
struct menu_entry {
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index 65e230d5..10201938 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -348,6 +348,7 @@ record(struct menu *m, struct labeldata *ld, const char *append)
break;
case MA_GOTO_UNRES:
+ case MA_EXIT_UNRES:
me->cmdline = refstr_get(ld->kernel);
break;
@@ -763,9 +764,17 @@ static void parse_config_file(FILE *f)
ld.kernel = refstrdup(skipspace(p+4));
}
} else if ( looking_at(p, "exit") ) {
+ p = skipspace(p+4);
if (ld.label && m->parent) {
- ld.action = MA_EXIT;
- ld.submenu = m->parent;
+ if (*p) {
+ /* This is really just a goto, except for the marker */
+ ld.action = MA_EXIT_UNRES;
+ refstr_put(ld.kernel);
+ ld.kernel = refstrdup(p);
+ } else {
+ ld.action = MA_EXIT;
+ ld.submenu = m->parent;
+ }
}
} else if ( looking_at(p, "start") ) {
start_menu = m;
@@ -912,13 +921,14 @@ static void resolve_gotos(void)
struct menu *m;
for (me = all_entries; me; me = me->next) {
- if (me->action == MA_GOTO_UNRES) {
+ if (me->action == MA_GOTO_UNRES ||
+ me->action == MA_EXIT_UNRES) {
m = find_menu(me->cmdline);
refstr_put(me->cmdline);
me->cmdline = NULL;
if (m) {
me->submenu = m;
- me->action = MA_GOTO;
+ me->action--; /* Drop the _UNRES */
} else {
me->action = MA_DISABLED;
}
diff --git a/doc/menu.doc b/doc/menu.doc
index fefd92c7..aa161bca 100644
--- a/doc/menu.doc
+++ b/doc/menu.doc
@@ -214,12 +214,13 @@ MENU GOTO tagname
"menu goto .top".
-MENU EXIT
+MENU EXIT [tagname]
(Only valid after a label statement inside MENU BEGIN ...
MENU END)
- Exit to the next higher menu.
+ Exit to the next higher menu, or, if tagname is specified, to
+ the named menu.
MENU QUIT