From 922910ce42d15bdb7c2347436b1b5798b5401de4 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 20 Jan 2010 22:58:34 +0100 Subject: qdev: Add help for property value When called with property value "?", a help text will be printed (instead of an error message). This is useful for command lines like qemu -device e1000,mac=? and is already standard for other command line options. A better help text could be provided by extending the Property structure with a desc field. Signed-off-by: Stefan Weil Signed-off-by: Anthony Liguori --- hw/qdev-properties.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 8547ad27d4..f5ca05fe87 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -565,8 +565,13 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value) return -1; } if (prop->info->parse(dev, prop, value) != 0) { - fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n", - dev->info->name, name, value); + if (strcmp(value, "?") != 0) { + fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n", + dev->info->name, name, value); + } else { + fprintf(stderr, "%s.%s=%s\n", + dev->info->name, name, prop->info->name); + } return -1; } return 0; -- cgit v1.2.3