diff options
| author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-08-21 18:01:40 +0100 |
|---|---|---|
| committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-08-21 18:01:40 +0100 |
| commit | a36da3a878a76f9570bee1b180a07243df4d382c (patch) | |
| tree | 70971e476db6ec799abfc9ffa73ca0692aedcc43 | |
| parent | 23519fc0b440ccfe13d52ab3e09ea98c792d4fa7 (diff) | |
| download | rtmux-a36da3a878a76f9570bee1b180a07243df4d382c.tar.gz rtmux-a36da3a878a76f9570bee1b180a07243df4d382c.tar.bz2 rtmux-a36da3a878a76f9570bee1b180a07243df4d382c.zip | |
Remove the barely-used and unnecessary command check() function.
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-> |