=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-unbind-key.c,v retrieving revision 1.14 retrieving revision 1.15 diff -c -r1.14 -r1.15 *** src/usr.bin/tmux/cmd-unbind-key.c 2012/07/10 11:53:01 1.14 --- src/usr.bin/tmux/cmd-unbind-key.c 2012/07/11 07:10:15 1.15 *************** *** 1,4 **** ! /* $OpenBSD: cmd-unbind-key.c,v 1.14 2012/07/10 11:53:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-unbind-key.c,v 1.15 2012/07/11 07:10:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 26,36 **** * Unbind key from command. */ ! int cmd_unbind_key_check(struct args *); ! int cmd_unbind_key_exec(struct cmd *, struct cmd_ctx *); - int cmd_unbind_key_table(struct cmd *, struct cmd_ctx *, int); - const struct cmd_entry cmd_unbind_key_entry = { "unbind-key", "unbind", "acnt:", 0, 1, --- 26,35 ---- * Unbind key from command. */ ! enum cmd_retval cmd_unbind_key_check(struct args *); ! enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_ctx *); ! enum cmd_retval cmd_unbind_key_table(struct cmd *, struct cmd_ctx *, int); const struct cmd_entry cmd_unbind_key_entry = { "unbind-key", "unbind", "acnt:", 0, 1, *************** *** 41,57 **** cmd_unbind_key_exec }; ! int cmd_unbind_key_check(struct args *args) { if (args_has(args, 'a') && args->argc != 0) ! return (-1); if (!args_has(args, 'a') && args->argc != 1) ! return (-1); ! return (0); } ! int cmd_unbind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx) { struct args *args = self->args; --- 40,56 ---- cmd_unbind_key_exec }; ! enum cmd_retval cmd_unbind_key_check(struct args *args) { if (args_has(args, 'a') && args->argc != 0) ! return (CMD_RETURN_ERROR); if (!args_has(args, 'a') && args->argc != 1) ! return (CMD_RETURN_ERROR); ! return (CMD_RETURN_NORMAL); } ! enum cmd_retval cmd_unbind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx) { struct args *args = self->args; *************** *** 62,68 **** key = key_string_lookup_string(args->argv[0]); if (key == KEYC_NONE) { ctx->error(ctx, "unknown key: %s", args->argv[0]); ! return (-1); } } else key = KEYC_NONE; --- 61,67 ---- key = key_string_lookup_string(args->argv[0]); if (key == KEYC_NONE) { ctx->error(ctx, "unknown key: %s", args->argv[0]); ! return (CMD_RETURN_ERROR); } } else key = KEYC_NONE; *************** *** 75,90 **** bd = RB_ROOT(&key_bindings); key_bindings_remove(bd->key); } ! return (0); } if (!args_has(args, 'n')) key |= KEYC_PREFIX; key_bindings_remove(key); ! return (0); } ! int cmd_unbind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key) { struct args *args = self->args; --- 74,89 ---- bd = RB_ROOT(&key_bindings); key_bindings_remove(bd->key); } ! return (CMD_RETURN_NORMAL); } if (!args_has(args, 'n')) key |= KEYC_PREFIX; key_bindings_remove(key); ! return (CMD_RETURN_NORMAL); } ! enum cmd_retval cmd_unbind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key) { struct args *args = self->args; *************** *** 95,101 **** tablename = args_get(args, 't'); if ((mtab = mode_key_findtable(tablename)) == NULL) { ctx->error(ctx, "unknown key table: %s", tablename); ! return (-1); } if (key == KEYC_NONE) { --- 94,100 ---- tablename = args_get(args, 't'); if ((mtab = mode_key_findtable(tablename)) == NULL) { ctx->error(ctx, "unknown key table: %s", tablename); ! return (CMD_RETURN_ERROR); } if (key == KEYC_NONE) { *************** *** 104,110 **** RB_REMOVE(mode_key_tree, mtab->tree, mbind); free(mbind); } ! return (0); } mtmp.key = key; --- 103,109 ---- RB_REMOVE(mode_key_tree, mtab->tree, mbind); free(mbind); } ! return (CMD_RETURN_NORMAL); } mtmp.key = key; *************** *** 113,117 **** RB_REMOVE(mode_key_tree, mtab->tree, mbind); free(mbind); } ! return (0); } --- 112,116 ---- RB_REMOVE(mode_key_tree, mtab->tree, mbind); free(mbind); } ! return (CMD_RETURN_NORMAL); }