aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink/ldlinux
diff options
context:
space:
mode:
Diffstat (limited to 'com32/elflink/ldlinux')
-rw-r--r--com32/elflink/ldlinux/config.h2
-rw-r--r--com32/elflink/ldlinux/ldlinux.c2
-rw-r--r--com32/elflink/ldlinux/readconfig.c73
3 files changed, 76 insertions, 1 deletions
diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h
index 37c57da1..8f708f14 100644
--- a/com32/elflink/ldlinux/config.h
+++ b/com32/elflink/ldlinux/config.h
@@ -36,4 +36,6 @@ extern short nohalt; //idle.inc
extern const char *default_cmd; //"default" command line
extern const char *onerror; //"onerror" command line
+extern void cat_help_file(int key);
+
#endif /* __CONFIG_H__ */
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 85066b19..1177ef59 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -17,7 +17,7 @@ static void enter_cmdline(void)
/* Enter endless command line prompt, should support "exit" */
while (1) {
- cmdline = edit_cmdline("syslinux$", 1, NULL, NULL);
+ cmdline = edit_cmdline("syslinux$", 1, NULL, cat_help_file);
if (!cmdline)
continue;
/* feng: give up the aux check here */
diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c
index a29c6c60..66e84dfb 100644
--- a/com32/elflink/ldlinux/readconfig.c
+++ b/com32/elflink/ldlinux/readconfig.c
@@ -27,6 +27,7 @@
#include "menu.h"
#include "config.h"
+#include "getkey.h"
const struct menu_parameter mparm[NPARAMS] = {
[P_WIDTH] = {"width", 0},
@@ -617,6 +618,78 @@ static char *is_message_name(char *cmdstr, enum message_number *msgnr)
return NULL;
}
+static int cat_file(const char *filename)
+{
+ FILE *f;
+ char line[2048];
+
+ f = fopen(filename, "r");
+ if (!f)
+ return -1;
+
+ while (fgets(line, sizeof(line), f) != NULL)
+ printf("%s", line);
+
+ fclose(f);
+ return 0;
+}
+
+void cat_help_file(int key)
+{
+ struct menu *cm = current_menu;
+ int fkey;
+
+ switch (key) {
+ case KEY_F1:
+ fkey = 0;
+ break;
+ case KEY_F2:
+ fkey = 1;
+ break;
+ case KEY_F3:
+ fkey = 2;
+ break;
+ case KEY_F4:
+ fkey = 3;
+ break;
+ case KEY_F5:
+ fkey = 4;
+ break;
+ case KEY_F6:
+ fkey = 5;
+ break;
+ case KEY_F7:
+ fkey = 6;
+ break;
+ case KEY_F8:
+ fkey = 7;
+ break;
+ case KEY_F9:
+ fkey = 8;
+ break;
+ case KEY_F10:
+ fkey = 9;
+ break;
+ case KEY_F11:
+ fkey = 10;
+ break;
+ case KEY_F12:
+ fkey = 11;
+ break;
+ default:
+ fkey = -1;
+ break;
+ }
+
+ if (fkey == -1)
+ return;
+
+ if (cm->fkeyhelp[fkey].textname) {
+ printf("\n");
+ cat_file(cm->fkeyhelp[fkey].textname);
+ }
+}
+
static char *is_fkey(char *cmdstr, int *fkeyno)
{
char *q;