Merge pull request #745 from simonduq/contrib/shell-empty-cmd
Shell: skip empty lines
This commit is contained in:
commit
f42618ce94
@ -98,19 +98,22 @@ PT_THREAD(shell_input(struct pt *pt, shell_output_func output, const char *cmd))
|
|||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for arguments */
|
/* Skip empty lines */
|
||||||
args = strchr(cmd, ' ');
|
if(*cmd != '\0') {
|
||||||
if(args != NULL) {
|
/* Look for arguments */
|
||||||
*args = '\0';
|
args = strchr(cmd, ' ');
|
||||||
args++;
|
if(args != NULL) {
|
||||||
}
|
*args = '\0';
|
||||||
|
args++;
|
||||||
|
}
|
||||||
|
|
||||||
cmd_descr = shell_command_lookup(cmd);
|
cmd_descr = shell_command_lookup(cmd);
|
||||||
if(cmd_descr != NULL) {
|
if(cmd_descr != NULL) {
|
||||||
static struct pt cmd_pt;
|
static struct pt cmd_pt;
|
||||||
PT_SPAWN(pt, &cmd_pt, cmd_descr->func(&cmd_pt, output, args));
|
PT_SPAWN(pt, &cmd_pt, cmd_descr->func(&cmd_pt, output, args));
|
||||||
} else {
|
} else {
|
||||||
SHELL_OUTPUT(output, "Command not found. Type 'help' for a list of commands\n");
|
SHELL_OUTPUT(output, "Command not found. Type 'help' for a list of commands\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output_prompt(output);
|
output_prompt(output);
|
||||||
|
Loading…
Reference in New Issue
Block a user