summaryrefslogtreecommitdiff
path: root/com32/hdt/hdt-cli-hdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/hdt/hdt-cli-hdt.c')
-rw-r--r--com32/hdt/hdt-cli-hdt.c126
1 files changed, 120 insertions, 6 deletions
diff --git a/com32/hdt/hdt-cli-hdt.c b/com32/hdt/hdt-cli-hdt.c
index 65068232..3c571d60 100644
--- a/com32/hdt/hdt-cli-hdt.c
+++ b/com32/hdt/hdt-cli-hdt.c
@@ -54,12 +54,12 @@ static void main_show_modes(int argc __unused, char **argv __unused,
int i = 0;
reset_more_printf();
- printf("Available modes:\n");
+ more_printf("Available modes:\n");
while (list_modes[i]) {
printf("%s ", list_modes[i]->name);
i++;
}
- printf("\n");
+ more_printf("\n");
}
/**
@@ -119,7 +119,7 @@ static void show_cli_help(int argc __unused, char **argv __unused,
find_cli_mode_descr(hdt_cli.mode, &current_mode);
- printf("Available commands are:\n");
+ more_printf("Available commands are:\n");
/* List first default modules of the mode */
if (current_mode->default_modules && current_mode->default_modules->modules) {
@@ -154,7 +154,7 @@ static void show_cli_help(int argc __unused, char **argv __unused,
/* List secondly the show modules of the mode */
if (current_mode->show_modules && current_mode->show_modules->modules) {
- printf("\nshow commands:\n");
+ more_printf("\nshow commands:\n");
j = 0;
while (current_mode->show_modules->modules[j].name) {
printf("%s ", current_mode->show_modules->modules[j].name);
@@ -165,7 +165,7 @@ static void show_cli_help(int argc __unused, char **argv __unused,
/* List thirdly the set modules of the mode */
if (current_mode->set_modules && current_mode->set_modules->modules) {
- printf("\nset commands:\n");
+ more_printf("\nset commands:\n");
j = 0;
while (current_mode->set_modules->modules[j].name) {
printf("%s ", current_mode->set_modules->modules[j].name);
@@ -250,97 +250,209 @@ static void do_reboot(int argc __unused, char **argv __unused,
syslinux_reboot(1);
}
+/**
+ * do_dump - dump info
+ **/
+static void do_dump(int argc __unused, char **argv __unused,
+ struct s_hardware *hardware)
+{
+ dump(hardware);
+}
+
+/**
+ * do_sleep - sleep a number of milliseconds
+ **/
+static void do_sleep(int argc , char **argv ,
+ struct s_hardware *hardware)
+{
+ (void) hardware;
+ if (argc != 1) return;
+ more_printf("Sleep %d milliseconds\n",atoi(argv[0]));
+ msleep(atoi(argv[0]));
+}
+
+/**
+ * do_display - display an image to user
+ **/
+static void do_display(int argc , char **argv ,
+ struct s_hardware *hardware)
+{
+ (void) hardware;
+ if ((argc != 1) || (vesamode == false)) return;
+ more_printf("Display %s file\n",argv[0]);
+ vesacon_load_background(argv[0]);
+}
+
+/**
+ * do_say - say message to user
+ **/
+static void do_say(int argc , char **argv ,
+ struct s_hardware *hardware)
+{
+ (void) hardware;
+ if (argc == 0) return;
+
+ char text_to_say[255]={0};
+ int arg=0;
+#if DEBUG
+ for (int i=0; i<argc;i++) dprintf("SAY: arg[%d]={%s}\n",i,argv[i]);
+#endif
+ char *argument = strchr(argv[arg],'`');
+ if ( argument != NULL) {
+ argument++;
+ strcat(text_to_say, argument);
+
+ while ((strchr(argument, '`') == NULL) && (arg+1<argc)) {
+ arg++;
+ argument = (char *)argv[arg];
+ strcat(text_to_say, " ");
+ strcat(text_to_say, argument);
+ }
+
+ /* Removing last ` if any */
+ char *last_quote = strrchr(text_to_say,'`');
+ if ( last_quote != NULL ) {
+ *last_quote='\0';
+ dprintf("SAY CMD = [%s]\n",text_to_say);
+ }
+
+ more_printf("%s\n",text_to_say);
+ }
+}
+
/* Default hdt mode */
struct cli_callback_descr list_hdt_default_modules[] = {
{
.name = CLI_CLEAR,
.exec = cli_clear_screen,
+ .nomodule = false,
},
{
.name = CLI_EXIT,
.exec = do_exit,
+ .nomodule = false,
},
{
.name = CLI_HELP,
.exec = show_cli_help,
+ .nomodule = false,
},
{
.name = CLI_MENU,
.exec = goto_menu,
+ .nomodule = false,
},
{
.name = CLI_REBOOT,
.exec = do_reboot,
+ .nomodule = false,
},
{
.name = CLI_HISTORY,
.exec = print_history,
+ .nomodule = false,
+ },
+ {
+ .name = CLI_DUMP,
+ .exec = do_dump,
+ .nomodule = false,
+ },
+ {
+ .name = CLI_SAY,
+ .exec = do_say,
+ .nomodule = true,
+ },
+ {
+ .name = CLI_DISPLAY,
+ .exec = do_display,
+ .nomodule = true,
+ },
+ {
+ .name = CLI_SLEEP,
+ .exec = do_sleep,
+ .nomodule = true,
},
{
.name = NULL,
- .exec = NULL},
+ .exec = NULL,
+ .nomodule = false},
};
struct cli_callback_descr list_hdt_show_modules[] = {
{
.name = CLI_SUMMARY,
.exec = main_show_summary,
+ .nomodule = false,
},
{
.name = CLI_PCI,
.exec = main_show_pci,
+ .nomodule = false,
},
{
.name = CLI_DMI,
.exec = main_show_dmi,
+ .nomodule = false,
},
{
.name = CLI_CPU,
.exec = main_show_cpu,
+ .nomodule = false,
},
{
.name = CLI_DISK,
.exec = disks_summary,
+ .nomodule = false,
},
{
.name = CLI_PXE,
.exec = main_show_pxe,
+ .nomodule = false,
},
{
.name = CLI_SYSLINUX,
.exec = main_show_syslinux,
+ .nomodule = false,
},
{
.name = CLI_KERNEL,
.exec = main_show_kernel,
+ .nomodule = false,
},
{
.name = CLI_VESA,
.exec = main_show_vesa,
+ .nomodule = false,
},
{
.name = CLI_HDT,
.exec = main_show_hdt,
+ .nomodule = false,
},
{
.name = CLI_VPD,
.exec = main_show_vpd,
+ .nomodule = false,
},
{
.name = CLI_MEMORY,
.exec = show_dmi_memory_modules,
+ .nomodule = false,
},
{
.name = CLI_ACPI,
.exec = main_show_acpi,
+ .nomodule = false,
},
{
.name = "modes",
.exec = main_show_modes,
+ .nomodule = false,
},
{
.name = NULL,
.exec = NULL,
+ .nomodule = false,
},
};
@@ -348,10 +460,12 @@ struct cli_callback_descr list_hdt_set_modules[] = {
{
.name = CLI_MODE,
.exec = cli_set_mode,
+ .nomodule = false,
},
{
.name = NULL,
.exec = NULL,
+ .nomodule = false,
},
};