aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorCollin Walling <walling@linux.ibm.com>2018-07-20 15:40:24 -0400
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-09-25 14:48:44 +0100
commit43e87b3eaf90763822457a0f8b582dcc2d774179 (patch)
treec4c88257ddbf56b48d7ff2b2716fde53d1d734fa /monitor.c
parent506e4a00de01e0b29fa83db5cbbc3d154253b4ea (diff)
monitor: print message when using 'help' with an unknown command
When typing 'help' followed by an unknown command, QEMU will not print anything to the command line to let the user know they typed a bad command. Let's fix this by printing a message to the monitor when this happens. For example: (qemu) help xyz unknown command: 'xyz' Reported-by: Stefan Zimmermann <stzi@linux.ibm.com> Signed-off-by: Collin Walling <walling@linux.ibm.com> Message-Id: <1532115624-27568-1-git-send-email-walling@linux.ibm.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/monitor.c b/monitor.c
index 3b90c9eb5f..c4677b502b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -952,6 +952,7 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
char **args, int nb_args, int arg_index)
{
const mon_cmd_t *cmd;
+ size_t i;
/* No valid arg need to compare with, dump all in *cmds */
if (arg_index >= nb_args) {
@@ -973,9 +974,15 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
} else {
help_cmd_dump_one(mon, cmd, args, arg_index);
}
- break;
+ return;
}
}
+
+ /* Command not found */
+ monitor_printf(mon, "unknown command: '");
+ for (i = 0; i <= arg_index; i++) {
+ monitor_printf(mon, "%s%s", args[i], i == arg_index ? "'\n" : " ");
+ }
}
static void help_cmd(Monitor *mon, const char *name)