void hmp_sendkey(Monitor *mon, const QDict *qdict)

{

    const char *keys = qdict_get_str(qdict, "keys");

    KeyValueList *keylist, *head = NULL, *tmp = NULL;

    int has_hold_time = qdict_haskey(qdict, "hold-time");

    int hold_time = qdict_get_try_int(qdict, "hold-time", -1);

    Error *err = NULL;

    char keyname_buf[16];

    char *separator;

    int keyname_len;



    while (1) {

        separator = strchr(keys, '-');

        keyname_len = separator ? separator - keys : strlen(keys);

        pstrcpy(keyname_buf, sizeof(keyname_buf), keys);



        /* Be compatible with old interface, convert user inputted "<" */

        if (!strncmp(keyname_buf, "<", 1) && keyname_len == 1) {

            pstrcpy(keyname_buf, sizeof(keyname_buf), "less");

            keyname_len = 4;

        }

        keyname_buf[keyname_len] = 0;



        keylist = g_malloc0(sizeof(*keylist));

        keylist->value = g_malloc0(sizeof(*keylist->value));



        if (!head) {

            head = keylist;

        }

        if (tmp) {

            tmp->next = keylist;

        }

        tmp = keylist;



        if (strstart(keyname_buf, "0x", NULL)) {

            char *endp;

            int value = strtoul(keyname_buf, &endp, 0);

            if (*endp != '\0') {

                goto err_out;

            }

            keylist->value->type = KEY_VALUE_KIND_NUMBER;

            keylist->value->u.number = value;

        } else {

            int idx = index_from_key(keyname_buf);

            if (idx == Q_KEY_CODE__MAX) {

                goto err_out;

            }

            keylist->value->type = KEY_VALUE_KIND_QCODE;

            keylist->value->u.qcode = idx;

        }



        if (!separator) {

            break;

        }

        keys = separator + 1;

    }



    qmp_send_key(head, has_hold_time, hold_time, &err);

    hmp_handle_error(mon, &err);



out:

    qapi_free_KeyValueList(head);

    return;



err_out:

    monitor_printf(mon, "invalid parameter: %s\n", keyname_buf);

    goto out;

}

void hmp_sendkey(Monitor *mon, const QDict *qdict)

