Revision ab2d3187
b/monitor.c | ||
---|---|---|
223 | 223 |
return cmd->user_print != NULL; |
224 | 224 |
} |
225 | 225 |
|
226 |
static void monitor_print_qobject(Monitor *mon, const QObject *data) |
|
227 |
{ |
|
228 |
switch (qobject_type(data)) { |
|
229 |
case QTYPE_QSTRING: |
|
230 |
monitor_printf(mon, "%s",qstring_get_str(qobject_to_qstring(data))); |
|
231 |
break; |
|
232 |
case QTYPE_QINT: |
|
233 |
monitor_printf(mon, "%" PRId64,qint_get_int(qobject_to_qint(data))); |
|
234 |
break; |
|
235 |
default: |
|
236 |
monitor_printf(mon, "ERROR: unsupported type: %d", |
|
237 |
qobject_type(data)); |
|
238 |
break; |
|
239 |
} |
|
240 |
|
|
241 |
monitor_puts(mon, "\n"); |
|
242 |
} |
|
243 |
|
|
226 | 244 |
static int compare_cmd(const char *name, const char *list) |
227 | 245 |
{ |
228 | 246 |
const char *p, *pstart; |
... | ... | |
322 | 340 |
help_cmd(mon, "info"); |
323 | 341 |
} |
324 | 342 |
|
325 |
static void do_info_version(Monitor *mon) |
|
343 |
/** |
|
344 |
* do_info_version(): Show QEMU version |
|
345 |
*/ |
|
346 |
static void do_info_version(Monitor *mon, QObject **ret_data) |
|
326 | 347 |
{ |
327 |
monitor_printf(mon, "%s\n", QEMU_VERSION QEMU_PKGVERSION);
|
|
348 |
*ret_data = QOBJECT(qstring_from_str(QEMU_VERSION QEMU_PKGVERSION));
|
|
328 | 349 |
} |
329 | 350 |
|
330 | 351 |
static void do_info_name(Monitor *mon) |
... | ... | |
1860 | 1881 |
.args_type = "", |
1861 | 1882 |
.params = "", |
1862 | 1883 |
.help = "show the version of QEMU", |
1863 |
.mhandler.info = do_info_version, |
|
1884 |
.user_print = monitor_print_qobject, |
|
1885 |
.mhandler.info_new = do_info_version, |
|
1864 | 1886 |
}, |
1865 | 1887 |
{ |
1866 | 1888 |
.name = "network", |
Also available in: Unified diff