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,23 +37,9 @@ 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) { @@ -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 bac332a2..defd22ec 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 779cbe08..cf9a2f49 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 8713815d..359de068 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 df57f9cf..47ff1976 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 601d24f1..257908e1 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 }; @@ -228,7 +225,6 @@ windows_only: free(final_win_template_last); window_choose_ready(wl->window->active, cur_win, NULL); - window_choose_collapse_all(wl->window->active); if (args_has(args, 'u')) { window_choose_expand_all(wl->window->active); diff --git a/cmd-clear-history.c b/cmd-clear-history.c index 768ba86d..69885f08 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 b1837004..09f16e17 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 3b773316..fc625f53 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 6282be2e..5b8151c9 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 883a9376..bc9cfd62 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 6e425b57..32fb243b 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 17b437ab..fc80499c 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-panes.c b/cmd-display-panes.c index a97a1809..9160f4e7 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 f757d10f..45dbd571 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 28e3aea3..d7ef9be6 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-join-pane.c b/cmd-join-pane.c index cf17e7d9..b70f93dc 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -40,7 +40,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 }; @@ -50,7 +49,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 ba3bfd20..64fd11e4 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 808dca59..ef4a3946 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 095fb9bb..097189ec 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 dcb1fd28..2f924260 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 c7dfa5aa..8bd63b7c 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 54284d55..e36a7cd0 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 e0f8558e..98c564ad 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 7073d5f8..287df428 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 1f568909..65e4469e 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 910c19bc..07884ff2 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 14ac4808..d401608f 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 c709e471..bc56816f 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 698210d8..8c92ca32 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 8491c8b1..97c86c1e 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 945e9daa..bb160e5c 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-paste-buffer.c b/cmd-paste-buffer.c index 1cfc17c8..8f7530a2 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -39,7 +39,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 5de675df..9b29e568 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -42,7 +42,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 e95e1ea3..d3dae49d 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 c94b460b..ba8f9588 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 34b03f98..bdd3fbef 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 41c15269..e54c0760 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 0aae0331..2315b241 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 a446794b..e4ef6dfb 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 7af592b3..6005ae5d 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 ef1dbdd4..d835e461 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 29f71837..57c3d65d 100644 --- a/cmd-save-buffer.c +++ b/cmd-save-buffer.c @@ -38,7 +38,6 @@ const struct cmd_entry cmd_save_buffer_entry = { "[-a] " CMD_BUFFER_USAGE " path", 0, NULL, - NULL, cmd_save_buffer_exec }; @@ -48,7 +47,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 aa73e500..26d8538e 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 77be368f..1a1072d8 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 6206ae4b..744bdf77 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 dcd5f288..ef61d2bb 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 07b224a1..6cbabe2b 100644 --- a/cmd-server-info.c +++ b/cmd-server-info.c @@ -39,7 +39,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 46450e21..f67f7a0c 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 6e75a294..7a446fc6 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 3b822d8b..1b25fac0 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 cb53e84c..4ba111b2 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 cbf083a7..f43607aa 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 57e49a33..529289ea 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-start-server.c b/cmd-start-server.c index c926b5fe..d98f9506 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 dda0f977..5d1e7fe2 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 e6b46d67..e8170bbb 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 ed175480..00bf6d4d 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 ea5012ed..9db35365 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 88c81270..b89340da 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,20 +35,9 @@ 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) { @@ -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 78c4b390..d4c77f2a 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 };