aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd-attach-session.c1
-rw-r--r--cmd-bind-key.c27
-rw-r--r--cmd-break-pane.c1
-rw-r--r--cmd-capture-pane.c1
-rw-r--r--cmd-choose-buffer.c1
-rw-r--r--cmd-choose-client.c1
-rw-r--r--cmd-choose-list.c1
-rw-r--r--cmd-choose-tree.c3
-rw-r--r--cmd-clear-history.c1
-rw-r--r--cmd-clock-mode.c1
-rw-r--r--cmd-command-prompt.c2
-rw-r--r--cmd-confirm-before.c1
-rw-r--r--cmd-copy-mode.c1
-rw-r--r--cmd-delete-buffer.c1
-rw-r--r--cmd-detach-client.c1
-rw-r--r--cmd-display-message.c1
-rw-r--r--cmd-display-panes.c1
-rw-r--r--cmd-find-window.c1
-rw-r--r--cmd-has-session.c1
-rw-r--r--cmd-if-shell.c1
-rw-r--r--cmd-join-pane.c2
-rw-r--r--cmd-kill-pane.c1
-rw-r--r--cmd-kill-server.c1
-rw-r--r--cmd-kill-session.c1
-rw-r--r--cmd-kill-window.c1
-rw-r--r--cmd-link-window.c1
-rw-r--r--cmd-list-buffers.c1
-rw-r--r--cmd-list-clients.c1
-rw-r--r--cmd-list-commands.c1
-rw-r--r--cmd-list-keys.c1
-rw-r--r--cmd-list-panes.c1
-rw-r--r--cmd-list-sessions.c1
-rw-r--r--cmd-list-windows.c1
-rw-r--r--cmd-load-buffer.c1
-rw-r--r--cmd-lock-server.c3
-rw-r--r--cmd-move-window.c1
-rw-r--r--cmd-new-session.c15
-rw-r--r--cmd-new-window.c1
-rw-r--r--cmd-paste-buffer.c1
-rw-r--r--cmd-pipe-pane.c1
-rw-r--r--cmd-refresh-client.c1
-rw-r--r--cmd-rename-session.c1
-rw-r--r--cmd-rename-window.c1
-rw-r--r--cmd-resize-pane.c1
-rw-r--r--cmd-respawn-pane.c1
-rw-r--r--cmd-respawn-window.c1
-rw-r--r--cmd-rotate-window.c1
-rw-r--r--cmd-run-shell.c1
-rw-r--r--cmd-save-buffer.c2
-rw-r--r--cmd-select-layout.c3
-rw-r--r--cmd-select-pane.c2
-rw-r--r--cmd-select-window.c4
-rw-r--r--cmd-send-keys.c2
-rw-r--r--cmd-server-info.c1
-rw-r--r--cmd-set-buffer.c1
-rw-r--r--cmd-set-environment.c1
-rw-r--r--cmd-set-option.c2
-rw-r--r--cmd-show-environment.c1
-rw-r--r--cmd-show-messages.c1
-rw-r--r--cmd-show-options.c2
-rw-r--r--cmd-source-file.c1
-rw-r--r--cmd-split-window.c1
-rw-r--r--cmd-start-server.c1
-rw-r--r--cmd-suspend-client.c1
-rw-r--r--cmd-swap-pane.c1
-rw-r--r--cmd-swap-window.c1
-rw-r--r--cmd-switch-client.c1
-rw-r--r--cmd-unbind-key.c24
-rw-r--r--cmd-unlink-window.c1
-rw-r--r--cmd-wait-for.c1
-rw-r--r--cmd.c2
-rw-r--r--tmux.h1
72 files changed, 28 insertions, 124 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index 07185737..cf5f30a4 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_attach_session_entry = {
"[-dr] " CMD_TARGET_SESSION_USAGE,
CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON,
NULL,
- NULL,
cmd_attach_session_exec
};
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index 71e79ea0..4ff3ac84 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]);
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 8ed9a1a6..d0a5a450 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_break_pane_entry = {
"[-dP] [-F format] " CMD_TARGET_PANE_USAGE,
0,
NULL,
- NULL,
cmd_break_pane_exec
};
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index f59dc2d6..e157e3cb 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -42,7 +42,6 @@ const struct cmd_entry cmd_capture_pane_entry = {
CMD_TARGET_PANE_USAGE,
0,
NULL,
- NULL,
cmd_capture_pane_exec
};
diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c
index e6b79d91..d79f6fdc 100644
--- a/cmd-choose-buffer.c
+++ b/cmd-choose-buffer.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_choose_buffer_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0,
NULL,
- NULL,
cmd_choose_buffer_exec
};
diff --git a/cmd-choose-client.c b/cmd-choose-client.c
index 40752a70..93671987 100644
--- a/cmd-choose-client.c
+++ b/cmd-choose-client.c
@@ -37,7 +37,6 @@ const struct cmd_entry cmd_choose_client_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0,
NULL,
- NULL,
cmd_choose_client_exec
};
diff --git a/cmd-choose-list.c b/cmd-choose-list.c
index 15f87294..c3caabba 100644
--- a/cmd-choose-list.c
+++ b/cmd-choose-list.c
@@ -39,7 +39,6 @@ const struct cmd_entry cmd_choose_list_entry = {
"[-l items] " CMD_TARGET_WINDOW_USAGE "[template]",
0,
NULL,
- NULL,
cmd_choose_list_exec
};
diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c
index a9b6ffbc..75ed5d2f 100644
--- a/cmd-choose-tree.c
+++ b/cmd-choose-tree.c
@@ -41,7 +41,6 @@ const struct cmd_entry cmd_choose_tree_entry = {
"[-W format] " CMD_TARGET_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_choose_tree_exec
};
@@ -51,7 +50,6 @@ const struct cmd_entry cmd_choose_session_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0,
NULL,
- NULL,
cmd_choose_tree_exec
};
@@ -61,7 +59,6 @@ const struct cmd_entry cmd_choose_window_entry = {
CMD_TARGET_WINDOW_USAGE "[-F format] [template]",
0,
NULL,
- NULL,
cmd_choose_tree_exec
};
diff --git a/cmd-clear-history.c b/cmd-clear-history.c
index aebaa27d..cce3ea18 100644
--- a/cmd-clear-history.c
+++ b/cmd-clear-history.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_clear_history_entry = {
CMD_TARGET_PANE_USAGE,
0,
NULL,
- NULL,
cmd_clear_history_exec
};
diff --git a/cmd-clock-mode.c b/cmd-clock-mode.c
index 872f3d53..50e4ab8b 100644
--- a/cmd-clock-mode.c
+++ b/cmd-clock-mode.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_clock_mode_entry = {
CMD_TARGET_PANE_USAGE,
0,
NULL,
- NULL,
cmd_clock_mode_exec
};
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c
index 3bb79ed9..759d578b 100644
--- a/cmd-command-prompt.c
+++ b/cmd-command-prompt.c
@@ -30,7 +30,6 @@
*/
void cmd_command_prompt_key_binding(struct cmd *, int);
-int cmd_command_prompt_check(struct args *);
enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *);
int cmd_command_prompt_callback(void *, const char *);
@@ -42,7 +41,6 @@ const struct cmd_entry cmd_command_prompt_entry = {
"[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]",
0,
cmd_command_prompt_key_binding,
- NULL,
cmd_command_prompt_exec
};
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index e670f69c..9266721f 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -38,7 +38,6 @@ const struct cmd_entry cmd_confirm_before_entry = {
"[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
0,
cmd_confirm_before_key_binding,
- NULL,
cmd_confirm_before_exec
};
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index 40584a28..f11c7aff 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -33,7 +33,6 @@ const struct cmd_entry cmd_copy_mode_entry = {
"[-u] " CMD_TARGET_PANE_USAGE,
0,
cmd_copy_mode_key_binding,
- NULL,
cmd_copy_mode_exec
};
diff --git a/cmd-delete-buffer.c b/cmd-delete-buffer.c
index bc3982ca..b8f55db4 100644
--- a/cmd-delete-buffer.c
+++ b/cmd-delete-buffer.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_delete_buffer_entry = {
CMD_BUFFER_USAGE,
0,
NULL,
- NULL,
cmd_delete_buffer_exec
};
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index 6e00e079..ea9e3816 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_detach_client_entry = {
"[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE,
CMD_READONLY,
NULL,
- NULL,
cmd_detach_client_exec
};
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 485ccf08..006c49a5 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_display_message_entry = {
" [message]",
0,
NULL,
- NULL,
cmd_display_message_exec
};
diff --git a/cmd-display-panes.c b/cmd-display-panes.c
index 4a8731a4..c137feef 100644
--- a/cmd-display-panes.c
+++ b/cmd-display-panes.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_display_panes_entry = {
CMD_TARGET_CLIENT_USAGE,
0,
NULL,
- NULL,
cmd_display_panes_exec
};
diff --git a/cmd-find-window.c b/cmd-find-window.c
index 02f19307..647cc8fb 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -48,7 +48,6 @@ const struct cmd_entry cmd_find_window_entry = {
"[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
0,
NULL,
- NULL,
cmd_find_window_exec
};
diff --git a/cmd-has-session.c b/cmd-has-session.c
index c4286b86..38a92f61 100644
--- a/cmd-has-session.c
+++ b/cmd-has-session.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_has_session_entry = {
CMD_TARGET_SESSION_USAGE,
0,
NULL,
- NULL,
cmd_has_session_exec
};
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index d1cbd7f3..a074341b 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -41,7 +41,6 @@ const struct cmd_entry cmd_if_shell_entry = {
"[-b] " CMD_TARGET_PANE_USAGE " shell-command command [command]",
0,
NULL,
- NULL,
cmd_if_shell_exec
};
diff --git a/cmd-join-pane.c b/cmd-join-pane.c
index 2cf587e0..1a710cec 100644
--- a/cmd-join-pane.c
+++ b/cmd-join-pane.c
@@ -39,7 +39,6 @@ const struct cmd_entry cmd_join_pane_entry = {
"[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
0,
cmd_join_pane_key_binding,
- NULL,
cmd_join_pane_exec
};
@@ -49,7 +48,6 @@ const struct cmd_entry cmd_move_pane_entry = {
"[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
0,
NULL,
- NULL,
cmd_join_pane_exec
};
diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c
index 40761350..bf486eb3 100644
--- a/cmd-kill-pane.c
+++ b/cmd-kill-pane.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_kill_pane_entry = {
"[-a] " CMD_TARGET_PANE_USAGE,
0,
NULL,
- NULL,
cmd_kill_pane_exec
};
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
index a6065460..ba63faa3 100644
--- a/cmd-kill-server.c
+++ b/cmd-kill-server.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_server_entry = {
"",
0,
NULL,
- NULL,
cmd_kill_server_exec
};
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index a12cc8a4..54b0c31b 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_session_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE,
0,
NULL,
- NULL,
cmd_kill_session_exec
};
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index 34b97499..ca8fe3d6 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_kill_window_entry = {
"[-a] " CMD_TARGET_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_kill_window_exec
};
diff --git a/cmd-link-window.c b/cmd-link-window.c
index 2be8ace0..d94eb38a 100644
--- a/cmd-link-window.c
+++ b/cmd-link-window.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_link_window_entry = {
"[-dk] " CMD_SRCDST_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_link_window_exec
};
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index 58af0020..02a4183e 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_buffers_entry = {
"[-F format]",
0,
NULL,
- NULL,
cmd_list_buffers_exec
};
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index 59f63099..904ec005 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_clients_entry = {
"[-F format] " CMD_TARGET_SESSION_USAGE,
CMD_READONLY,
NULL,
- NULL,
cmd_list_clients_exec
};
diff --git a/cmd-list-commands.c b/cmd-list-commands.c
index 1bf6e703..06e48378 100644
--- a/cmd-list-commands.c
+++ b/cmd-list-commands.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_list_commands_entry = {
"",
0,
NULL,
- NULL,
cmd_list_commands_exec
};
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index 78998b66..615c5ce1 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_keys_entry = {
"[-t key-table]",
0,
NULL,
- NULL,
cmd_list_keys_exec
};
diff --git a/cmd-list-panes.c b/cmd-list-panes.c
index 0d498e28..c989eba1 100644
--- a/cmd-list-panes.c
+++ b/cmd-list-panes.c
@@ -41,7 +41,6 @@ const struct cmd_entry cmd_list_panes_entry = {
"[-as] [-F format] " CMD_TARGET_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_list_panes_exec
};
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index 61c12f4e..a3613c87 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_sessions_entry = {
"[-F format]",
0,
NULL,
- NULL,
cmd_list_sessions_exec
};
diff --git a/cmd-list-windows.c b/cmd-list-windows.c
index 5c2a2b95..ce122f45 100644
--- a/cmd-list-windows.c
+++ b/cmd-list-windows.c
@@ -39,7 +39,6 @@ const struct cmd_entry cmd_list_windows_entry = {
"[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
0,
NULL,
- NULL,
cmd_list_windows_exec
};
diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c
index 3be14d6a..82b8f574 100644
--- a/cmd-load-buffer.c
+++ b/cmd-load-buffer.c
@@ -39,7 +39,6 @@ const struct cmd_entry cmd_load_buffer_entry = {
CMD_BUFFER_USAGE " path",
0,
NULL,
- NULL,
cmd_load_buffer_exec
};
diff --git a/cmd-lock-server.c b/cmd-lock-server.c
index 0b6aafe8..2b591ecf 100644
--- a/cmd-lock-server.c
+++ b/cmd-lock-server.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_lock_server_entry = {
"",
0,
NULL,
- NULL,
cmd_lock_server_exec
};
@@ -46,7 +45,6 @@ const struct cmd_entry cmd_lock_session_entry = {
CMD_TARGET_SESSION_USAGE,
0,
NULL,
- NULL,
cmd_lock_server_exec
};
@@ -56,7 +54,6 @@ const struct cmd_entry cmd_lock_client_entry = {
CMD_TARGET_CLIENT_USAGE,
0,
NULL,
- NULL,
cmd_lock_server_exec
};
diff --git a/cmd-move-window.c b/cmd-move-window.c
index 1a147c7e..21606755 100644
--- a/cmd-move-window.c
+++ b/cmd-move-window.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_move_window_entry = {
"[-dkr] " CMD_SRCDST_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_move_window_exec
};
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 4eebe632..b1e1aa45 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -30,7 +30,6 @@
* Create a new session and attach to the current terminal unless -d is given.
*/
-enum cmd_retval cmd_new_session_check(struct args *);
enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_session_entry = {
@@ -40,19 +39,10 @@ const struct cmd_entry cmd_new_session_entry = {
CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]",
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON,
NULL,
- cmd_new_session_check,
cmd_new_session_exec
};
enum cmd_retval
-cmd_new_session_check(struct args *args)
-{
- if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n')))
- return (CMD_RETURN_ERROR);
- return (CMD_RETURN_NORMAL);
-}
-
-enum cmd_retval
cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
@@ -70,6 +60,11 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
int already_attached;
struct format_tree *ft;
+ if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) {
+ cmdq_error(cmdq, "command or window name given with target");
+ return (CMD_RETURN_ERROR);
+ }
+
newname = args_get(args, 's');
if (newname != NULL) {
if (!session_check_name(newname)) {
diff --git a/cmd-new-window.c b/cmd-new-window.c
index cfc0b8bd..2ca0cecd 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_new_window_entry = {
CMD_TARGET_WINDOW_USAGE " [command]",
0,
NULL,
- NULL,
cmd_new_window_exec
};
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index b07c9faf..5305b7e6 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -38,7 +38,6 @@ const struct cmd_entry cmd_paste_buffer_entry = {
"[-dpr] [-s separator] [-b buffer-index] " CMD_TARGET_PANE_USAGE,
0,
NULL,
- NULL,
cmd_paste_buffer_exec
};
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index aa72c699..611ad8cf 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -41,7 +41,6 @@ const struct cmd_entry cmd_pipe_pane_entry = {
"[-o] " CMD_TARGET_PANE_USAGE " [command]",
0,
NULL,
- NULL,
cmd_pipe_pane_exec
};
diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c
index 70e6888d..45804fbe 100644
--- a/cmd-refresh-client.c
+++ b/cmd-refresh-client.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_refresh_client_entry = {
"[-S] [-C size] " CMD_TARGET_CLIENT_USAGE,
0,
NULL,
- NULL,
cmd_refresh_client_exec
};
diff --git a/cmd-rename-session.c b/cmd-rename-session.c
index 3f8a9d8f..4c8ae122 100644
--- a/cmd-rename-session.c
+++ b/cmd-rename-session.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_session_entry = {
CMD_TARGET_SESSION_USAGE " new-name",
0,
NULL,
- NULL,
cmd_rename_session_exec
};
diff --git a/cmd-rename-window.c b/cmd-rename-window.c
index c756ba1f..f647abb3 100644
--- a/cmd-rename-window.c
+++ b/cmd-rename-window.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_window_entry = {
CMD_TARGET_WINDOW_USAGE " new-name",
0,
NULL,
- NULL,
cmd_rename_window_exec
};
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index ca2a6cd3..d31f8868 100644
--- a/cmd-resize-pane.c
+++ b/cmd-resize-pane.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_resize_pane_entry = {
"[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]",
0,
cmd_resize_pane_key_binding,
- NULL,
cmd_resize_pane_exec
};
diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c
index 4486c91f..36f8783b 100644
--- a/cmd-respawn-pane.c
+++ b/cmd-respawn-pane.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_respawn_pane_entry = {
"[-k] " CMD_TARGET_PANE_USAGE " [command]",
0,
NULL,
- NULL,
cmd_respawn_pane_exec
};
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index 35bd3471..6026ca64 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_respawn_window_entry = {
"[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
0,
NULL,
- NULL,
cmd_respawn_window_exec
};
diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c
index 75ca7292..9f4cc751 100644
--- a/cmd-rotate-window.c
+++ b/cmd-rotate-window.c
@@ -33,7 +33,6 @@ const struct cmd_entry cmd_rotate_window_entry = {
"[-DU] " CMD_TARGET_WINDOW_USAGE,
0,
cmd_rotate_window_key_binding,
- NULL,
cmd_rotate_window_exec
};
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index 7c7d333c..f5231814 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -41,7 +41,6 @@ const struct cmd_entry cmd_run_shell_entry = {
"[-b] " CMD_TARGET_PANE_USAGE " shell-command",
0,
NULL,
- NULL,
cmd_run_shell_exec
};
diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c
index 52914a94..c6c54019 100644
--- a/cmd-save-buffer.c
+++ b/cmd-save-buffer.c
@@ -37,7 +37,6 @@ const struct cmd_entry cmd_save_buffer_entry = {
"[-a] " CMD_BUFFER_USAGE " path",
0,
NULL,
- NULL,
cmd_save_buffer_exec
};
@@ -47,7 +46,6 @@ const struct cmd_entry cmd_show_buffer_entry = {
CMD_BUFFER_USAGE,
0,
NULL,
- NULL,
cmd_save_buffer_exec
};
diff --git a/cmd-select-layout.c b/cmd-select-layout.c
index ae1be4c4..053f3e40 100644
--- a/cmd-select-layout.c
+++ b/cmd-select-layout.c
@@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_layout_entry = {
"[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
0,
cmd_select_layout_key_binding,
- NULL,
cmd_select_layout_exec
};
@@ -43,7 +42,6 @@ const struct cmd_entry cmd_next_layout_entry = {
CMD_TARGET_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_select_layout_exec
};
@@ -53,7 +51,6 @@ const struct cmd_entry cmd_previous_layout_entry = {
CMD_TARGET_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_select_layout_exec
};
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index b8a12671..c342fef3 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_pane_entry = {
"[-lDLRU] " CMD_TARGET_PANE_USAGE,
0,
cmd_select_pane_key_binding,
- NULL,
cmd_select_pane_exec
};
@@ -43,7 +42,6 @@ const struct cmd_entry cmd_last_pane_entry = {
CMD_TARGET_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_select_pane_exec
};
diff --git a/cmd-select-window.c b/cmd-select-window.c
index c15d5858..73196200 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_select_window_entry = {
"[-lnpT] " CMD_TARGET_WINDOW_USAGE,
0,
cmd_select_window_key_binding,
- NULL,
cmd_select_window_exec
};
@@ -45,7 +44,6 @@ const struct cmd_entry cmd_next_window_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE,
0,
cmd_select_window_key_binding,
- NULL,
cmd_select_window_exec
};
@@ -55,7 +53,6 @@ const struct cmd_entry cmd_previous_window_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE,
0,
cmd_select_window_key_binding,
- NULL,
cmd_select_window_exec
};
@@ -65,7 +62,6 @@ const struct cmd_entry cmd_last_window_entry = {
CMD_TARGET_SESSION_USAGE,
0,
NULL,
- NULL,
cmd_select_window_exec
};
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index a2041656..50cb70e2 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_send_keys_entry = {
"[-lR] " CMD_TARGET_PANE_USAGE " key ...",
0,
NULL,
- NULL,
cmd_send_keys_exec
};
@@ -45,7 +44,6 @@ const struct cmd_entry cmd_send_prefix_entry = {
"[-2] " CMD_TARGET_PANE_USAGE,
0,
NULL,
- NULL,
cmd_send_keys_exec
};
diff --git a/cmd-server-info.c b/cmd-server-info.c
index 8eba172a..3aa5df8a 100644
--- a/cmd-server-info.c
+++ b/cmd-server-info.c
@@ -38,7 +38,6 @@ const struct cmd_entry cmd_server_info_entry = {
"",
0,
NULL,
- NULL,
cmd_server_info_exec
};
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index 46d28ff2..fade4fe3 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_buffer_entry = {
CMD_BUFFER_USAGE " data",
0,
NULL,
- NULL,
cmd_set_buffer_exec
};
diff --git a/cmd-set-environment.c b/cmd-set-environment.c
index 0f0365aa..8d067c35 100644
--- a/cmd-set-environment.c
+++ b/cmd-set-environment.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_environment_entry = {
"[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
0,
NULL,
- NULL,
cmd_set_environment_exec
};
diff --git a/cmd-set-option.c b/cmd-set-option.c
index c246743c..3acf125d 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -67,7 +67,6 @@ const struct cmd_entry cmd_set_option_entry = {
"[-agosquw] [-t target-session|target-window] option [value]",
0,
NULL,
- NULL,
cmd_set_option_exec
};
@@ -77,7 +76,6 @@ const struct cmd_entry cmd_set_window_option_entry = {
"[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
0,
NULL,
- NULL,
cmd_set_option_exec
};
diff --git a/cmd-show-environment.c b/cmd-show-environment.c
index ffe98bcc..2238929e 100644
--- a/cmd-show-environment.c
+++ b/cmd-show-environment.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_environment_entry = {
"[-g] " CMD_TARGET_SESSION_USAGE " [name]",
0,
NULL,
- NULL,
cmd_show_environment_exec
};
diff --git a/cmd-show-messages.c b/cmd-show-messages.c
index bc2424ad..256570cd 100644
--- a/cmd-show-messages.c
+++ b/cmd-show-messages.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_messages_entry = {
CMD_TARGET_CLIENT_USAGE,
0,
NULL,
- NULL,
cmd_show_messages_exec
};
diff --git a/cmd-show-options.c b/cmd-show-options.c
index e2f78e12..943353f6 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -40,7 +40,6 @@ const struct cmd_entry cmd_show_options_entry = {
"[-gqsvw] [-t target-session|target-window] [option]",
0,
NULL,
- NULL,
cmd_show_options_exec
};
@@ -50,7 +49,6 @@ const struct cmd_entry cmd_show_window_options_entry = {
"[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
0,
NULL,
- NULL,
cmd_show_options_exec
};
diff --git a/cmd-source-file.c b/cmd-source-file.c
index 45a3a39b..d636643d 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -37,7 +37,6 @@ const struct cmd_entry cmd_source_file_entry = {
"path",
0,
NULL,
- NULL,
cmd_source_file_exec
};
diff --git a/cmd-split-window.c b/cmd-split-window.c
index 601dcb17..5b5140be 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_split_window_entry = {
"[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] "
CMD_TARGET_PANE_USAGE " [command]",
0,
- cmd_split_window_key_binding,
NULL,
cmd_split_window_exec
};
diff --git a/cmd-start-server.c b/cmd-start-server.c
index cba2403b..33b28b4a 100644
--- a/cmd-start-server.c
+++ b/cmd-start-server.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_start_server_entry = {
"",
CMD_STARTSERVER,
NULL,
- NULL,
cmd_start_server_exec
};
diff --git a/cmd-suspend-client.c b/cmd-suspend-client.c
index 101658b1..e0e375fc 100644
--- a/cmd-suspend-client.c
+++ b/cmd-suspend-client.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_suspend_client_entry = {
CMD_TARGET_CLIENT_USAGE,
0,
NULL,
- NULL,
cmd_suspend_client_exec
};
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c
index 05317260..b8ff7690 100644
--- a/cmd-swap-pane.c
+++ b/cmd-swap-pane.c
@@ -35,7 +35,6 @@ const struct cmd_entry cmd_swap_pane_entry = {
"[-dDU] " CMD_SRCDST_PANE_USAGE,
0,
cmd_swap_pane_key_binding,
- NULL,
cmd_swap_pane_exec
};
diff --git a/cmd-swap-window.c b/cmd-swap-window.c
index f9a2cb1b..1591d403 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -34,7 +34,6 @@ const struct cmd_entry cmd_swap_window_entry = {
"[-d] " CMD_SRCDST_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_swap_window_exec
};
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index 9adb2146..d101c52b 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_switch_client_entry = {
"[-lnpr] [-c target-client] [-t target-session]",
CMD_READONLY,
cmd_switch_client_key_binding,
- NULL,
cmd_switch_client_exec
};
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index dc037dde..9bd068e1 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -26,7 +26,6 @@
* Unbind key from command.
*/
-enum cmd_retval cmd_unbind_key_check(struct args *);
enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_unbind_key_table(struct cmd *, struct cmd_q *, int);
@@ -36,21 +35,10 @@ const struct cmd_entry cmd_unbind_key_entry = {
"[-acn] [-t key-table] key",
0,
NULL,
- cmd_unbind_key_check,
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, struct cmd_q *cmdq)
{
struct args *args = self->args;
@@ -58,13 +46,23 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
int key;
if (!args_has(args, 'a')) {
+ if (args->argc != 1) {
+ cmdq_error(cmdq, "missing key");
+ return (CMD_RETURN_ERROR);
+ }
+ 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]);
return (CMD_RETURN_ERROR);
}
- } else
+ } else {
+ if (args->argc != 0) {
+ cmdq_error(cmdq, "key given with -a");
+ return (CMD_RETURN_ERROR);
+ }
key = KEYC_NONE;
+ }
if (args_has(args, 't'))
return (cmd_unbind_key_table(self, cmdq, key));
diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c
index 39cdd8ed..ec69b91f 100644
--- a/cmd-unlink-window.c
+++ b/cmd-unlink-window.c
@@ -32,7 +32,6 @@ const struct cmd_entry cmd_unlink_window_entry = {
"[-k] " CMD_TARGET_WINDOW_USAGE,
0,
NULL,
- NULL,
cmd_unlink_window_exec
};
diff --git a/cmd-wait-for.c b/cmd-wait-for.c
index d40ba49e..e87e197a 100644
--- a/cmd-wait-for.c
+++ b/cmd-wait-for.c
@@ -36,7 +36,6 @@ const struct cmd_entry cmd_wait_for_entry = {
"[-LSU] channel",
0,
NULL,
- NULL,
cmd_wait_for_exec
};
diff --git a/cmd.c b/cmd.c
index 282fb112..c9eb41a1 100644
--- a/cmd.c
+++ b/cmd.c
@@ -254,8 +254,6 @@ cmd_parse(int argc, char **argv, const char *file, u_int line, char **cause)
goto usage;
if (entry->args_upper != -1 && args->argc > entry->args_upper)
goto usage;
- if (entry->check != NULL && entry->check(args) != 0)
- goto usage;
cmd = xcalloc(1, sizeof *cmd);
cmd->entry = entry;
diff --git a/tmux.h b/tmux.h
index 6ab9861b..5b2aac5b 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1451,7 +1451,6 @@ struct cmd_entry {
int flags;
void (*key_binding)(struct cmd *, int);
- int (*check)(struct args *);
enum cmd_retval (*exec)(struct cmd *, struct cmd_q *);
};