aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerwan <erwan@laptopR1.(none)>2009-03-07 15:58:16 +0100
committererwan <erwan@laptopR1.(none)>2009-03-07 15:58:16 +0100
commitdb688a5c86074a5dcc842a71cc417ae6a6c26915 (patch)
tree40cbdf409b8c542539d5ebb6157d748559fec243
parentd0e228dbafe637ce74bc3391c1fb81cf720f26a1 (diff)
downloadsyslinux-elf-db688a5c86074a5dcc842a71cc417ae6a6c26915.tar.gz
syslinux-elf-db688a5c86074a5dcc842a71cc417ae6a6c26915.tar.xz
syslinux-elf-db688a5c86074a5dcc842a71cc417ae6a6c26915.zip
Improving help
-rw-r--r--com32/hdt/hdt-cli-cpu.c8
-rw-r--r--com32/hdt/hdt-cli-dmi.c8
-rw-r--r--com32/hdt/hdt-cli-pci.c7
-rw-r--r--com32/hdt/hdt-cli-pxe.c20
-rw-r--r--com32/hdt/hdt-cli.c35
-rw-r--r--com32/hdt/hdt-cli.h1
6 files changed, 69 insertions, 10 deletions
diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c
index 0bed1cc8..edeef24a 100644
--- a/com32/hdt/hdt-cli-cpu.c
+++ b/com32/hdt/hdt-cli-cpu.c
@@ -33,6 +33,8 @@
#include <stdlib.h>
#include <errno.h>
+
+
void show_cpu(struct s_hardware *hardware) {
char buffer[81];
char buffer1[81];
@@ -109,12 +111,16 @@ if (hardware->cpu.flags.mce) strcat(buffer1,"mce ");
more_printf(buffer);
}
+void show_cpu_help() {
+ more_printf("Show supports the following commands : %s\n",CLI_CPU);
+}
+
void cpu_show(char *item, struct s_hardware *hardware) {
if ( !strncmp(item, CLI_CPU, sizeof(CLI_CPU) - 1) ) {
show_cpu(hardware);
return;
}
-
+ show_cpu_help();
}
void handle_cpu_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
diff --git a/com32/hdt/hdt-cli-dmi.c b/com32/hdt/hdt-cli-dmi.c
index 287786ff..3902f383 100644
--- a/com32/hdt/hdt-cli-dmi.c
+++ b/com32/hdt/hdt-cli-dmi.c
@@ -33,6 +33,13 @@
#include <stdlib.h>
#include <errno.h>
+void show_dmi_help(struct s_hardware *hardware) {
+ more_printf("Show supports the following commands : \n");
+ more_printf(" %s\n",CLI_SHOW_LIST);
+ more_printf(" <module_name>\n");
+ more_printf(" -\n");
+ show_dmi_modules(hardware);
+}
void dmi_show(char *item, struct s_hardware *hardware) {
@@ -73,6 +80,7 @@ void dmi_show(char *item, struct s_hardware *hardware) {
return;
}
+ show_dmi_help(hardware);
}
void handle_dmi_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c
index d7c2ad24..554c2ce5 100644
--- a/com32/hdt/hdt-cli-pci.c
+++ b/com32/hdt/hdt-cli-pci.c
@@ -176,6 +176,11 @@ void show_pci_devices(struct s_hardware *hardware) {
}
}
+void show_pci_help() {
+ more_printf("Show supports the following commands : \n");
+ more_printf(" %s\n",CLI_SHOW_LIST);
+ more_printf(" %s <device_number>\n",CLI_PCI_DEVICE);
+}
void pci_show(char *item, struct s_hardware *hardware) {
if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
@@ -186,7 +191,7 @@ void pci_show(char *item, struct s_hardware *hardware) {
show_pci_device(hardware,item+ sizeof(CLI_PCI_DEVICE)-1);
return;
}
-
+ show_pci_help();
}
void handle_pci_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
diff --git a/com32/hdt/hdt-cli-pxe.c b/com32/hdt/hdt-cli-pxe.c
index 64b15020..ea190934 100644
--- a/com32/hdt/hdt-cli-pxe.c
+++ b/com32/hdt/hdt-cli-pxe.c
@@ -63,3 +63,23 @@ void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
}
more_printf( " Addresses : %d.%d.%d.%d @ %s\n",p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3],p->mac_addr);
}
+
+void show_pxe_help() {
+ more_printf("Show supports the following commands : %s\n",CLI_SHOW_LIST);
+}
+
+void pxe_show(char *item, struct s_hardware *hardware) {
+ if ( !strncmp(item, CLI_SHOW_LIST, sizeof(CLI_SHOW_LIST) - 1) ) {
+ main_show_pxe(hardware,NULL);
+ return;
+ }
+ show_pxe_help();
+}
+
+void handle_pxe_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware) {
+ if ( !strncmp(cli_line, CLI_SHOW, sizeof(CLI_SHOW) - 1) ) {
+ pxe_show(strstr(cli_line,"show")+ sizeof(CLI_SHOW), hardware);
+ return;
+ }
+}
+
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 6819471d..5847d7ff 100644
--- a/com32/hdt/hdt-cli.c
+++ b/com32/hdt/hdt-cli.c
@@ -136,6 +136,10 @@ void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]) {
set_mode(&cli_mode,DMI_MODE,hardware);
continue;
}
+ if ( !strncmp(cli_line, CLI_PXE, sizeof(CLI_PXE) - 1) ) {
+ set_mode(&cli_mode,PXE_MODE,hardware);
+ continue;
+ }
if ( !strncmp(cli_line, CLI_KERNEL, sizeof(CLI_KERNEL) - 1) ) {
set_mode(&cli_mode,KERNEL_MODE,hardware);
continue;
@@ -147,6 +151,7 @@ void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]) {
case PCI_MODE: handle_pci_commands(cli_line,&cli_mode, hardware); break;
case HDT_MODE: handle_hdt_commands(cli_line,&cli_mode, hardware); break;
case CPU_MODE: handle_cpu_commands(cli_line,&cli_mode, hardware); break;
+ case PXE_MODE: handle_pxe_commands(cli_line,&cli_mode, hardware); break;
case KERNEL_MODE: handle_kernel_commands(cli_line,&cli_mode, hardware); break;
case EXIT_MODE: break; /* should not happend */
}
@@ -169,14 +174,17 @@ return HDT_MODE;
void show_cli_help(struct s_cli_mode *cli_mode) {
switch (cli_mode->mode) {
case HDT_MODE:
- printf("Available commands are : %s %s %s %s %s %s\n",CLI_CLEAR, CLI_EXIT,CLI_HELP,CLI_SHOW, CLI_PCI, CLI_DMI);
+ printf("Available commands are : %s %s %s %s %s %s %s %s %s\n",
+ CLI_CLEAR, CLI_EXIT,CLI_HELP,CLI_SHOW, CLI_PCI,
+ CLI_DMI, CLI_PXE, CLI_KERNEL, CLI_CPU);
break;
case KERNEL_MODE:
case PXE_MODE:
case CPU_MODE:
case PCI_MODE:
case DMI_MODE:
- printf("Available commands are : %s %s %s %s\n",CLI_CLEAR, CLI_EXIT, CLI_HELP, CLI_SHOW);
+ printf("Available commands are : %s %s %s %s\n",
+ CLI_CLEAR, CLI_EXIT, CLI_HELP, CLI_SHOW);
break;
case EXIT_MODE: /* Should not happend*/
break;
@@ -205,11 +213,22 @@ void main_show_summary(struct s_hardware *hardware, struct s_cli_mode *cli_mode)
main_show_kernel(hardware,cli_mode);
}
+void show_main_help() {
+ more_printf("Show supports the following commands : \n");
+ more_printf(" %s\n",CLI_SUMMARY);
+ more_printf(" %s\n",CLI_PCI);
+ more_printf(" %s\n",CLI_DMI);
+ more_printf(" %s\n",CLI_CPU);
+ more_printf(" %s\n",CLI_PXE);
+ more_printf(" %s\n",CLI_KERNEL);
+}
+
void main_show(char *item, struct s_hardware *hardware, struct s_cli_mode *cli_mode) {
- if (!strncmp(item,CLI_SUMMARY, sizeof (CLI_SUMMARY))) main_show_summary(hardware,cli_mode);
- if (!strncmp(item,CLI_PCI, sizeof (CLI_PCI))) main_show_pci(hardware);
- if (!strncmp(item,CLI_DMI, sizeof (CLI_DMI))) main_show_dmi(hardware,cli_mode);
- if (!strncmp(item,CLI_CPU, sizeof (CLI_CPU))) main_show_cpu(hardware,cli_mode);
- if (!strncmp(item,CLI_PXE, sizeof (CLI_PXE))) main_show_pxe(hardware,cli_mode);
- if (!strncmp(item,CLI_KERNEL, sizeof (CLI_KERNEL))) main_show_kernel(hardware,cli_mode);
+ if (!strncmp(item,CLI_SUMMARY, sizeof (CLI_SUMMARY))) { main_show_summary(hardware,cli_mode); return; }
+ if (!strncmp(item,CLI_PCI, sizeof (CLI_PCI))) { main_show_pci(hardware); return; }
+ if (!strncmp(item,CLI_DMI, sizeof (CLI_DMI))) { main_show_dmi(hardware,cli_mode); return; }
+ if (!strncmp(item,CLI_CPU, sizeof (CLI_CPU))) { main_show_cpu(hardware,cli_mode); return; }
+ if (!strncmp(item,CLI_PXE, sizeof (CLI_PXE))) { main_show_pxe(hardware,cli_mode); return; }
+ if (!strncmp(item,CLI_KERNEL, sizeof (CLI_KERNEL))) { main_show_kernel(hardware,cli_mode); return; }
+ show_main_help();
}
diff --git a/com32/hdt/hdt-cli.h b/com32/hdt/hdt-cli.h
index 2dcabb51..9a880128 100644
--- a/com32/hdt/hdt-cli.h
+++ b/com32/hdt/hdt-cli.h
@@ -102,6 +102,7 @@ void cpu_show(char *item, struct s_hardware *hardware);
//PXE STUFF
void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
+void handle_pxe_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
//KERNEL STUFF
void main_show_kernel(struct s_hardware *hardware,struct s_cli_mode *cli_mode);