hdt: in the cli, we have to Skip empty lines
authorErwan Velu <erwan.velu@free.fr>
Wed, 25 Mar 2009 22:25:38 +0000 (23:25 +0100)
committerErwan Velu <erwan.velu@free.fr>
Thu, 26 Mar 2009 17:28:47 +0000 (18:28 +0100)
Impact: empty lines were confusing history

History works better when we ignore empty lines

com32/hdt/hdt-cli.c

index 9ff6d90..8e71690 100644 (file)
@@ -497,6 +497,12 @@ void start_cli_mode(struct s_hardware *hardware)
 
                case KEY_ENTER:
                        more_printf("\n");
+
+                       /* We have to skip empty lines */
+                       if (strlen(skipspace(cli.input))<1) {
+                               reset_prompt(&cli);
+                               break;
+                       }
                        if (cli.history_pos == MAX_HISTORY_SIZE-1) cli.history_pos=1;
                        strncpy(cli.history[cli.history_pos],skipspace(cli.input),sizeof(cli.history[cli.history_pos]));
                        cli.history_pos++;