=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-unbind-key.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/tmux/cmd-unbind-key.c 2016/10/14 22:14:22 1.28 --- src/usr.bin/tmux/cmd-unbind-key.c 2016/10/16 19:04:05 1.29 *************** *** 1,4 **** ! /* $OpenBSD: cmd-unbind-key.c,v 1.28 2016/10/14 22:14:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-unbind-key.c,v 1.29 2016/10/16 19:04:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 26,35 **** * Unbind key from command. */ ! static enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *); ! static enum cmd_retval cmd_unbind_key_mode_table(struct cmd *, struct cmd_q *, ! key_code); const struct cmd_entry cmd_unbind_key_entry = { .name = "unbind-key", .alias = "unbind", --- 26,36 ---- * Unbind key from command. */ ! static enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmdq_item *); + static enum cmd_retval cmd_unbind_key_mode_table(struct cmd *, + struct cmdq_item *, key_code); + const struct cmd_entry cmd_unbind_key_entry = { .name = "unbind-key", .alias = "unbind", *************** *** 42,48 **** }; static enum cmd_retval ! cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; key_code key; --- 43,49 ---- }; static enum cmd_retval ! cmd_unbind_key_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = self->args; key_code key; *************** *** 50,73 **** if (!args_has(args, 'a')) { if (args->argc != 1) { ! cmdq_error(cmdq, "missing key"); return (CMD_RETURN_ERROR); } key = key_string_lookup_string(args->argv[0]); if (key == KEYC_NONE || key == KEYC_UNKNOWN) { ! cmdq_error(cmdq, "unknown key: %s", args->argv[0]); return (CMD_RETURN_ERROR); } } else { if (args->argc != 0) { ! cmdq_error(cmdq, "key given with -a"); return (CMD_RETURN_ERROR); } key = KEYC_UNKNOWN; } if (args_has(args, 't')) ! return (cmd_unbind_key_mode_table(self, cmdq, key)); if (key == KEYC_UNKNOWN) { tablename = args_get(args, 'T'); --- 51,74 ---- if (!args_has(args, 'a')) { if (args->argc != 1) { ! cmdq_error(item, "missing key"); return (CMD_RETURN_ERROR); } key = key_string_lookup_string(args->argv[0]); if (key == KEYC_NONE || key == KEYC_UNKNOWN) { ! cmdq_error(item, "unknown key: %s", args->argv[0]); return (CMD_RETURN_ERROR); } } else { if (args->argc != 0) { ! cmdq_error(item, "key given with -a"); return (CMD_RETURN_ERROR); } key = KEYC_UNKNOWN; } if (args_has(args, 't')) ! return (cmd_unbind_key_mode_table(self, item, key)); if (key == KEYC_UNKNOWN) { tablename = args_get(args, 'T'); *************** *** 77,83 **** return (CMD_RETURN_NORMAL); } if (key_bindings_get_table(tablename, 0) == NULL) { ! cmdq_error(cmdq, "table %s doesn't exist", tablename); return (CMD_RETURN_ERROR); } key_bindings_remove_table(tablename); --- 78,84 ---- return (CMD_RETURN_NORMAL); } if (key_bindings_get_table(tablename, 0) == NULL) { ! cmdq_error(item, "table %s doesn't exist", tablename); return (CMD_RETURN_ERROR); } key_bindings_remove_table(tablename); *************** *** 87,93 **** if (args_has(args, 'T')) { tablename = args_get(args, 'T'); if (key_bindings_get_table(tablename, 0) == NULL) { ! cmdq_error(cmdq, "table %s doesn't exist", tablename); return (CMD_RETURN_ERROR); } } else if (args_has(args, 'n')) --- 88,94 ---- if (args_has(args, 'T')) { tablename = args_get(args, 'T'); if (key_bindings_get_table(tablename, 0) == NULL) { ! cmdq_error(item, "table %s doesn't exist", tablename); return (CMD_RETURN_ERROR); } } else if (args_has(args, 'n')) *************** *** 99,105 **** } static enum cmd_retval ! cmd_unbind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key) { struct args *args = self->args; const char *tablename; --- 100,107 ---- } static enum cmd_retval ! cmd_unbind_key_mode_table(struct cmd *self, struct cmdq_item *item, ! key_code key) { struct args *args = self->args; const char *tablename; *************** *** 108,114 **** tablename = args_get(args, 't'); if ((mtab = mode_key_findtable(tablename)) == NULL) { ! cmdq_error(cmdq, "unknown key table: %s", tablename); return (CMD_RETURN_ERROR); } --- 110,116 ---- tablename = args_get(args, 't'); if ((mtab = mode_key_findtable(tablename)) == NULL) { ! cmdq_error(item, "unknown key table: %s", tablename); return (CMD_RETURN_ERROR); }