=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-show-options.c,v retrieving revision 1.33 retrieving revision 1.34 diff -c -r1.33 -r1.34 *** src/usr.bin/tmux/cmd-show-options.c 2016/10/14 22:14:22 1.33 --- src/usr.bin/tmux/cmd-show-options.c 2016/10/16 19:04:05 1.34 *************** *** 1,4 **** ! /* $OpenBSD: cmd-show-options.c,v 1.33 2016/10/14 22:14:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-show-options.c,v 1.34 2016/10/16 19:04:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 27,37 **** * Show options. */ ! static enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmd_q *); ! static enum cmd_retval cmd_show_options_one(struct cmd *, struct cmd_q *, struct options *, int); ! static enum cmd_retval cmd_show_options_all(struct cmd *, struct cmd_q *, struct options *, enum options_table_scope); const struct cmd_entry cmd_show_options_entry = { --- 27,37 ---- * Show options. */ ! static enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmdq_item *); ! static enum cmd_retval cmd_show_options_one(struct cmd *, struct cmdq_item *, struct options *, int); ! static enum cmd_retval cmd_show_options_all(struct cmd *, struct cmdq_item *, struct options *, enum options_table_scope); const struct cmd_entry cmd_show_options_entry = { *************** *** 61,71 **** }; static enum cmd_retval ! cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; ! struct session *s = cmdq->state.tflag.s; ! struct winlink *wl = cmdq->state.tflag.wl; struct options *oo; enum options_table_scope scope; int quiet; --- 61,71 ---- }; static enum cmd_retval ! cmd_show_options_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = self->args; ! struct session *s = item->state.tflag.s; ! struct winlink *wl = item->state.tflag.wl; struct options *oo; enum options_table_scope scope; int quiet; *************** *** 82,90 **** else if (wl == NULL) { target = args_get(args, 't'); if (target != NULL) { ! cmdq_error(cmdq, "no such window: %s", target); } else ! cmdq_error(cmdq, "no current window"); return (CMD_RETURN_ERROR); } else oo = wl->window->options; --- 82,90 ---- else if (wl == NULL) { target = args_get(args, 't'); if (target != NULL) { ! cmdq_error(item, "no such window: %s", target); } else ! cmdq_error(item, "no current window"); return (CMD_RETURN_ERROR); } else oo = wl->window->options; *************** *** 95,103 **** else if (s == NULL) { target = args_get(args, 't'); if (target != NULL) { ! cmdq_error(cmdq, "no such session: %s", target); } else ! cmdq_error(cmdq, "no current session"); return (CMD_RETURN_ERROR); } else oo = s->options; --- 95,103 ---- else if (s == NULL) { target = args_get(args, 't'); if (target != NULL) { ! cmdq_error(item, "no such session: %s", target); } else ! cmdq_error(item, "no current session"); return (CMD_RETURN_ERROR); } else oo = s->options; *************** *** 105,117 **** quiet = args_has(self->args, 'q'); if (args->argc == 0) ! return (cmd_show_options_all(self, cmdq, oo, scope)); else ! return (cmd_show_options_one(self, cmdq, oo, quiet)); } static enum cmd_retval ! cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq, struct options *oo, int quiet) { struct args *args = self->args; --- 105,117 ---- quiet = args_has(self->args, 'q'); if (args->argc == 0) ! return (cmd_show_options_all(self, item, oo, scope)); else ! return (cmd_show_options_one(self, item, oo, quiet)); } static enum cmd_retval ! cmd_show_options_one(struct cmd *self, struct cmdq_item *item, struct options *oo, int quiet) { struct args *args = self->args; *************** *** 125,149 **** if ((o = options_find1(oo, name)) == NULL) { if (quiet) return (CMD_RETURN_NORMAL); ! cmdq_error(cmdq, "unknown option: %s", name); return (CMD_RETURN_ERROR); } if (args_has(self->args, 'v')) ! cmdq_print(cmdq, "%s", o->str); else ! cmdq_print(cmdq, "%s \"%s\"", o->name, o->str); return (CMD_RETURN_NORMAL); } oe = NULL; if (options_table_find(name, &oe) != 0) { ! cmdq_error(cmdq, "ambiguous option: %s", name); return (CMD_RETURN_ERROR); } if (oe == NULL) { if (quiet) return (CMD_RETURN_NORMAL); ! cmdq_error(cmdq, "unknown option: %s", name); return (CMD_RETURN_ERROR); } if (oe->style != NULL) { --- 125,149 ---- if ((o = options_find1(oo, name)) == NULL) { if (quiet) return (CMD_RETURN_NORMAL); ! cmdq_error(item, "unknown option: %s", name); return (CMD_RETURN_ERROR); } if (args_has(self->args, 'v')) ! cmdq_print(item, "%s", o->str); else ! cmdq_print(item, "%s \"%s\"", o->name, o->str); return (CMD_RETURN_NORMAL); } oe = NULL; if (options_table_find(name, &oe) != 0) { ! cmdq_error(item, "ambiguous option: %s", name); return (CMD_RETURN_ERROR); } if (oe == NULL) { if (quiet) return (CMD_RETURN_NORMAL); ! cmdq_error(item, "unknown option: %s", name); return (CMD_RETURN_ERROR); } if (oe->style != NULL) { *************** *** 154,168 **** return (CMD_RETURN_NORMAL); optval = options_table_print_entry(oe, o, args_has(self->args, 'v')); if (args_has(self->args, 'v')) ! cmdq_print(cmdq, "%s", optval); else ! cmdq_print(cmdq, "%s %s", oe->name, optval); return (CMD_RETURN_NORMAL); } static enum cmd_retval ! cmd_show_options_all(struct cmd *self, struct cmd_q *cmdq, struct options *oo, ! enum options_table_scope scope) { const struct options_table_entry *oe; struct options_entry *o; --- 154,168 ---- return (CMD_RETURN_NORMAL); optval = options_table_print_entry(oe, o, args_has(self->args, 'v')); if (args_has(self->args, 'v')) ! cmdq_print(item, "%s", optval); else ! cmdq_print(item, "%s %s", oe->name, optval); return (CMD_RETURN_NORMAL); } static enum cmd_retval ! cmd_show_options_all(struct cmd *self, struct cmdq_item *item, ! struct options *oo, enum options_table_scope scope) { const struct options_table_entry *oe; struct options_entry *o; *************** *** 173,181 **** while (o != NULL) { if (*o->name == '@') { if (args_has(self->args, 'v')) ! cmdq_print(cmdq, "%s", o->str); else ! cmdq_print(cmdq, "%s \"%s\"", o->name, o->str); } o = options_next(o); } --- 173,181 ---- while (o != NULL) { if (*o->name == '@') { if (args_has(self->args, 'v')) ! cmdq_print(item, "%s", o->str); else ! cmdq_print(item, "%s \"%s\"", o->name, o->str); } o = options_next(o); } *************** *** 188,196 **** continue; optval = options_table_print_entry(oe, o, vflag); if (vflag) ! cmdq_print(cmdq, "%s", optval); else ! cmdq_print(cmdq, "%s %s", oe->name, optval); } return (CMD_RETURN_NORMAL); --- 188,196 ---- continue; optval = options_table_print_entry(oe, o, vflag); if (vflag) ! cmdq_print(item, "%s", optval); else ! cmdq_print(item, "%s %s", oe->name, optval); } return (CMD_RETURN_NORMAL);