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

Diff for /src/usr.bin/tmux/tty-keys.c between version 1.45 and 1.46

version 1.45, 2012/10/26 14:35:42 version 1.46, 2012/11/22 14:26:04
Line 724 
Line 724 
 int  int
 tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)  tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
 {  {
         u_int i, a, b;          u_int i, n;
         char  tmp[64], *endptr;          char  tmp[64], *endptr;
   
         /*          /*
          * Primary device attributes are \033[?a;b and secondary are           * Primary device attributes are \033[?a;b and secondary are
          * \033[>a;b;c. We only request attributes on xterm, so we only care           * \033[>a;b;c.
          * about the middle values which is the xterm version.  
          */           */
   
         *size = 0;          *size = 0;
   
         /* First three bytes are always \033[>. */          /* First three bytes are always \033[?. */
         if (buf[0] != '\033')          if (buf[0] != '\033')
                 return (-1);                  return (-1);
         if (len == 1)          if (len == 1)
Line 760 
Line 759 
         tmp[i] = '\0';          tmp[i] = '\0';
         *size = 4 + i;          *size = 4 + i;
   
         /* Only secondary is of interest. */          /* Only primary is of interest. */
         if (buf[2] != '>')          if (buf[2] != '?')
                 return (0);                  return (0);
   
         /* Convert version numbers. */          /* Convert service class. */
         a = strtoul(tmp, &endptr, 10);          n = strtoul(tmp, &endptr, 10);
         if (*endptr == ';') {          if (*endptr != ';')
                 b = strtoul(endptr + 1, &endptr, 10);                  n = 0;
                 if (*endptr != '\0' && *endptr != ';')  
                         b = 0;  
         } else  
                 a = b = 0;  
   
         log_debug("received xterm version %u", b);          log_debug("received service class %u", n);
         if (b < 500)          tty->service_class = n;
                 tty_set_version(tty, b);  
   
         return (0);          return (0);
 }  }

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46