summaryrefslogtreecommitdiffstats
path: root/cmd-bind-key.c
diff options
context:
space:
mode:
authornicm <nicm>2013-10-10 12:00:18 +0000
committernicm <nicm>2013-10-10 12:00:18 +0000
commitd45c12b6c9405da549197c2852ac124fc0d5b340 (patch)
tree3218d0535e37d480efab251eea536456baf1894a /cmd-bind-key.c
parent90ae7682ed06557bd4d8deac9d9e48ecc7b38a07 (diff)
Remove the barely-used and unnecessary command check() function.
Diffstat (limited to 'cmd-bind-key.c')
-rw-r--r--cmd-bind-key.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index d9b65bec..1ca31484 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -27,7 +27,6 @@
* Bind a key to a command, this recurses through cmd_*.
*/
-enum cmd_retval cmd_bind_key_check(struct args *);
enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_bind_key_table(struct cmd *, struct cmd_q *, int);
@@ -38,24 +37,10 @@ const struct cmd_entry cmd_bind_key_entry = {
"[-cnr] [-t key-table] key command [arguments]",
0,
NULL,
- cmd_bind_key_check,
cmd_bind_key_exec
};
enum cmd_retval
-cmd_bind_key_check(struct args *args)
-{
- if (args_has(args, 't')) {
- if (args->argc != 2 && args->argc != 3)
- return (CMD_RETURN_ERROR);
- } else {
- if (args->argc < 2)
- return (CMD_RETURN_ERROR);
- }
- return (CMD_RETURN_NORMAL);
-}
-
-enum cmd_retval
cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
@@ -63,6 +48,18 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
struct cmd_list *cmdlist;
int key;
+ if (args_has(args, 't')) {
+ if (args->argc != 2 && args->argc != 3) {
+ cmdq_error(cmdq, "not enough arguments");
+ return (CMD_RETURN_ERROR);
+ }
+ } else {
+ if (args->argc < 2) {
+ cmdq_error(cmdq, "not enough arguments");
+ return (CMD_RETURN_ERROR);
+ }
+ }
+
key = key_string_lookup_string(args->argv[0]);
if (key == KEYC_NONE) {
cmdq_error(cmdq, "unknown key: %s", args->argv[0]);