[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.13 and 1.14

version 1.13, 2009/08/08 21:52:43 version 1.14, 2009/08/11 12:53:37
Line 31 
Line 31 
   
 const struct cmd_entry cmd_set_option_entry = {  const struct cmd_entry cmd_set_option_entry = {
         "set-option", "set",          "set-option", "set",
         "[-agu] " CMD_OPTION_SESSION_USAGE,          "[-agu] " CMD_TARGET_SESSION_USAGE " option [value]",
         0, CMD_CHFLAG('a')|CMD_CHFLAG('g')|CMD_CHFLAG('u'),          CMD_ARG12, CMD_CHFLAG('a')|CMD_CHFLAG('g')|CMD_CHFLAG('u'),
         NULL,          NULL,
         cmd_option_parse,          cmd_target_parse,
         cmd_set_option_exec,          cmd_set_option_exec,
         cmd_option_free,          cmd_target_free,
         cmd_option_print          cmd_target_print
 };  };
   
 const char *set_option_status_keys_list[] = {  const char *set_option_status_keys_list[] = {
Line 95 
Line 95 
 int  int
 cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)  cmd_set_option_exec(struct cmd *self, struct cmd_ctx *ctx)
 {  {
         struct cmd_option_data          *data = self->data;          struct cmd_target_data          *data = self->data;
         struct session                  *s;          struct session                  *s;
         struct client                   *c;          struct client                   *c;
         struct options                  *oo;          struct options                  *oo;
Line 110 
Line 110 
                 oo = &s->options;                  oo = &s->options;
         }          }
   
         if (*data->option == '\0') {          if (*data->arg == '\0') {
                 ctx->error(ctx, "invalid option");                  ctx->error(ctx, "invalid option");
                 return (-1);                  return (-1);
         }          }
   
         entry = NULL;          entry = NULL;
         for (opt = set_option_table; opt->name != NULL; opt++) {          for (opt = set_option_table; opt->name != NULL; opt++) {
                 if (strncmp(opt->name, data->option, strlen(data->option)) != 0)                  if (strncmp(opt->name, data->arg, strlen(data->arg)) != 0)
                         continue;                          continue;
                 if (entry != NULL) {                  if (entry != NULL) {
                         ctx->error(ctx, "ambiguous option: %s", data->option);                          ctx->error(ctx, "ambiguous option: %s", data->arg);
                         return (-1);                          return (-1);
                 }                  }
                 entry = opt;                  entry = opt;
   
                 /* Bail now if an exact match. */                  /* Bail now if an exact match. */
                 if (strcmp(entry->name, data->option) == 0)                  if (strcmp(entry->name, data->arg) == 0)
                         break;                          break;
         }          }
         if (entry == NULL) {          if (entry == NULL) {
                 ctx->error(ctx, "unknown option: %s", data->option);                  ctx->error(ctx, "unknown option: %s", data->arg);
                 return (-1);                  return (-1);
         }          }
   
Line 140 
Line 140 
                             "can't unset global option: %s", entry->name);                              "can't unset global option: %s", entry->name);
                         return (-1);                          return (-1);
                 }                  }
                 if (data->value != NULL) {                  if (data->arg2 != NULL) {
                         ctx->error(ctx,                          ctx->error(ctx,
                             "value passed to unset option: %s", entry->name);                              "value passed to unset option: %s", entry->name);
                         return (-1);                          return (-1);
Line 152 
Line 152 
                 switch (entry->type) {                  switch (entry->type) {
                 case SET_OPTION_STRING:                  case SET_OPTION_STRING:
                         set_option_string(ctx, oo, entry,                          set_option_string(ctx, oo, entry,
                             data->value, data->chflags & CMD_CHFLAG('a'));                              data->arg2, data->chflags & CMD_CHFLAG('a'));
                         break;                          break;
                 case SET_OPTION_NUMBER:                  case SET_OPTION_NUMBER:
                         set_option_number(ctx, oo, entry, data->value);                          set_option_number(ctx, oo, entry, data->arg2);
                         break;                          break;
                 case SET_OPTION_KEY:                  case SET_OPTION_KEY:
                         set_option_key(ctx, oo, entry, data->value);                          set_option_key(ctx, oo, entry, data->arg2);
                         break;                          break;
                 case SET_OPTION_COLOUR:                  case SET_OPTION_COLOUR:
                         set_option_colour(ctx, oo, entry, data->value);                          set_option_colour(ctx, oo, entry, data->arg2);
                         break;                          break;
                 case SET_OPTION_ATTRIBUTES:                  case SET_OPTION_ATTRIBUTES:
                         set_option_attributes(ctx, oo, entry, data->value);                          set_option_attributes(ctx, oo, entry, data->arg2);
                         break;                          break;
                 case SET_OPTION_FLAG:                  case SET_OPTION_FLAG:
                         set_option_flag(ctx, oo, entry, data->value);                          set_option_flag(ctx, oo, entry, data->arg2);
                         break;                          break;
                 case SET_OPTION_CHOICE:                  case SET_OPTION_CHOICE:
                         set_option_choice(ctx, oo, entry, data->value);                          set_option_choice(ctx, oo, entry, data->arg2);
                         break;                          break;
                 }                  }
         }          }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14