int strtokeys(const char *keystr, unsigned int *keys, int max_keys) { int key, nb_keys; const char *p; p = keystr; nb_keys = 0; for (;;) { skip_spaces(&p); if (*p == '\0') break; key = strtokey(&p); keys[nb_keys++] = key; compose_keys(keys, &nb_keys); if (nb_keys >= max_keys) break; } return nb_keys; }
/* * Convert a key chord string to its key code. */ size_t strtochord(char *buf, size_t *len) { size_t key, l; key = strtokey(buf, &l); if (key == KBD_NOKEY) { *len = 0; return KBD_NOKEY; } *len = l; if (key == KBD_CTRL || key == KBD_META) { size_t k = strtochord(buf + l, &l); if (k == KBD_NOKEY) { *len = 0; return KBD_NOKEY; } *len += l; key |= k; } return key; }