diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-08-02 13:45:54 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-08-02 13:16:42 -0500 |
commit | c8057f951d64de93bfd01569c0a725baa9f94372 (patch) | |
tree | a923a40f0857c4de2e8feddbdadc4a2cc6d6bb59 /linux-user/main.c | |
parent | 02d2bd5d57812154cfb978bc2098cf49d551583d (diff) |
Support 'help' as a synonym for '?' in command line options
For command line options which permit '?' meaning 'please list the
permitted values', add support for 'help' as a synonym, by abstracting
the check out into a helper function.
This change means that in some cases where we were being lazy in
our string parsing, "?junk" will now be rejected as an invalid option
rather than being (undocumentedly) treated the same way as "?".
Update the documentation to use 'help' rather than '?', since '?'
is a shell metacharacter and thus prone to fail confusingly if there
is a single character filename in the current working directory and
the '?' has not been escaped. It's therefore better to steer users
towards 'help', though '?' is retained for backwards compatibility.
We do not, however, update the output of the system emulator's -help
(or any documentation autogenerated from the qemu-options.hx which
is the source of the -help text) because libvirt parses our -help
output and will break. At a later date when QEMU provides a better
interface so libvirt can avoid having to do this, we can update the
-help text too.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'linux-user/main.c')
-rw-r--r-- | linux-user/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/linux-user/main.c b/linux-user/main.c index a0ab8e839c..25eaa11a1f 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3140,7 +3140,7 @@ static void handle_arg_uname(const char *arg) static void handle_arg_cpu(const char *arg) { cpu_model = strdup(arg); - if (cpu_model == NULL || strcmp(cpu_model, "?") == 0) { + if (cpu_model == NULL || is_help_option(cpu_model)) { /* XXX: implement xxx_cpu_list for targets that still miss it */ #if defined(cpu_list_id) cpu_list_id(stdout, &fprintf, ""); @@ -3231,7 +3231,7 @@ struct qemu_argument arg_table[] = { {"s", "QEMU_STACK_SIZE", true, handle_arg_stack_size, "size", "set the stack size to 'size' bytes"}, {"cpu", "QEMU_CPU", true, handle_arg_cpu, - "model", "select CPU (-cpu ? for list)"}, + "model", "select CPU (-cpu help for list)"}, {"E", "QEMU_SET_ENV", true, handle_arg_set_env, "var=value", "sets targets environment variable (see below)"}, {"U", "QEMU_UNSET_ENV", true, handle_arg_unset_env, |