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__ */
/* 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 */
#include "menu.h"
#include "config.h"
+#include "getkey.h"
const struct menu_parameter mparm[NPARAMS] = {
[P_WIDTH] = {"width", 0},
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;