hdt: Final cleanups to switch to the new cli
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Sun, 22 Mar 2009 04:14:59 +0000 (21:14 -0700)
committerPierre-Alexandre Meyer <pierre@mouraf.org>
Sun, 22 Mar 2009 04:14:59 +0000 (21:14 -0700)
Impact: Old cli code has been removed.

This patch ends the transition to the new framework, the entire old code
has been removed.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
com32/hdt/hdt-cli.c
com32/hdt/hdt-cli.h

index b63ee15..cfaa769 100644 (file)
@@ -267,6 +267,9 @@ not_found:
        return;
 }
 
+/**
+ * exec_command - main logic to map the command line to callbacks
+ **/
 static void exec_command(char *line,
                         struct s_hardware *hardware)
 {
@@ -276,21 +279,12 @@ static void exec_command(char *line,
        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, &current_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 */
@@ -364,13 +358,6 @@ static void exec_command(char *line,
        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()
index 3bb6d19..8da891f 100644 (file)
@@ -81,10 +81,10 @@ typedef enum {
 } 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;
 
@@ -148,32 +148,25 @@ void main_show(char *item, struct s_hardware *hardware);
 #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