Lines Matching defs:string
1 /* $OpenBSD: key-string.c,v 1.75 2024/08/23 13:25:39 nicm Exp $ */
23 #include <string.h>
32 const char *string;
194 /* Find key string in table. */
196 key_string_search_table(const char *string)
201 if (strcasecmp(string, key_string_table[i].string) == 0)
205 if (sscanf(string, "User%u", &user) == 1 && user < KEYC_NUSER)
213 key_string_get_modifiers(const char **string)
218 while (((*string)[0] != '\0') && (*string)[1] == '-') {
219 switch ((*string)[0]) {
233 *string = NULL;
236 *string += 2;
241 /* Lookup a string and convert to a key value. */
243 key_string_lookup_string(const char *string)
254 if (strcasecmp(string, "None") == 0)
256 if (strcasecmp(string, "Any") == 0)
260 if (string[0] == '0' && string[1] == 'x') {
261 if (sscanf(string + 2, "%x", &u) != 1)
283 if (string[0] == '^' && string[1] != '\0') {
284 if (string[2] == '\0')
285 return (tolower((u_char)string[1])|KEYC_CTRL);
287 string++;
291 modifiers |= key_string_get_modifiers(&string);
292 if (string == NULL || string[0] == '\0')
296 if (string[1] == '\0' && (u_char)string[0] <= 127) {
297 key = (u_char)string[0];
302 if ((more = utf8_open(&ud, (u_char)*string)) == UTF8_MORE) {
303 if (strlen(string) != ud.size)
306 more = utf8_append(&ud, (u_char)string[i]);
315 key = key_string_search_table(string);
325 /* Convert a key code into string format, with prefix if necessary. */
419 /* Try the key against the string table. */
425 strlcat(out, key_string_table[i].string, sizeof out);