{

    const char *keys = qdict_get_str(qdict, "keys");

    KeyValueList *keylist, *head = NULL, *tmp = NULL;

    int has_hold_time = qdict_haskey(qdict, "hold-time");

    int hold_time = qdict_get_try_int(qdict, "hold-time", -1);

    Error *err = NULL;

    char keyname_buf[16];

    char *separator;

    int keyname_len;



    while (1) {

        separator = strchr(keys, '-');

        keyname_len = separator ? separator - keys : strlen(keys);

        pstrcpy(keyname_buf, sizeof(keyname_buf), keys);



        

        if (!strncmp(keyname_buf, "<", 1) && keyname_len == 1) {

            pstrcpy(keyname_buf, sizeof(keyname_buf), "less");

            keyname_len = 4;

        }

        keyname_buf[keyname_len] = 0;



        keylist = g_malloc0(sizeof(*keylist));

        keylist->value = g_malloc0(sizeof(*keylist->value));



        if (!head) {

            head = keylist;

        }

        if (tmp) {

            tmp->next = keylist;

        }

        tmp = keylist;



        if (strstart(keyname_buf, "0x", NULL)) {

            char *endp;

            int value = strtoul(keyname_buf, &endp, 0);

            if (*endp != '\0') {

                goto err_out;

            }

            keylist->value->type = KEY_VALUE_KIND_NUMBER;

            keylist->value->u.number = value;

        } else {

            int idx = index_from_key(keyname_buf);

            if (idx == Q_KEY_CODE__MAX) {

                goto err_out;

            }

            keylist->value->type = KEY_VALUE_KIND_QCODE;

            keylist->value->u.qcode = idx;

        }



        if (!separator) {

            break;

        }

        keys = separator + 1;

    }



    qmp_send_key(head, has_hold_time, hold_time, &err);

    hmp_handle_error(mon, &err);



out:

    qapi_free_KeyValueList(head);

    return;



err_out:

    monitor_printf(mon, "invalid parameter: %s\n", keyname_buf);

    goto out;

}

    char keyname_buf[16];         pstrcpy(keyname_buf, sizeof(keyname_buf), keys);         if (!strncmp(keyname_buf, "<", 1) && keyname_len == 1) {             pstrcpy(keyname_buf, sizeof(keyname_buf), "less");         keyname_buf[keyname_len] = 0;         if (strstart(keyname_buf, "0x", NULL)) {             int value = strtoul(keyname_buf, &endp, 0);             if (*endp != '\0') {             int idx = index_from_key(keyname_buf);     monitor_printf(mon, "invalid parameter: %s\n", keyname_buf);
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)

{

    const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2");

    KeyValueList *keylist, *head = NULL, *tmp = NULL;

    int VAR_3 = qdict_haskey(VAR_1, "hold-time");

    int VAR_4 = qdict_get_try_int(VAR_1, "hold-time", -1);

    Error *err = NULL;

    char VAR_5[16];

    char *VAR_6;

    int VAR_7;



    while (1) {

        VAR_6 = strchr(VAR_2, '-');

        VAR_7 = VAR_6 ? VAR_6 - VAR_2 : strlen(VAR_2);

        pstrcpy(VAR_5, sizeof(VAR_5), VAR_2);



        

        if (!strncmp(VAR_5, "<", 1) && VAR_7 == 1) {

            pstrcpy(VAR_5, sizeof(VAR_5), "less");

            VAR_7 = 4;

        }

        VAR_5[VAR_7] = 0;



        keylist = g_malloc0(sizeof(*keylist));

        keylist->VAR_9 = g_malloc0(sizeof(*keylist->VAR_9));



        if (!head) {

            head = keylist;

        }

        if (tmp) {

            tmp->next = keylist;

        }

        tmp = keylist;



        if (strstart(VAR_5, "0x", NULL)) {

            char *VAR_8;

            int VAR_9 = strtoul(VAR_5, &VAR_8, 0);

            if (*VAR_8 != '\0') {

                goto err_out;

            }

            keylist->VAR_9->type = KEY_VALUE_KIND_NUMBER;

            keylist->VAR_9->u.number = VAR_9;

        } else {

            int VAR_10 = index_from_key(VAR_5);

            if (VAR_10 == Q_KEY_CODE__MAX) {

                goto err_out;

            }

            keylist->VAR_9->type = KEY_VALUE_KIND_QCODE;

            keylist->VAR_9->u.qcode = VAR_10;

        }



        if (!VAR_6) {

            break;

        }

        VAR_2 = VAR_6 + 1;

    }



    qmp_send_key(head, VAR_3, VAR_4, &err);

    hmp_handle_error(VAR_0, &err);



out:

    qapi_free_KeyValueList(head);

    return;



err_out:

    monitor_printf(VAR_0, "invalid parameter: %s\n", VAR_5);

    goto out;

}

void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{ const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); KeyValueList *keylist, *head = NULL, *tmp = NULL; int VAR_3 = qdict_haskey(VAR_1, "hold-time"); int VAR_4 = qdict_get_try_int(VAR_1, "hold-time", -1); Error *err = NULL; char VAR_5[16]; char *VAR_6; int VAR_7; while (1) { VAR_6 = strchr(VAR_2, '-'); VAR_7 = VAR_6 ? VAR_6 - VAR_2 : strlen(VAR_2); pstrcpy(VAR_5, sizeof(VAR_5), VAR_2); if (!strncmp(VAR_5, "<", 1) && VAR_7 == 1) { pstrcpy(VAR_5, sizeof(VAR_5), "less"); VAR_7 = 4; } VAR_5[VAR_7] = 0; keylist = g_malloc0(sizeof(*keylist)); keylist->VAR_9 = g_malloc0(sizeof(*keylist->VAR_9)); if (!head) { head = keylist; } if (tmp) { tmp->next = keylist; } tmp = keylist; if (strstart(VAR_5, "0x", NULL)) { char *VAR_8; int VAR_9 = strtoul(VAR_5, &VAR_8, 0); if (*VAR_8 != '\0') { goto err_out; } keylist->VAR_9->type = KEY_VALUE_KIND_NUMBER; keylist->VAR_9->u.number = VAR_9; } else { int VAR_10 = index_from_key(VAR_5); if (VAR_10 == Q_KEY_CODE__MAX) { goto err_out; } keylist->VAR_9->type = KEY_VALUE_KIND_QCODE; keylist->VAR_9->u.qcode = VAR_10; } if (!VAR_6) { break; } VAR_2 = VAR_6 + 1; } qmp_send_key(head, VAR_3, VAR_4, &err); hmp_handle_error(VAR_0, &err); out:
qapi_free_KeyValueList(head); return; err_out:
monitor_printf(VAR_0, "invalid parameter: %s\n", VAR_5); goto out; }