diff options
author | H. Peter Anvin <hpa@zytor.com> | 2006-09-21 17:55:39 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-09-21 17:55:39 -0700 |
commit | bbdfb30091bb6fe6f77156fc06a6881ed6059582 (patch) | |
tree | dd7a61bf54b7f5a5a45989d7690ac7abee42f6b5 | |
parent | 2bdc641a5c98b92f8baf3f5f31223dc1b3740701 (diff) | |
download | syslinux-bbdfb30091bb6fe6f77156fc06a6881ed6059582.tar.gz |
New MENU INCLUDE directive, and support ~ to mark default config file.syslinux-3.31-pre3
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | README.menu | 20 | ||||
-rw-r--r-- | com32/modules/readconfig.c | 22 |
3 files changed, 38 insertions, 7 deletions
@@ -4,7 +4,8 @@ them. Changes in 3.31: * The simple menu system (menu.c32 and vesamenu.c32) now - support loading more than one configuration file at a time. + support loading more than one configuration file at a time, + using MENU INCLUDE or by specifying multiple filenames. * The MENU COLOR statement can now control the shadowing mode. Changes in 3.30: diff --git a/README.menu b/README.menu index 3ec9abc7..6f0fd83c 100644 --- a/README.menu +++ b/README.menu @@ -113,6 +113,14 @@ MENU BACKGROUND filename be 640x480 pixels and either in PNG or JPEG format. +MENU INCLUDE filename + + Include the contents of the configuration file filename at + this point. Keep in mind that the included data is only seen + by the menu system; the core syslinux code does not parse this + command, so any labels defined in it are unavailable. + + MENU COLOR element ansi foreground background shadow Sets the color of element "element" to the specified color @@ -253,8 +261,8 @@ LABEL othermenu APPEND othermenu.conf If you specify more than one file, they will all be read, in the order -specified. However, global APPEND and IPAPPEND will only apply to the -file currently being processed. +specified. The dummy filename ~ (tilde) is replaced with the filename +of the main configuration file. # The file graphics.conf contains common color and layout commands for # all menus. @@ -262,3 +270,11 @@ LABEL othermenu MENU LABEL Another Menu KERNEL vesamenu.c32 APPEND graphics.conf othermenu.conf + +# Return to the main menu +LABEL mainmenu + MENU LABEL Return to Main Menu + KERNEL vesamenu.c32 + APPEND graphics.conf ~ + +See also the MENU INCLUDE directive above. diff --git a/com32/modules/readconfig.c b/com32/modules/readconfig.c index 79351902..33326f6e 100644 --- a/com32/modules/readconfig.c +++ b/com32/modules/readconfig.c @@ -361,11 +361,17 @@ static uint32_t parse_argb(char **p) return argb; } +/* + * Global APPEND and IPAPPEND status + */ +static char *append = NULL; +static unsigned int ipappend = 0; + +static int parse_one_config(const char *filename); + static void parse_config_file(FILE *f) { char line[MAX_LINE], *p, *ep, ch; - char *append = NULL; - unsigned int ipappend = 0; struct labeldata ld; memset(&ld, 0, sizeof ld); @@ -403,6 +409,9 @@ static void parse_config_file(FILE *f) if ( looking_at(p, "passwd") ) { menu_master_passwd = strdup(skipspace(p+6)); } + } else if ( (ep = looking_at(p, "include")) ) { + p = skipspace(ep); + parse_one_config(p); } else if ( (ep = looking_at(p, "background")) ) { p = skipspace(ep); if (menu_background) @@ -512,7 +521,12 @@ static void parse_config_file(FILE *f) static int parse_one_config(const char *filename) { - FILE *f = fopen(filename, "r"); + FILE *f; + + if (!strcmp(filename, "~")) + filename = get_config(); + + f = fopen(filename, "r"); if ( !f ) return -1; @@ -529,7 +543,7 @@ void parse_configs(char **argv) get_ipappend(); if ( !*argv ) { - parse_one_config(get_config()); + parse_one_config("~"); } else { while ( (filename = *argv++) ) parse_one_config(filename); |