qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] monitor: print message when using 'help' wit


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH v2] monitor: print message when using 'help' with an unknown command
Date: Tue, 25 Sep 2018 11:40:55 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

* Collin Walling (address@hidden) wrote:
> 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 <address@hidden>
> Signed-off-by: Collin Walling <address@hidden>

Queued (at last!)

> ---
>  monitor.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 7af1f18..deeb41c 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1013,6 +1013,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) {
> @@ -1034,9 +1035,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)
> -- 
> 2.7.4
> 
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]