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

Diff for /src/usr.bin/tmux/cmd-set-option.c between version 1.72 and 1.73

version 1.72, 2015/04/22 15:30:11 version 1.73, 2015/04/24 21:38:18
Line 289 
Line 289 
 {  {
         struct options_entry    *o;          struct options_entry    *o;
   
         if (oe->type != OPTIONS_TABLE_FLAG && value == NULL) {          switch (oe->type) {
                 cmdq_error(cmdq, "empty value");          case OPTIONS_TABLE_FLAG:
                 return (-1);          case OPTIONS_TABLE_CHOICE:
                   break;
           default:
                   if (value == NULL) {
                           cmdq_error(cmdq, "empty value");
                           return (-1);
                   }
         }          }
   
         o = NULL;          o = NULL;
Line 455 
Line 461 
         const char      **choicep;          const char      **choicep;
         int               n, choice = -1;          int               n, choice = -1;
   
         n = 0;          if (value == NULL) {
         for (choicep = oe->choices; *choicep != NULL; choicep++) {                  choice = options_get_number(oo, oe->name);
                 n++;                  if (choice < 2)
                 if (strncmp(*choicep, value, strlen(value)) != 0)                          choice = !choice;
                         continue;          } else {
                   n = 0;
                   for (choicep = oe->choices; *choicep != NULL; choicep++) {
                           n++;
                           if (strncmp(*choicep, value, strlen(value)) != 0)
                                   continue;
   
                 if (choice != -1) {                          if (choice != -1) {
                         cmdq_error(cmdq, "ambiguous value: %s", value);                                  cmdq_error(cmdq, "ambiguous value: %s", value);
                                   return (NULL);
                           }
                           choice = n - 1;
                   }
                   if (choice == -1) {
                           cmdq_error(cmdq, "unknown value: %s", value);
                         return (NULL);                          return (NULL);
                 }                  }
                 choice = n - 1;  
         }  
         if (choice == -1) {  
                 cmdq_error(cmdq, "unknown value: %s", value);  
                 return (NULL);  
         }          }
   
         return (options_set_number(oo, oe->name, choice));          return (options_set_number(oo, oe->name, choice));

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.73