return;
}
+/**
+ * exec_command - main logic to map the command line to callbacks
+ **/
static void exec_command(char *line,
struct s_hardware *hardware)
{
struct cli_callback_descr* current_module = NULL;
struct cli_mode_descr *current_mode;
- /* We use sizeof BLAH - 1 to remove the last \0 */
-// command[strlen(command) - 1] = '\0';
-
- /*
- * All commands before that line are common for all cli modes.
- * The following will be specific for every mode.
- */
-
/* Find the mode selected */
find_cli_mode_descr(hdt_cli.mode, ¤t_mode);
if (current_mode == NULL) {
/* Shouldn't get here... */
printf("!!! BUG: Mode '%s' unknown.\n", hdt_cli.mode);
- // XXX Will return; when done with refactoring.
- goto old_cli;
+ return;
}
/* This will allocate memory that will need to be freed */
free(command);
free(module);
free(argv);
-
-old_cli:
- /* Legacy cli */
- switch (hdt_cli.mode) {
- case EXIT_MODE:
- break; /* should not happen */
- }
}
static void reset_prompt()
} cli_mode_t;
struct s_cli {
- cli_mode_t mode;
- char prompt[32];
- char input[MAX_LINE_SIZE];
- int cursor_pos;
+ cli_mode_t mode;
+ char prompt[32];
+ char input[MAX_LINE_SIZE];
+ int cursor_pos;
};
struct s_cli hdt_cli;
#define CLI_DMI_LIST CLI_SHOW_LIST
#define CLI_DMI_MAX_MODULES 9
void main_show_dmi(int argc, char **argv, struct s_hardware *hardware);
-void handle_dmi_commands(char *cli_line, struct s_hardware *hardware);
void show_dmi_memory_modules(int argc, char** argv, struct s_hardware *hardware);
// PCI STUFF
#define CLI_PCI_DEVICE "device"
void main_show_pci(int argc, char **argv, struct s_hardware *hardware);
-void handle_pci_commands(char *cli_line, struct s_hardware *hardware);
void cli_detect_pci(struct s_hardware *hardware);
// CPU STUFF
void main_show_cpu(int argc, char **argv, struct s_hardware *hardware);
-void handle_cpu_commands(char *cli_line, struct s_hardware *hardware);
// PXE STUFF
void main_show_pxe(int argc, char **argv, struct s_hardware *hardware);
-void handle_pxe_commands(char *cli_line, struct s_hardware *hardware);
// KERNEL STUFF
void main_show_kernel(int argc, char **argv, struct s_hardware *hardware);
-void handle_kernel_commands(char *cli_line, struct s_hardware *hardware);
// SYSLINUX STUFF
void main_show_syslinux(int argc, char **argv, struct s_hardware *hardware);
-void handle_syslinux_commands(char *cli_line, struct s_hardware *hardware);
// VESA STUFF
void main_show_vesa(int argc, char **argv, struct s_hardware *hardware);
-void handle_vesa_commands(char *cli_line, struct s_hardware *hardware);
#endif