summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-05-30 17:45:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-05-30 17:45:32 -0700
commit71c5b0c328d5c8d51b3870a3ce326c891606916d (patch)
treed647b6e6a9cb0c083c15281b9ee0e9252f32981d
parent46f46957e0aba98f6943dfa7cf61334dd5b2b890 (diff)
downloadsyslinux-71c5b0c328d5c8d51b3870a3ce326c891606916d.tar.gz
Parse F-key help commands in the menu system
This adds support for parsing the F-key help commands in the menu system; it still doesn't actually do anything with them.
-rw-r--r--com32/modules/menu.h6
-rw-r--r--com32/modules/readconfig.c42
2 files changed, 46 insertions, 2 deletions
diff --git a/com32/modules/menu.h b/com32/modules/menu.h
index 5c15b396..51b767e6 100644
--- a/com32/modules/menu.h
+++ b/com32/modules/menu.h
@@ -104,6 +104,12 @@ extern char *menu_passprompt_msg;
extern char *menu_background;
+struct fkey_help {
+ const char *textname;
+ const char *background;
+};
+extern struct fkey_help fkeyhelp[12];
+
void parse_configs(char **argv);
extern int (*draw_background)(const char *filename);
diff --git a/com32/modules/readconfig.c b/com32/modules/readconfig.c
index 44da72f2..3e772c1f 100644
--- a/com32/modules/readconfig.c
+++ b/com32/modules/readconfig.c
@@ -38,6 +38,8 @@ char *onerror = NULL;
char *menu_master_passwd = NULL;
char *menu_background = NULL;
+struct fkey_help fkeyhelp[12];
+
struct menu_entry menu_entries[MAX_ENTRIES];
struct menu_entry hide_entries[MAX_ENTRIES];
struct menu_entry *menu_hotkeys[256];
@@ -439,11 +441,31 @@ static char *is_message_name(char *cmdstr, struct messages **msgptr)
return NULL;
}
+static char *is_fkey(char *cmdstr, int *fkeyno)
+{
+ char *q;
+ int no;
+
+ if (cmdstr[0] != 'f')
+ return NULL;
+
+ no = strtoul(cmdstr+1, &q, 10);
+ if (!my_isspace(*q))
+ return NULL;
+
+ if (no < 0 || no > 12)
+ return NULL;
+
+ *fkeyno = (no == 0) ? 10 : no-1;
+ return q;
+}
+
static void parse_config_file(FILE *f)
{
char line[MAX_LINE], *p, *ep, ch;
enum kernel_type type;
struct messages *msgptr;
+ int fkeyno;
while ( fgets(line, sizeof line, f) ) {
p = strchr(line, '\r');
@@ -576,9 +598,25 @@ static void parse_config_file(FILE *f)
break;
}
}
+ } else if ( (ep = is_fkey(p, &fkeyno)) ) {
+ p = skipspace(ep);
+ if (fkeyhelp[fkeyno].textname) {
+ free((void *)fkeyhelp[fkeyno].textname);
+ fkeyhelp[fkeyno].textname = NULL;
+ }
+ if (fkeyhelp[fkeyno].background) {
+ free((void *)fkeyhelp[fkeyno].background);
+ fkeyhelp[fkeyno].background = NULL;
+ }
+
+ fkeyhelp[fkeyno].textname = dup_word(&p);
+ if (*p) {
+ p = skipspace(p);
+ fkeyhelp[fkeyno].background = dup_word(&p);
+ }
} else if ( (ep = looking_at(p, "include")) ) {
- p = skipspace(ep);
- parse_one_config(p);
+ p = skipspace(ep);
+ parse_one_config(p);
} else if ( looking_at(p, "append") ) {
char *a = strdup(skipspace(p+6));
if ( ld.label )