static void do_sendkey(const char *string)

{

    uint8_t keycodes[16];

    int nb_keycodes = 0;

    char keyname_buf[16];

    char *separator;

    int keyname_len, keycode, i;



    while (1) {

        separator = strchr(string, '-');

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

        if (keyname_len > 0) {

            pstrcpy(keyname_buf, sizeof(keyname_buf), string);

            if (keyname_len > sizeof(keyname_buf) - 1) {

                term_printf("invalid key: '%s...'\n", keyname_buf);

                return;

            }

            if (nb_keycodes == sizeof(keycodes)) {

                term_printf("too many keys\n");

                return;

            }

            keyname_buf[keyname_len] = 0;

            keycode = get_keycode(keyname_buf);

            if (keycode < 0) {

                term_printf("unknown key: '%s'\n", keyname_buf);

                return;

            }

            keycodes[nb_keycodes++] = keycode;

        }

        if (!separator)

            break;

        string = separator + 1;

    }

    /* key down events */

    for(i = 0; i < nb_keycodes; i++) {

        keycode = keycodes[i];

        if (keycode & 0x80)

            kbd_put_keycode(0xe0);

        kbd_put_keycode(keycode & 0x7f);

    }

    /* key up events */

    for(i = nb_keycodes - 1; i >= 0; i--) {

        keycode = keycodes[i];

        if (keycode & 0x80)

            kbd_put_keycode(0xe0);

        kbd_put_keycode(keycode | 0x80);

    }

}

static void do_sendkey(const char *string)

{

    uint8_t keycodes[16];

    int nb_keycodes = 0;

    char keyname_buf[16];

    char *separator;

    int keyname_len, keycode, i;



    while (1) {

        separator = strchr(string, '-');

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

        if (keyname_len > 0) {

            pstrcpy(keyname_buf, sizeof(keyname_buf), string);

            if (keyname_len > sizeof(keyname_buf) - 1) {

                term_printf("invalid key: '%s...'\n", keyname_buf);

                return;

            }

            if (nb_keycodes == sizeof(keycodes)) {

                term_printf("too many keys\n");

                return;

            }

            keyname_buf[keyname_len] = 0;

            keycode = get_keycode(keyname_buf);

            if (keycode < 0) {

                term_printf("unknown key: '%s'\n", keyname_buf);

                return;

            }

            keycodes[nb_keycodes++] = keycode;

        }

        if (!separator)

            break;

        string = separator + 1;

    }

    

    for(i = 0; i < nb_keycodes; i++) {

        keycode = keycodes[i];

        if (keycode & 0x80)

            kbd_put_keycode(0xe0);

        kbd_put_keycode(keycode & 0x7f);

    }

    

    for(i = nb_keycodes - 1; i >= 0; i--) {

        keycode = keycodes[i];

        if (keycode & 0x80)

            kbd_put_keycode(0xe0);

        kbd_put_keycode(keycode | 0x80);

    }

}

static void FUNC_0(const char *VAR_0)

{

    uint8_t keycodes[16];

    int VAR_1 = 0;

    char VAR_2[16];

    char *VAR_3;

    int VAR_4, VAR_5, VAR_6;



    while (1) {

        VAR_3 = strchr(VAR_0, '-');

        VAR_4 = VAR_3 ? VAR_3 - VAR_0 : strlen(VAR_0);

        if (VAR_4 > 0) {

            pstrcpy(VAR_2, sizeof(VAR_2), VAR_0);

            if (VAR_4 > sizeof(VAR_2) - 1) {

                term_printf("invalid key: '%s...'\n", VAR_2);

                return;

            }

            if (VAR_1 == sizeof(keycodes)) {

                term_printf("too many keys\n");

                return;

            }

            VAR_2[VAR_4] = 0;

            VAR_5 = get_keycode(VAR_2);

            if (VAR_5 < 0) {

                term_printf("unknown key: '%s'\n", VAR_2);

                return;

            }

            keycodes[VAR_1++] = VAR_5;

        }

        if (!VAR_3)

            break;

        VAR_0 = VAR_3 + 1;

    }

    

    for(VAR_6 = 0; VAR_6 < VAR_1; VAR_6++) {

        VAR_5 = keycodes[VAR_6];

        if (VAR_5 & 0x80)

            kbd_put_keycode(0xe0);

        kbd_put_keycode(VAR_5 & 0x7f);

    }

    

    for(VAR_6 = VAR_1 - 1; VAR_6 >= 0; VAR_6--) {

        VAR_5 = keycodes[VAR_6];

        if (VAR_5 & 0x80)

            kbd_put_keycode(0xe0);

        kbd_put_keycode(VAR_5 | 0x80);

    }

}

static void FUNC_0(const char *VAR_0)
{ uint8_t keycodes[16]; int VAR_1 = 0; char VAR_2[16]; char *VAR_3; int VAR_4, VAR_5, VAR_6; while (1) { VAR_3 = strchr(VAR_0, '-'); VAR_4 = VAR_3 ? VAR_3 - VAR_0 : strlen(VAR_0); if (VAR_4 > 0) { pstrcpy(VAR_2, sizeof(VAR_2), VAR_0); if (VAR_4 > sizeof(VAR_2) - 1) { term_printf("invalid key: '%s...'\n", VAR_2); return; } if (VAR_1 == sizeof(keycodes)) { term_printf("too many keys\n"); return; } VAR_2[VAR_4] = 0; VAR_5 = get_keycode(VAR_2); if (VAR_5 < 0) { term_printf("unknown key: '%s'\n", VAR_2); return; } keycodes[VAR_1++] = VAR_5; } if (!VAR_3)
break; VAR_0 = VAR_3 + 1; } for(VAR_6 = 0; VAR_6 < VAR_1; VAR_6++) { VAR_5 = keycodes[VAR_6]; if (VAR_5 & 0x80)
kbd_put_keycode(0xe0); kbd_put_keycode(VAR_5 & 0x7f); } for(VAR_6 = VAR_1 - 1; VAR_6 >= 0; VAR_6--) { VAR_5 = keycodes[VAR_6]; if (VAR_5 & 0x80)
kbd_put_keycode(0xe0); kbd_put_keycode(VAR_5 | 0x80); } }