diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-10-10 12:00:25 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-10-10 12:00:25 +0000 |
commit | 9e0be8a77b602b99d0c76c4c144f3a26b7c4a929 (patch) | |
tree | c95d7b91be0608e071c00744c048bad94e725153 | |
parent | e4cddc1fd09a5ad8aa772b5bcf7244cc31391832 (diff) |
Remove the barely-used and unnecessary command check() function.
72 files changed, 100 insertions, 196 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index 412bd883196..97565abb649 100644 --- a/usr.bin/tmux/cmd-attach-session.c +++ b/usr.bin/tmux/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-attach-session.c,v 1.24 2013/03/24 09:58:40 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.25 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-bind-key.c b/usr.bin/tmux/cmd-bind-key.c index c29cd7e3ef0..b6f45643ca0 100644 --- a/usr.bin/tmux/cmd-bind-key.c +++ b/usr.bin/tmux/cmd-bind-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-bind-key.c,v 1.16 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-bind-key.c,v 1.17 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c index ddb967e1906..8186cb3f211 100644 --- a/usr.bin/tmux/cmd-break-pane.c +++ b/usr.bin/tmux/cmd-break-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-break-pane.c,v 1.21 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: cmd-break-pane.c,v 1.22 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c index 20d934367ac..d574edc7657 100644 --- a/usr.bin/tmux/cmd-capture-pane.c +++ b/usr.bin/tmux/cmd-capture-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-capture-pane.c,v 1.24 2013/03/25 11:42:19 nicm Exp $ */ +/* $OpenBSD: cmd-capture-pane.c,v 1.25 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado <radobobo@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-choose-buffer.c b/usr.bin/tmux/cmd-choose-buffer.c index 21e35fe94b4..4c4440da97d 100644 --- a/usr.bin/tmux/cmd-choose-buffer.c +++ b/usr.bin/tmux/cmd-choose-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-buffer.c,v 1.14 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-choose-buffer.c,v 1.15 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-choose-client.c b/usr.bin/tmux/cmd-choose-client.c index bcf73a04682..0da248d02f3 100644 --- a/usr.bin/tmux/cmd-choose-client.c +++ b/usr.bin/tmux/cmd-choose-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-client.c,v 1.18 2013/03/25 10:04:44 nicm Exp $ */ +/* $OpenBSD: cmd-choose-client.c,v 1.19 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-choose-list.c b/usr.bin/tmux/cmd-choose-list.c index 4f81dfc2368..fcd664e17bd 100644 --- a/usr.bin/tmux/cmd-choose-list.c +++ b/usr.bin/tmux/cmd-choose-list.c @@ -1,4 +1,4 @@ -/* $Id: cmd-choose-list.c,v 1.7 2013/03/24 09:54:10 nicm Exp $ */ +/* $Id: cmd-choose-list.c,v 1.8 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam <thomas@xteddy.org> @@ -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/usr.bin/tmux/cmd-choose-tree.c b/usr.bin/tmux/cmd-choose-tree.c index 2e34537fad0..9073dd48848 100644 --- a/usr.bin/tmux/cmd-choose-tree.c +++ b/usr.bin/tmux/cmd-choose-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-choose-tree.c,v 1.24 2013/10/10 11:58:52 nicm Exp $ */ +/* $OpenBSD: cmd-choose-tree.c,v 1.25 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam <thomas@xteddy.org> @@ -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/usr.bin/tmux/cmd-clear-history.c b/usr.bin/tmux/cmd-clear-history.c index da7b0295044..134505c69b9 100644 --- a/usr.bin/tmux/cmd-clear-history.c +++ b/usr.bin/tmux/cmd-clear-history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-clear-history.c,v 1.10 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-clear-history.c,v 1.11 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-clock-mode.c b/usr.bin/tmux/cmd-clock-mode.c index 4ca5391919a..beddbe639c0 100644 --- a/usr.bin/tmux/cmd-clock-mode.c +++ b/usr.bin/tmux/cmd-clock-mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-clock-mode.c,v 1.8 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-clock-mode.c,v 1.9 2013/10/10 12:00:18 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c index f7457e805cd..046796da14b 100644 --- a/usr.bin/tmux/cmd-command-prompt.c +++ b/usr.bin/tmux/cmd-command-prompt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-command-prompt.c,v 1.26 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-command-prompt.c,v 1.27 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c index f3538766698..dbcb555f668 100644 --- a/usr.bin/tmux/cmd-confirm-before.c +++ b/usr.bin/tmux/cmd-confirm-before.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-confirm-before.c,v 1.19 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-confirm-before.c,v 1.20 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -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/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c index 2f5272f94e6..63c9719f457 100644 --- a/usr.bin/tmux/cmd-copy-mode.c +++ b/usr.bin/tmux/cmd-copy-mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-copy-mode.c,v 1.15 2013/03/28 15:07:42 nicm Exp $ */ +/* $OpenBSD: cmd-copy-mode.c,v 1.16 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-delete-buffer.c b/usr.bin/tmux/cmd-delete-buffer.c index 45cef23ff07..701900a9f6e 100644 --- a/usr.bin/tmux/cmd-delete-buffer.c +++ b/usr.bin/tmux/cmd-delete-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-delete-buffer.c,v 1.9 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-delete-buffer.c,v 1.10 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-detach-client.c b/usr.bin/tmux/cmd-detach-client.c index 356d0835f0b..a7342bf71b4 100644 --- a/usr.bin/tmux/cmd-detach-client.c +++ b/usr.bin/tmux/cmd-detach-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-detach-client.c,v 1.13 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-detach-client.c,v 1.14 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index 7609373c840..88cbb9adaaf 100644 --- a/usr.bin/tmux/cmd-display-message.c +++ b/usr.bin/tmux/cmd-display-message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-message.c,v 1.22 2013/03/25 11:42:01 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.23 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -36,7 +36,6 @@ const struct cmd_entry cmd_display_message_entry = { " [message]", 0, NULL, - NULL, cmd_display_message_exec }; diff --git a/usr.bin/tmux/cmd-display-panes.c b/usr.bin/tmux/cmd-display-panes.c index f71ba727fc4..f806b5d03cb 100644 --- a/usr.bin/tmux/cmd-display-panes.c +++ b/usr.bin/tmux/cmd-display-panes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-panes.c,v 1.6 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-display-panes.c,v 1.7 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-find-window.c b/usr.bin/tmux/cmd-find-window.c index d31239023e9..cab9c7e6b67 100644 --- a/usr.bin/tmux/cmd-find-window.c +++ b/usr.bin/tmux/cmd-find-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-find-window.c,v 1.24 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-find-window.c,v 1.25 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-has-session.c b/usr.bin/tmux/cmd-has-session.c index bcf2fa782c0..d3b9562169b 100644 --- a/usr.bin/tmux/cmd-has-session.c +++ b/usr.bin/tmux/cmd-has-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-has-session.c,v 1.8 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-has-session.c,v 1.9 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index 7704efd65d3..50ec9862a54 100644 --- a/usr.bin/tmux/cmd-if-shell.c +++ b/usr.bin/tmux/cmd-if-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-if-shell.c,v 1.23 2013/03/25 16:04:07 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.24 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -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/usr.bin/tmux/cmd-join-pane.c b/usr.bin/tmux/cmd-join-pane.c index 1cc07806b44..0948c6e975b 100644 --- a/usr.bin/tmux/cmd-join-pane.c +++ b/usr.bin/tmux/cmd-join-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-join-pane.c,v 1.14 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: cmd-join-pane.c,v 1.15 2013/10/10 12:00:19 nicm Exp $ */ /* * Copyright (c) 2011 George Nachman <tmux@georgester.com> @@ -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/usr.bin/tmux/cmd-kill-pane.c b/usr.bin/tmux/cmd-kill-pane.c index a54e50efc33..a53ac179000 100644 --- a/usr.bin/tmux/cmd-kill-pane.c +++ b/usr.bin/tmux/cmd-kill-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-pane.c,v 1.14 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: cmd-kill-pane.c,v 1.15 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-kill-server.c b/usr.bin/tmux/cmd-kill-server.c index 858014ba3fd..15a1476af7a 100644 --- a/usr.bin/tmux/cmd-kill-server.c +++ b/usr.bin/tmux/cmd-kill-server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-server.c,v 1.10 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-kill-server.c,v 1.11 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_server_entry = { "", 0, NULL, - NULL, cmd_kill_server_exec }; diff --git a/usr.bin/tmux/cmd-kill-session.c b/usr.bin/tmux/cmd-kill-session.c index a13bc007761..9f52eb3bd64 100644 --- a/usr.bin/tmux/cmd-kill-session.c +++ b/usr.bin/tmux/cmd-kill-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-session.c,v 1.12 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-kill-session.c,v 1.13 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-kill-window.c b/usr.bin/tmux/cmd-kill-window.c index 8e8cff5d9d5..35bf3fe0e44 100644 --- a/usr.bin/tmux/cmd-kill-window.c +++ b/usr.bin/tmux/cmd-kill-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-kill-window.c,v 1.13 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-kill-window.c,v 1.14 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-link-window.c b/usr.bin/tmux/cmd-link-window.c index d5e7fb4e7a6..087e7b52ff7 100644 --- a/usr.bin/tmux/cmd-link-window.c +++ b/usr.bin/tmux/cmd-link-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-link-window.c,v 1.13 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-link-window.c,v 1.14 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-list-buffers.c b/usr.bin/tmux/cmd-list-buffers.c index 0ac14934271..fb907852325 100644 --- a/usr.bin/tmux/cmd-list-buffers.c +++ b/usr.bin/tmux/cmd-list-buffers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-buffers.c,v 1.17 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-list-buffers.c,v 1.18 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_buffers_entry = { "[-F format]", 0, NULL, - NULL, cmd_list_buffers_exec }; diff --git a/usr.bin/tmux/cmd-list-clients.c b/usr.bin/tmux/cmd-list-clients.c index 8b45316900a..ef4993ae61e 100644 --- a/usr.bin/tmux/cmd-list-clients.c +++ b/usr.bin/tmux/cmd-list-clients.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-clients.c,v 1.16 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-list-clients.c,v 1.17 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-list-commands.c b/usr.bin/tmux/cmd-list-commands.c index 9a4aa7f082a..95375ccfa22 100644 --- a/usr.bin/tmux/cmd-list-commands.c +++ b/usr.bin/tmux/cmd-list-commands.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-commands.c,v 1.10 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-list-commands.c,v 1.11 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -32,7 +32,6 @@ const struct cmd_entry cmd_list_commands_entry = { "", 0, NULL, - NULL, cmd_list_commands_exec }; diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index 47e7a641107..5ab437c54a9 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.21 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.22 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-list-panes.c b/usr.bin/tmux/cmd-list-panes.c index b9c0c180c2e..419b5b776a8 100644 --- a/usr.bin/tmux/cmd-list-panes.c +++ b/usr.bin/tmux/cmd-list-panes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-panes.c,v 1.17 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-list-panes.c,v 1.18 2013/10/10 12:00:20 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-list-sessions.c b/usr.bin/tmux/cmd-list-sessions.c index 41aaab00f1c..0c73c58a86d 100644 --- a/usr.bin/tmux/cmd-list-sessions.c +++ b/usr.bin/tmux/cmd-list-sessions.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-sessions.c,v 1.15 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-list-sessions.c,v 1.16 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_sessions_entry = { "[-F format]", 0, NULL, - NULL, cmd_list_sessions_exec }; diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c index f1b6e6eb980..f38df5e08a7 100644 --- a/usr.bin/tmux/cmd-list-windows.c +++ b/usr.bin/tmux/cmd-list-windows.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-windows.c,v 1.26 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-list-windows.c,v 1.27 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c index a92c3eddc68..e46fa098dd2 100644 --- a/usr.bin/tmux/cmd-load-buffer.c +++ b/usr.bin/tmux/cmd-load-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-load-buffer.c,v 1.23 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-load-buffer.c,v 1.24 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -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/usr.bin/tmux/cmd-lock-server.c b/usr.bin/tmux/cmd-lock-server.c index 3e1075722e0..4dd0cb45645 100644 --- a/usr.bin/tmux/cmd-lock-server.c +++ b/usr.bin/tmux/cmd-lock-server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-lock-server.c,v 1.14 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-lock-server.c,v 1.15 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-move-window.c b/usr.bin/tmux/cmd-move-window.c index bdadd35a1f8..8c7edeb6be8 100644 --- a/usr.bin/tmux/cmd-move-window.c +++ b/usr.bin/tmux/cmd-move-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-move-window.c,v 1.15 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-move-window.c,v 1.16 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 4b8aaef196f..869b7fbb7b0 100644 --- a/usr.bin/tmux/cmd-new-session.c +++ b/usr.bin/tmux/cmd-new-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-session.c,v 1.50 2013/03/25 11:44:00 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.51 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c index 3d6bb2818b0..305a7102d01 100644 --- a/usr.bin/tmux/cmd-new-window.c +++ b/usr.bin/tmux/cmd-new-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-new-window.c,v 1.32 2013/03/25 11:44:00 nicm Exp $ */ +/* $OpenBSD: cmd-new-window.c,v 1.33 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c index 1cbaca87360..664485ceaff 100644 --- a/usr.bin/tmux/cmd-paste-buffer.c +++ b/usr.bin/tmux/cmd-paste-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-paste-buffer.c,v 1.22 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-paste-buffer.c,v 1.23 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c index d545d0546d6..c525888ca96 100644 --- a/usr.bin/tmux/cmd-pipe-pane.c +++ b/usr.bin/tmux/cmd-pipe-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-pipe-pane.c,v 1.25 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-pipe-pane.c,v 1.26 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-refresh-client.c b/usr.bin/tmux/cmd-refresh-client.c index cb83fdfbf31..9fabde9779b 100644 --- a/usr.bin/tmux/cmd-refresh-client.c +++ b/usr.bin/tmux/cmd-refresh-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-refresh-client.c,v 1.11 2013/10/10 11:46:47 nicm Exp $ */ +/* $OpenBSD: cmd-refresh-client.c,v 1.12 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-rename-session.c b/usr.bin/tmux/cmd-rename-session.c index afcf11c3ab7..c7551d28124 100644 --- a/usr.bin/tmux/cmd-rename-session.c +++ b/usr.bin/tmux/cmd-rename-session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rename-session.c,v 1.14 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-rename-session.c,v 1.15 2013/10/10 12:00:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-rename-window.c b/usr.bin/tmux/cmd-rename-window.c index cbf2f31a649..009e3ad7bdd 100644 --- a/usr.bin/tmux/cmd-rename-window.c +++ b/usr.bin/tmux/cmd-rename-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rename-window.c,v 1.9 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-rename-window.c,v 1.10 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-resize-pane.c b/usr.bin/tmux/cmd-resize-pane.c index b4ca8d6c39b..c229fad9bbb 100644 --- a/usr.bin/tmux/cmd-resize-pane.c +++ b/usr.bin/tmux/cmd-resize-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-resize-pane.c,v 1.15 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: cmd-resize-pane.c,v 1.16 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-respawn-pane.c b/usr.bin/tmux/cmd-respawn-pane.c index 9bcfa273c6f..2c41c9da836 100644 --- a/usr.bin/tmux/cmd-respawn-pane.c +++ b/usr.bin/tmux/cmd-respawn-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-respawn-pane.c,v 1.8 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-respawn-pane.c,v 1.9 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-respawn-window.c b/usr.bin/tmux/cmd-respawn-window.c index 0c6e5e9f358..14d777c7f59 100644 --- a/usr.bin/tmux/cmd-respawn-window.c +++ b/usr.bin/tmux/cmd-respawn-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-respawn-window.c,v 1.18 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: cmd-respawn-window.c,v 1.19 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-rotate-window.c b/usr.bin/tmux/cmd-rotate-window.c index cbead05375b..9144f5d7277 100644 --- a/usr.bin/tmux/cmd-rotate-window.c +++ b/usr.bin/tmux/cmd-rotate-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-rotate-window.c,v 1.13 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-rotate-window.c,v 1.14 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index 18f93aea2b3..aaafc47e30c 100644 --- a/usr.bin/tmux/cmd-run-shell.c +++ b/usr.bin/tmux/cmd-run-shell.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-run-shell.c,v 1.23 2013/03/25 16:04:07 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.24 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -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/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c index 35a64d069b3..7e5bc3b9ad7 100644 --- a/usr.bin/tmux/cmd-save-buffer.c +++ b/usr.bin/tmux/cmd-save-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-save-buffer.c,v 1.19 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-save-buffer.c,v 1.20 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -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/usr.bin/tmux/cmd-select-layout.c b/usr.bin/tmux/cmd-select-layout.c index dceab05b3d2..648fe38f56f 100644 --- a/usr.bin/tmux/cmd-select-layout.c +++ b/usr.bin/tmux/cmd-select-layout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-layout.c,v 1.20 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: cmd-select-layout.c,v 1.21 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c index 3f9f8f2ac5f..e543a9a4fd6 100644 --- a/usr.bin/tmux/cmd-select-pane.c +++ b/usr.bin/tmux/cmd-select-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-pane.c,v 1.16 2013/03/24 09:57:59 nicm Exp $ */ +/* $OpenBSD: cmd-select-pane.c,v 1.17 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-select-window.c b/usr.bin/tmux/cmd-select-window.c index 86d6480db0f..551992f7cc2 100644 --- a/usr.bin/tmux/cmd-select-window.c +++ b/usr.bin/tmux/cmd-select-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-window.c,v 1.10 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-select-window.c,v 1.11 2013/10/10 12:00:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c index 2b7a79a277d..bbe0fa31578 100644 --- a/usr.bin/tmux/cmd-send-keys.c +++ b/usr.bin/tmux/cmd-send-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-send-keys.c,v 1.16 2013/05/31 12:50:05 nicm Exp $ */ +/* $OpenBSD: cmd-send-keys.c,v 1.17 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-server-info.c b/usr.bin/tmux/cmd-server-info.c index 911164a7750..02772dfca79 100644 --- a/usr.bin/tmux/cmd-server-info.c +++ b/usr.bin/tmux/cmd-server-info.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-server-info.c,v 1.33 2013/03/25 10:11:45 nicm Exp $ */ +/* $OpenBSD: cmd-server-info.c,v 1.34 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -39,7 +39,6 @@ const struct cmd_entry cmd_server_info_entry = { "", 0, NULL, - NULL, cmd_server_info_exec }; diff --git a/usr.bin/tmux/cmd-set-buffer.c b/usr.bin/tmux/cmd-set-buffer.c index db1703fb9ca..0aaa705978a 100644 --- a/usr.bin/tmux/cmd-set-buffer.c +++ b/usr.bin/tmux/cmd-set-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-buffer.c,v 1.13 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-set-buffer.c,v 1.14 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-set-environment.c b/usr.bin/tmux/cmd-set-environment.c index b7b15933628..8833ea8ab57 100644 --- a/usr.bin/tmux/cmd-set-environment.c +++ b/usr.bin/tmux/cmd-set-environment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-environment.c,v 1.8 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-set-environment.c,v 1.9 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index a8a25a22145..d2b63e54fe0 100644 --- a/usr.bin/tmux/cmd-set-option.c +++ b/usr.bin/tmux/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.62 2013/07/05 15:10:38 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.63 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-show-environment.c b/usr.bin/tmux/cmd-show-environment.c index c90f6a5eea0..8aee6a633a6 100644 --- a/usr.bin/tmux/cmd-show-environment.c +++ b/usr.bin/tmux/cmd-show-environment.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-environment.c,v 1.7 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-show-environment.c,v 1.8 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-show-messages.c b/usr.bin/tmux/cmd-show-messages.c index c0971b49e47..1c93b2d5ef3 100644 --- a/usr.bin/tmux/cmd-show-messages.c +++ b/usr.bin/tmux/cmd-show-messages.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-messages.c,v 1.6 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-show-messages.c,v 1.7 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c index 4949482c037..5330c9139d9 100644 --- a/usr.bin/tmux/cmd-show-options.c +++ b/usr.bin/tmux/cmd-show-options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-options.c,v 1.20 2013/03/25 10:04:04 nicm Exp $ */ +/* $OpenBSD: cmd-show-options.c,v 1.21 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-source-file.c b/usr.bin/tmux/cmd-source-file.c index c6e49ae47b4..56bcd95234a 100644 --- a/usr.bin/tmux/cmd-source-file.c +++ b/usr.bin/tmux/cmd-source-file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-source-file.c,v 1.17 2013/04/12 12:44:31 nicm Exp $ */ +/* $OpenBSD: cmd-source-file.c,v 1.18 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org> @@ -37,7 +37,6 @@ const struct cmd_entry cmd_source_file_entry = { "path", 0, NULL, - NULL, cmd_source_file_exec }; diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c index 8a072121dbb..83e92248c92 100644 --- a/usr.bin/tmux/cmd-split-window.c +++ b/usr.bin/tmux/cmd-split-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-split-window.c,v 1.42 2013/03/25 15:59:57 nicm Exp $ */ +/* $OpenBSD: cmd-split-window.c,v 1.43 2013/10/10 12:00:23 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -37,7 +37,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/usr.bin/tmux/cmd-start-server.c b/usr.bin/tmux/cmd-start-server.c index 41fe8f5284b..ae36b58a241 100644 --- a/usr.bin/tmux/cmd-start-server.c +++ b/usr.bin/tmux/cmd-start-server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-start-server.c,v 1.9 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-start-server.c,v 1.10 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -32,7 +32,6 @@ const struct cmd_entry cmd_start_server_entry = { "", CMD_STARTSERVER, NULL, - NULL, cmd_start_server_exec }; diff --git a/usr.bin/tmux/cmd-suspend-client.c b/usr.bin/tmux/cmd-suspend-client.c index b5c79e2b363..4307fad6323 100644 --- a/usr.bin/tmux/cmd-suspend-client.c +++ b/usr.bin/tmux/cmd-suspend-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-suspend-client.c,v 1.9 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-suspend-client.c,v 1.10 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-swap-pane.c b/usr.bin/tmux/cmd-swap-pane.c index 433fce5d85b..6d2f6664e0d 100644 --- a/usr.bin/tmux/cmd-swap-pane.c +++ b/usr.bin/tmux/cmd-swap-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-swap-pane.c,v 1.17 2013/03/28 15:08:12 nicm Exp $ */ +/* $OpenBSD: cmd-swap-pane.c,v 1.18 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-swap-window.c b/usr.bin/tmux/cmd-swap-window.c index dfed4551362..b6712a3933c 100644 --- a/usr.bin/tmux/cmd-swap-window.c +++ b/usr.bin/tmux/cmd-swap-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-swap-window.c,v 1.9 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-swap-window.c,v 1.10 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index 4041f84b0fd..2a2e82765d4 100644 --- a/usr.bin/tmux/cmd-switch-client.c +++ b/usr.bin/tmux/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-switch-client.c,v 1.17 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.18 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-unbind-key.c b/usr.bin/tmux/cmd-unbind-key.c index 69d3d4472b2..61d3389db34 100644 --- a/usr.bin/tmux/cmd-unbind-key.c +++ b/usr.bin/tmux/cmd-unbind-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-unbind-key.c,v 1.16 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-unbind-key.c,v 1.17 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-unlink-window.c b/usr.bin/tmux/cmd-unlink-window.c index 67e03861c71..d98dbaa8213 100644 --- a/usr.bin/tmux/cmd-unlink-window.c +++ b/usr.bin/tmux/cmd-unlink-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-unlink-window.c,v 1.12 2013/03/24 09:54:10 nicm Exp $ */ +/* $OpenBSD: cmd-unlink-window.c,v 1.13 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/cmd-wait-for.c b/usr.bin/tmux/cmd-wait-for.c index 069f5a0e02a..cdb4e6af49f 100644 --- a/usr.bin/tmux/cmd-wait-for.c +++ b/usr.bin/tmux/cmd-wait-for.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-wait-for.c,v 1.2 2013/03/25 10:09:35 nicm Exp $ */ +/* $OpenBSD: cmd-wait-for.c,v 1.3 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net> @@ -36,7 +36,6 @@ const struct cmd_entry cmd_wait_for_entry = { "[-LSU] channel", 0, NULL, - NULL, cmd_wait_for_exec }; diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 000e2ee7210..1d6783bdc0f 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.85 2013/05/15 15:34:09 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.86 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -255,8 +255,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/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 59655a81669..9ee6e165da6 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.418 2013/10/10 11:59:23 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.419 2013/10/10 12:00:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1455,7 +1455,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 *); }; |