diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-10-08 10:04:15 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-10-08 10:04:16 +0100 |
commit | df51a005192ee40b469c9714d451bf49b6eb7fa7 (patch) | |
tree | fd945907bef44d6a19c28d8d174f69039a08b2b6 /qdev-monitor.c | |
parent | e2e3436add538be0e558cdc42f3e6b76e9deb0f9 (diff) | |
parent | 1195fa2b08d98ab503155c5cee8831d1ef91aac5 (diff) |
Merge remote-tracking branch 'remotes/elmarco/tags/option-pull-request' into staging
CLI help improvements
PULLv2:
- fix uninitialized "seentype" variable in qom-test
# gpg: Signature made Fri 05 Oct 2018 13:28:21 BST
# gpg: using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
# gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5
* remotes/elmarco/tags/option-pull-request:
vl: list user creatable properties when 'help' is argument
hostmem: add some properties description
vl: handle -object help
tests/qom-proplist: check class properties iterator
tests/qom-proplist: check properties are not listed multiple times
tests/qom-proplist: check duplicate "bv" property registration failed
qom/object: register 'type' property as class property
qom/object: fix iterating properties over a class
qemu-option: improve qemu_opts_print_help() output
qemu-option: add help fallback to print the list of options
cutils: add qemu_pstrcmp0()
qdev-monitor: print help to stdout
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qdev-monitor.c')
-rw-r--r-- | qdev-monitor.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/qdev-monitor.c b/qdev-monitor.c index 61e0300991..802c18a74e 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -104,22 +104,31 @@ static bool qdev_class_has_alias(DeviceClass *dc) return (qdev_class_get_alias(dc) != NULL); } +static void out_printf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + monitor_vfprintf(stdout, fmt, ap); + va_end(ap); +} + static void qdev_print_devinfo(DeviceClass *dc) { - error_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc))); + out_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc))); if (dc->bus_type) { - error_printf(", bus %s", dc->bus_type); + out_printf(", bus %s", dc->bus_type); } if (qdev_class_has_alias(dc)) { - error_printf(", alias \"%s\"", qdev_class_get_alias(dc)); + out_printf(", alias \"%s\"", qdev_class_get_alias(dc)); } if (dc->desc) { - error_printf(", desc \"%s\"", dc->desc); + out_printf(", desc \"%s\"", dc->desc); } if (!dc->user_creatable) { - error_printf(", no-user"); + out_printf(", no-user"); } - error_printf("\n"); + out_printf("\n"); } static void qdev_print_devinfos(bool show_no_user) @@ -155,8 +164,7 @@ static void qdev_print_devinfos(bool show_no_user) continue; } if (!cat_printed) { - error_printf("%s%s devices:\n", i ? "\n" : "", - cat_name[i]); + out_printf("%s%s devices:\n", i ? "\n" : "", cat_name[i]); cat_printed = true; } qdev_print_devinfo(dc); @@ -278,13 +286,11 @@ int qdev_device_help(QemuOpts *opts) } for (prop = prop_list; prop; prop = prop->next) { - error_printf("%s.%s=%s", driver, - prop->value->name, - prop->value->type); + out_printf("%s.%s=%s", driver, prop->value->name, prop->value->type); if (prop->value->has_description) { - error_printf(" (%s)\n", prop->value->description); + out_printf(" (%s)\n", prop->value->description); } else { - error_printf("\n"); + out_printf("\n"); } } |