[BACK]Return to key-string.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/key-string.c between version 1.61 and 1.62

version 1.61, 2020/05/25 18:57:25 version 1.62, 2020/06/27 10:19:59
Line 18 
Line 18 
   
 #include <sys/types.h>  #include <sys/types.h>
   
   #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <wchar.h>
   
 #include "tmux.h"  #include "tmux.h"
   
Line 163 
Line 165 
 key_string_lookup_string(const char *string)  key_string_lookup_string(const char *string)
 {  {
         static const char       *other = "!#()+,-.0123456789:;<=>'\r\t";          static const char       *other = "!#()+,-.0123456789:;<=>'\r\t";
         key_code                 key;          key_code                 key, modifiers;
         u_int                    u;          u_int                    u, i;
         key_code                 modifiers;          struct utf8_data         ud, *udp;
         struct utf8_data         ud;  
         u_int                    i;  
         enum utf8_state          more;          enum utf8_state          more;
         utf8_char                uc;          utf8_char                uc;
           char                     m[MB_LEN_MAX + 1];
           int                      mlen;
   
         /* Is this no key or any key? */          /* Is this no key or any key? */
         if (strcasecmp(string, "None") == 0)          if (strcasecmp(string, "None") == 0)
Line 181 
Line 183 
         if (string[0] == '0' && string[1] == 'x') {          if (string[0] == '0' && string[1] == 'x') {
                 if (sscanf(string + 2, "%x", &u) != 1)                  if (sscanf(string + 2, "%x", &u) != 1)
                         return (KEYC_UNKNOWN);                          return (KEYC_UNKNOWN);
                 if (u > 0x1fffff)                  mlen = wctomb(m, u);
                         return (KEYC_UNKNOWN);                  if (mlen <= 0 || mlen > MB_LEN_MAX)
                 return (u);                          return (KEYC_UNKNOWN);
                   m[mlen] = '\0';
   
                   udp = utf8_fromcstr(m);
                   if (udp == NULL ||
                       udp[0].size == 0 ||
                       udp[1].size != 0 ||
                       utf8_from_data(&udp[0], &uc) != UTF8_DONE) {
                           free(udp);
                           return (KEYC_UNKNOWN);
                   }
                   free(udp);
                   return (uc);
         }          }
   
         /* Check for modifiers. */          /* Check for modifiers. */

Legend:
Removed from v.1.61  
changed lines
  Added in v.1.62