Revision 48a32bed monitor.c

b/monitor.c
64 64
#include "trace/control.h"
65 65
#include "ui/qemu-spice.h"
66 66
#include "memory.h"
67
#include "qmp-commands.h"
68
#include "hmp.h"
67 69

  
68 70
//#define DEBUG
69 71
//#define DEBUG_COMPLETION
......
760 762
        'micro': %d }, 'package': %s }", major, minor, micro, QEMU_PKGVERSION);
761 763
}
762 764

  
763
static void do_info_name_print(Monitor *mon, const QObject *data)
764
{
765
    QDict *qdict;
766

  
767
    qdict = qobject_to_qdict(data);
768
    if (qdict_size(qdict) == 0) {
769
        return;
770
    }
771

  
772
    monitor_printf(mon, "%s\n", qdict_get_str(qdict, "name"));
773
}
774

  
775
static void do_info_name(Monitor *mon, QObject **ret_data)
776
{
777
    *ret_data = qemu_name ? qobject_from_jsonf("{'name': %s }", qemu_name) :
778
                            qobject_from_jsonf("{}");
779
}
780

  
781 765
static QObject *get_cmd_dict(const char *name)
782 766
{
783 767
    const char *p;
......
3094 3078
        .args_type  = "",
3095 3079
        .params     = "",
3096 3080
        .help       = "show the current VM name",
3097
        .user_print = do_info_name_print,
3098
        .mhandler.info_new = do_info_name,
3081
        .mhandler.info = hmp_info_name,
3099 3082
    },
3100 3083
    {
3101 3084
        .name       = "uuid",
......
3287 3270
    },
3288 3271
#endif
3289 3272
    {
3290
        .name       = "name",
3291
        .args_type  = "",
3292
        .params     = "",
3293
        .help       = "show the current VM name",
3294
        .user_print = do_info_name_print,
3295
        .mhandler.info_new = do_info_name,
3296
    },
3297
    {
3298 3273
        .name       = "uuid",
3299 3274
        .args_type  = "",
3300 3275
        .params     = "",

Also available in: Unified diff