aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-08-02 13:45:54 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2012-08-02 13:16:42 -0500
commitc8057f951d64de93bfd01569c0a725baa9f94372 (patch)
treea923a40f0857c4de2e8feddbdadc4a2cc6d6bb59 /hw
parent02d2bd5d57812154cfb978bc2098cf49d551583d (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 'hw')
-rw-r--r--hw/mips_jazz.c2
-rw-r--r--hw/qdev-monitor.c4
-rw-r--r--hw/watchdog.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c
index bf1b799c4d..db927f14d0 100644
--- a/hw/mips_jazz.c
+++ b/hw/mips_jazz.c
@@ -239,7 +239,7 @@ static void mips_jazz_init(MemoryRegion *address_space,
dp83932_init(nd, 0x80001000, 2, get_system_memory(), rc4030[4],
rc4030_opaque, rc4030_dma_memory_rw);
break;
- } else if (strcmp(nd->model, "?") == 0) {
+ } else if (is_help_option(nd->model)) {
fprintf(stderr, "qemu: Supported NICs: dp83932\n");
exit(1);
} else {
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index 7915b4500d..b22a37a00c 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -138,13 +138,13 @@ int qdev_device_help(QemuOpts *opts)
ObjectClass *klass;
driver = qemu_opt_get(opts, "driver");
- if (driver && !strcmp(driver, "?")) {
+ if (driver && is_help_option(driver)) {
bool show_no_user = false;
object_class_foreach(qdev_print_devinfo, TYPE_DEVICE, false, &show_no_user);
return 1;
}
- if (!driver || !qemu_opt_get(opts, "?")) {
+ if (!driver || !qemu_opt_has_help_opt(opts)) {
return 0;
}
diff --git a/hw/watchdog.c b/hw/watchdog.c
index a42124d520..b52acedd98 100644
--- a/hw/watchdog.c
+++ b/hw/watchdog.c
@@ -55,7 +55,7 @@ int select_watchdog(const char *p)
QemuOpts *opts;
/* -watchdog ? lists available devices and exits cleanly. */
- if (strcmp(p, "?") == 0) {
+ if (is_help_option(p)) {
QLIST_FOREACH(model, &watchdog_list, entry) {
fprintf(stderr, "\t%s\t%s\n",
model->wdt_name, model->wdt_description);