aboutsummaryrefslogtreecommitdiffstats
path: root/com32/menu
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2011-04-18 14:06:54 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2011-04-18 14:06:54 -0700
commit830dd5801d9ab9347576ec7ab5c7427b247b67e4 (patch)
tree4231018aac0c4fc37ad83d8b62a02817bea72d38 /com32/menu
parent400330e6ac2422a41a984d177993d945ffacc98f (diff)
downloadsyslinux-830dd5801d9ab9347576ec7ab5c7427b247b67e4.tar.gz
syslinux-830dd5801d9ab9347576ec7ab5c7427b247b67e4.tar.xz
syslinux-830dd5801d9ab9347576ec7ab5c7427b247b67e4.zip
menu: allow "menu hiddenkey" to take multiple keys; run unlabel
- Allow "menu hiddenkey" to take a comma-separated list of keys. - Run unlabel() on the commands passed to menu hiddenkey. XXX: Consider moving unlabelling to post-menu instead. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'com32/menu')
-rw-r--r--com32/menu/readconfig.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/com32/menu/readconfig.c b/com32/menu/readconfig.c
index fdf2e27a..0ac2564a 100644
--- a/com32/menu/readconfig.c
+++ b/com32/menu/readconfig.c
@@ -143,7 +143,7 @@ static char *looking_at(char *line, const char *kwd)
}
/* Get a single word into a new refstr; advances the input pointer */
-static char *get_word(char *str, const char **word)
+static char *get_word(char *str, char **word)
{
char *p = str;
char *q;
@@ -721,16 +721,27 @@ static void parse_config_file(FILE * f)
} else if ((ep = looking_at(p, "hidden"))) {
hiddenmenu = 1;
} else if (looking_at(p, "hiddenkey")) {
- const char *key_name;
+ char *key_name, *k, *ek;
+ const char *command;
int key;
p = get_word(skipspace(p + 9), &key_name);
- p = skipspace(p);
- key = key_name_to_code(key_name);
- refstr_put(key_name);
- if (key >= 0) {
- refstr_put(hide_key[key]);
- hide_key[key] = refstrdup(skipspace(p));
+ command = refstrdup(skipspace(p));
+ k = key_name;
+ for (;;) {
+ ek = strchr(k+1, ',');
+ if (ek)
+ *ek = '\0';
+ key = key_name_to_code(k);
+ if (key >= 0) {
+ refstr_put(hide_key[key]);
+ hide_key[key] = refstr_get(command);
+ }
+ if (!ek)
+ break;
+ k = ek+1;
}
+ refstr_put(key_name);
+ refstr_put(command);
} else if ((ep = looking_at(p, "clear"))) {
clearmenu = 1;
} else if ((ep = is_message_name(p, &msgnr))) {
@@ -1064,6 +1075,7 @@ void parse_configs(char **argv)
const char *filename;
struct menu *m;
struct menu_entry *me;
+ int k;
empty_string = refstrdup("");
@@ -1125,4 +1137,10 @@ void parse_configs(char **argv)
if (m->onerror)
m->onerror = unlabel(m->onerror);
}
+
+ /* Final global initialization, with all labels known */
+ for (k = 0; k < KEY_MAX; k++) {
+ if (hide_key[k])
+ hide_key[k] = unlabel(hide_key[k]);
+ }
}