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

Diff for /src/usr.bin/tmux/cmd-show-options.c between version 1.33 and 1.34

version 1.33, 2016/10/14 22:14:22 version 1.34, 2016/10/16 19:04:05
Line 27 
Line 27 
  * Show options.   * Show options.
  */   */
   
 static enum cmd_retval  cmd_show_options_exec(struct cmd *, struct cmd_q *);  static enum cmd_retval  cmd_show_options_exec(struct cmd *, struct cmdq_item *);
   
 static enum cmd_retval  cmd_show_options_one(struct cmd *, struct cmd_q *,  static enum cmd_retval  cmd_show_options_one(struct cmd *, struct cmdq_item *,
                             struct options *, int);                              struct options *, int);
 static enum cmd_retval  cmd_show_options_all(struct cmd *, struct cmd_q *,  static enum cmd_retval  cmd_show_options_all(struct cmd *, struct cmdq_item *,
                             struct options *, enum options_table_scope);                              struct options *, enum options_table_scope);
   
 const struct cmd_entry cmd_show_options_entry = {  const struct cmd_entry cmd_show_options_entry = {
Line 61 
Line 61 
 };  };
   
 static enum cmd_retval  static enum cmd_retval
 cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)  cmd_show_options_exec(struct cmd *self, struct cmdq_item *item)
 {  {
         struct args                     *args = self->args;          struct args                     *args = self->args;
         struct session                  *s = cmdq->state.tflag.s;          struct session                  *s = item->state.tflag.s;
         struct winlink                  *wl = cmdq->state.tflag.wl;          struct winlink                  *wl = item->state.tflag.wl;
         struct options                  *oo;          struct options                  *oo;
         enum options_table_scope         scope;          enum options_table_scope         scope;
         int                              quiet;          int                              quiet;
Line 82 
Line 82 
                 else if (wl == NULL) {                  else if (wl == NULL) {
                         target = args_get(args, 't');                          target = args_get(args, 't');
                         if (target != NULL) {                          if (target != NULL) {
                                 cmdq_error(cmdq, "no such window: %s", target);                                  cmdq_error(item, "no such window: %s", target);
                         } else                          } else
                                 cmdq_error(cmdq, "no current window");                                  cmdq_error(item, "no current window");
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 } else                  } else
                         oo = wl->window->options;                          oo = wl->window->options;
Line 95 
Line 95 
                 else if (s == NULL) {                  else if (s == NULL) {
                         target = args_get(args, 't');                          target = args_get(args, 't');
                         if (target != NULL) {                          if (target != NULL) {
                                 cmdq_error(cmdq, "no such session: %s", target);                                  cmdq_error(item, "no such session: %s", target);
                         } else                          } else
                                 cmdq_error(cmdq, "no current session");                                  cmdq_error(item, "no current session");
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 } else                  } else
                         oo = s->options;                          oo = s->options;
Line 105 
Line 105 
   
         quiet = args_has(self->args, 'q');          quiet = args_has(self->args, 'q');
         if (args->argc == 0)          if (args->argc == 0)
                 return (cmd_show_options_all(self, cmdq, oo, scope));                  return (cmd_show_options_all(self, item, oo, scope));
         else          else
                 return (cmd_show_options_one(self, cmdq, oo, quiet));                  return (cmd_show_options_one(self, item, oo, quiet));
 }  }
   
 static enum cmd_retval  static enum cmd_retval
 cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,  cmd_show_options_one(struct cmd *self, struct cmdq_item *item,
     struct options *oo, int quiet)      struct options *oo, int quiet)
 {  {
         struct args                             *args = self->args;          struct args                             *args = self->args;
Line 125 
Line 125 
                 if ((o = options_find1(oo, name)) == NULL) {                  if ((o = options_find1(oo, name)) == NULL) {
                         if (quiet)                          if (quiet)
                                 return (CMD_RETURN_NORMAL);                                  return (CMD_RETURN_NORMAL);
                         cmdq_error(cmdq, "unknown option: %s", name);                          cmdq_error(item, "unknown option: %s", name);
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
                 if (args_has(self->args, 'v'))                  if (args_has(self->args, 'v'))
                         cmdq_print(cmdq, "%s", o->str);                          cmdq_print(item, "%s", o->str);
                 else                  else
                         cmdq_print(cmdq, "%s \"%s\"", o->name, o->str);                          cmdq_print(item, "%s \"%s\"", o->name, o->str);
                 return (CMD_RETURN_NORMAL);                  return (CMD_RETURN_NORMAL);
         }          }
   
         oe = NULL;          oe = NULL;
         if (options_table_find(name, &oe) != 0) {          if (options_table_find(name, &oe) != 0) {
                 cmdq_error(cmdq, "ambiguous option: %s", name);                  cmdq_error(item, "ambiguous option: %s", name);
                 return (CMD_RETURN_ERROR);                  return (CMD_RETURN_ERROR);
         }          }
         if (oe == NULL) {          if (oe == NULL) {
                 if (quiet)                  if (quiet)
                         return (CMD_RETURN_NORMAL);                          return (CMD_RETURN_NORMAL);
                 cmdq_error(cmdq, "unknown option: %s", name);                  cmdq_error(item, "unknown option: %s", name);
                 return (CMD_RETURN_ERROR);                  return (CMD_RETURN_ERROR);
         }          }
         if (oe->style != NULL) {          if (oe->style != NULL) {
Line 154 
Line 154 
                 return (CMD_RETURN_NORMAL);                  return (CMD_RETURN_NORMAL);
         optval = options_table_print_entry(oe, o, args_has(self->args, 'v'));          optval = options_table_print_entry(oe, o, args_has(self->args, 'v'));
         if (args_has(self->args, 'v'))          if (args_has(self->args, 'v'))
                 cmdq_print(cmdq, "%s", optval);                  cmdq_print(item, "%s", optval);
         else          else
                 cmdq_print(cmdq, "%s %s", oe->name, optval);                  cmdq_print(item, "%s %s", oe->name, optval);
         return (CMD_RETURN_NORMAL);          return (CMD_RETURN_NORMAL);
 }  }
   
 static enum cmd_retval  static enum cmd_retval
 cmd_show_options_all(struct cmd *self, struct cmd_q *cmdq, struct options *oo,  cmd_show_options_all(struct cmd *self, struct cmdq_item *item,
     enum options_table_scope scope)      struct options *oo, enum options_table_scope scope)
 {  {
         const struct options_table_entry        *oe;          const struct options_table_entry        *oe;
         struct options_entry                    *o;          struct options_entry                    *o;
Line 173 
Line 173 
         while (o != NULL) {          while (o != NULL) {
                 if (*o->name == '@') {                  if (*o->name == '@') {
                         if (args_has(self->args, 'v'))                          if (args_has(self->args, 'v'))
                                 cmdq_print(cmdq, "%s", o->str);                                  cmdq_print(item, "%s", o->str);
                         else                          else
                                 cmdq_print(cmdq, "%s \"%s\"", o->name, o->str);                                  cmdq_print(item, "%s \"%s\"", o->name, o->str);
                 }                  }
                 o = options_next(o);                  o = options_next(o);
         }          }
Line 188 
Line 188 
                         continue;                          continue;
                 optval = options_table_print_entry(oe, o, vflag);                  optval = options_table_print_entry(oe, o, vflag);
                 if (vflag)                  if (vflag)
                         cmdq_print(cmdq, "%s", optval);                          cmdq_print(item, "%s", optval);
                 else                  else
                         cmdq_print(cmdq, "%s %s", oe->name, optval);                          cmdq_print(item, "%s %s", oe->name, optval);
         }          }
   
         return (CMD_RETURN_NORMAL);          return (CMD_RETURN_NORMAL);

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34