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

Diff for /src/usr.bin/tmux/cmd.c between version 1.141 and 1.142

version 1.141, 2018/10/18 08:38:01 version 1.142, 2019/03/18 11:58:40
Line 319 
Line 319 
 static int  static int
 cmd_try_alias(int *argc, char ***argv)  cmd_try_alias(int *argc, char ***argv)
 {  {
         struct options_entry     *o;          struct options_entry             *o;
         int                       old_argc = *argc, new_argc;          struct options_array_item        *a;
         char                    **old_argv = *argv, **new_argv;          int                               old_argc = *argc, new_argc, i;
         u_int                     size, idx;          char                            **old_argv = *argv, **new_argv;
         int                       i;          size_t                            wanted;
         size_t                    wanted;          const char                       *s, *cp = NULL;
         const char               *s, *cp = NULL;  
   
         o = options_get_only(global_options, "command-alias");          o = options_get_only(global_options, "command-alias");
         if (o == NULL || options_array_size(o, &size) == -1 || size == 0)          if (o == NULL)
                 return (-1);                  return (-1);
   
         wanted = strlen(old_argv[0]);          wanted = strlen(old_argv[0]);
         for (idx = 0; idx < size; idx++) {  
                 s = options_array_get(o, idx);  
                 if (s == NULL)  
                         continue;  
   
                 cp = strchr(s, '=');          a = options_array_first(o);
                 if (cp == NULL || (size_t)(cp - s) != wanted)          while (a != NULL) {
                         continue;                  s = options_array_item_value(a);
                 if (strncmp(old_argv[0], s, wanted) == 0)                  if (s != NULL) {
                         break;                          cp = strchr(s, '=');
                           if (cp != NULL &&
                               (size_t)(cp - s) == wanted &&
                               strncmp(old_argv[0], s, wanted) == 0)
                                   break;
                   }
                   a = options_array_next(a);
         }          }
         if (idx == size)          if (a == NULL)
                 return (-1);                  return (-1);
   
         if (cmd_string_split(cp + 1, &new_argc, &new_argv) != 0)          if (cmd_string_split(cp + 1, &new_argc, &new_argv) != 0)

Legend:
Removed from v.1.141  
changed lines
  Added in v.1.142