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

Diff for /src/usr.bin/tmux/options.c between version 1.59 and 1.60

version 1.59, 2020/06/16 08:18:34 version 1.60, 2020/08/25 11:35:32
Line 95 
Line 95 
         return (strcmp(lhs->name, rhs->name));          return (strcmp(lhs->name, rhs->name));
 }  }
   
   static const char *
   options_map_name(const char *name)
   {
           const struct options_name_map   *map;
   
           for (map = options_other_names; map->from != NULL; map++) {
                   if (strcmp(map->from, name) == 0)
                           return (map->to);
           }
           return (name);
   }
   
 static const struct options_table_entry *  static const struct options_table_entry *
 options_parent_table_entry(struct options *oo, const char *s)  options_parent_table_entry(struct options *oo, const char *s)
 {  {
Line 204 
Line 216 
 struct options_entry *  struct options_entry *
 options_get_only(struct options *oo, const char *name)  options_get_only(struct options *oo, const char *name)
 {  {
         struct options_entry    o;          struct options_entry    o = { .name = name }, *found;
   
         o.name = name;          found = RB_FIND(options_tree, &oo->tree, &o);
         return (RB_FIND(options_tree, &oo->tree, &o));          if (found == NULL) {
                   o.name = options_map_name(name);
                   return (RB_FIND(options_tree, &oo->tree, &o));
           }
           return (found);
 }  }
   
 struct options_entry *  struct options_entry *
Line 608 
Line 624 
 options_match(const char *s, int *idx, int *ambiguous)  options_match(const char *s, int *idx, int *ambiguous)
 {  {
         const struct options_table_entry        *oe, *found;          const struct options_table_entry        *oe, *found;
         char                                    *name;          char                                    *parsed;
           const char                              *name;
         size_t                                   namelen;          size_t                                   namelen;
   
         name = options_parse(s, idx);          parsed = options_parse(s, idx);
         if (name == NULL)          if (parsed == NULL)
                 return (NULL);                  return (NULL);
         namelen = strlen(name);          if (*parsed == '@') {
   
         if (*name == '@') {  
                 *ambiguous = 0;                  *ambiguous = 0;
                 return (name);                  return (parsed);
         }          }
   
           name = options_map_name(parsed);
           namelen = strlen(name);
   
         found = NULL;          found = NULL;
         for (oe = options_table; oe->name != NULL; oe++) {          for (oe = options_table; oe->name != NULL; oe++) {
                 if (strcmp(oe->name, name) == 0) {                  if (strcmp(oe->name, name) == 0) {
Line 630 
Line 648 
                 if (strncmp(oe->name, name, namelen) == 0) {                  if (strncmp(oe->name, name, namelen) == 0) {
                         if (found != NULL) {                          if (found != NULL) {
                                 *ambiguous = 1;                                  *ambiguous = 1;
                                 free(name);                                  free(parsed);
                                 return (NULL);                                  return (NULL);
                         }                          }
                         found = oe;                          found = oe;
                 }                  }
         }          }
         free(name);          free(parsed);
         if (found == NULL) {          if (found == NULL) {
                 *ambiguous = 0;                  *ambiguous = 0;
                 return (NULL);                  return (NULL);

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60