/* * Return lynxkeycode represented by string src. returns -1 if not valid. * * This is simpler than what map_string_to_keysym() does for USE_KEYMAP, but * compatible with revmap() used for processing KEYMAP options in the * configuration file. - kw */ int lkcstring_to_lkc(const char *src) { int c = -1; if (strlen(src) == 1) { c = *src; } else if (strlen(src) == 2 && *src == '^') { c = src[1] & 037; } else if (strlen(src) >= 2 && isdigit(UCH(*src))) { char *next = 0; c = (int) strtol(src, &next, 0); if (next != 0 && *next != '\0') c = (-1); #ifdef USE_KEYMAPS } else { map_string_to_keysym(src, &c); #ifndef USE_SLANG if (c >= 0) { /* make curses-keys mapped from Keysym_Strings[] available here */ if ((c & LKC_MASK) > 255) c &= ~LKC_ISLKC; } #endif #endif } if (c == CH_ESC) { escape_bound = 1; } else if (c < -1) { c = (-1); } return c; }
int lkcstring_to_lkc( char *src ) { int ah; int c = -1; if ( strlen( src ) == 1 ) c = src[0]; else { if ( strlen( src ) == 2 && src[0] == '^' ) c = src[1] & 31; else { if ( strlen( src ) > 1 && ( *(short*)(*(int*)(__ctype_b_loc( )) + ( src[0] * 2 )) & 2048 ) ) { if ( sscanf( src, "%i", &c ) != 1 ) { return -1; } } else { map_string_to_keysym( src, &c ); if ( c >= 0 ) { if ( ( c & 2047 ) > 255 && ( c & 1024 ) == 0 ) { return -1; } } } } } if ( c == 27 ) escape_bound = 1; if ( c < -1 ) { return -1; } return c; }