diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-02-19 16:37:50 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-02-19 16:51:24 -0800 |
commit | 93a9bb39ba16c67f4782621675ee3cc5edf2ad18 (patch) | |
tree | 55bd24af96fb6ec824bbe58a19cf4003f2a2359d /com32/menu/readconfig.c | |
parent | 8f6e112074e1b189bb229583e29270248be36989 (diff) | |
download | syslinux-93a9bb39ba16c67f4782621675ee3cc5edf2ad18.tar.gz syslinux-93a9bb39ba16c67f4782621675ee3cc5edf2ad18.tar.xz syslinux-93a9bb39ba16c67f4782621675ee3cc5edf2ad18.zip |
Allow an included file to be treated as a submenu.
Diffstat (limited to 'com32/menu/readconfig.c')
-rw-r--r-- | com32/menu/readconfig.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c index c3f2da4b..e94fddfe 100644 --- a/com32/menu/readconfig.c +++ b/com32/menu/readconfig.c @@ -599,8 +599,7 @@ static void parse_config_file(FILE *f) m->menu_master_passwd = refstrdup(skipspace(p+6)); } } else if ( (ep = looking_at(p, "include")) ) { - p = skipspace(ep); - parse_one_config(p); + goto do_include; } else if ( (ep = looking_at(p, "background")) ) { p = skipspace(ep); refstr_put(m->menu_background); @@ -781,8 +780,23 @@ static void parse_config_file(FILE *f) m->fkeyhelp[fkeyno].background = refdup_word(&p); } } else if ( (ep = looking_at(p, "include")) ) { - p = skipspace(ep); - parse_one_config(p); + do_include: + { + const char *file; + p = skipspace(ep); + file = refdup_word(&p); + p = skipspace(p); + if (*p) { + record(m, &ld, append); + m = current_menu = begin_submenu(p); + parse_one_config(file); + record(m, &ld, append); + m = current_menu = end_submenu(); + } else { + parse_one_config(file); + } + refstr_put(file); + } } else if ( looking_at(p, "append") ) { const char *a = refstrdup(skipspace(p+6)); if ( ld.label ) { |