From 2022217c9daeafa8716f908857f5b55629372f02 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 14 Dec 2015 00:31:55 +0000 Subject: Instead of combined flags for -c, -s, -t, split into different sets using an enum and simplify the parsing code. --- usr.bin/tmux/cmd-attach-session.c | 6 +- usr.bin/tmux/cmd-break-pane.c | 7 +- usr.bin/tmux/cmd-capture-pane.c | 6 +- usr.bin/tmux/cmd-choose-buffer.c | 6 +- usr.bin/tmux/cmd-choose-client.c | 6 +- usr.bin/tmux/cmd-choose-tree.c | 15 +- usr.bin/tmux/cmd-clear-history.c | 6 +- usr.bin/tmux/cmd-command-prompt.c | 6 +- usr.bin/tmux/cmd-confirm-before.c | 6 +- usr.bin/tmux/cmd-copy-mode.c | 6 +- usr.bin/tmux/cmd-detach-client.c | 11 +- usr.bin/tmux/cmd-display-message.c | 7 +- usr.bin/tmux/cmd-display-panes.c | 6 +- usr.bin/tmux/cmd-find-window.c | 6 +- usr.bin/tmux/cmd-if-shell.c | 6 +- usr.bin/tmux/cmd-join-pane.c | 12 +- usr.bin/tmux/cmd-kill-pane.c | 6 +- usr.bin/tmux/cmd-kill-session.c | 6 +- usr.bin/tmux/cmd-kill-window.c | 10 +- usr.bin/tmux/cmd-list-clients.c | 6 +- usr.bin/tmux/cmd-list-panes.c | 6 +- usr.bin/tmux/cmd-list-windows.c | 6 +- usr.bin/tmux/cmd-lock-server.c | 10 +- usr.bin/tmux/cmd-move-window.c | 12 +- usr.bin/tmux/cmd-new-session.c | 10 +- usr.bin/tmux/cmd-new-window.c | 6 +- usr.bin/tmux/cmd-paste-buffer.c | 6 +- usr.bin/tmux/cmd-pipe-pane.c | 6 +- usr.bin/tmux/cmd-refresh-client.c | 6 +- usr.bin/tmux/cmd-rename-session.c | 6 +- usr.bin/tmux/cmd-rename-window.c | 6 +- usr.bin/tmux/cmd-resize-pane.c | 6 +- usr.bin/tmux/cmd-respawn-pane.c | 6 +- usr.bin/tmux/cmd-respawn-window.c | 6 +- usr.bin/tmux/cmd-rotate-window.c | 6 +- usr.bin/tmux/cmd-run-shell.c | 6 +- usr.bin/tmux/cmd-select-layout.c | 14 +- usr.bin/tmux/cmd-select-pane.c | 10 +- usr.bin/tmux/cmd-select-window.c | 18 ++- usr.bin/tmux/cmd-send-keys.c | 10 +- usr.bin/tmux/cmd-set-environment.c | 6 +- usr.bin/tmux/cmd-set-hook.c | 10 +- usr.bin/tmux/cmd-set-option.c | 10 +- usr.bin/tmux/cmd-show-environment.c | 6 +- usr.bin/tmux/cmd-show-messages.c | 6 +- usr.bin/tmux/cmd-show-options.c | 10 +- usr.bin/tmux/cmd-split-window.c | 6 +- usr.bin/tmux/cmd-swap-pane.c | 31 ++-- usr.bin/tmux/cmd-swap-window.c | 7 +- usr.bin/tmux/cmd-switch-client.c | 8 +- usr.bin/tmux/cmd.c | 309 +++++++++++------------------------- usr.bin/tmux/log.c | 3 +- usr.bin/tmux/tmux.h | 55 ++++--- 53 files changed, 400 insertions(+), 375 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c index 6c4061afc45..a80bf51259b 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.56 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-attach-session.c,v 1.57 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -39,7 +39,9 @@ const struct cmd_entry cmd_attach_session_entry = { .args = { "c:dErt:", 0, 0 }, .usage = "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE, - .flags = CMD_STARTSERVER|CMD_SESSION_T|CMD_PANE_T|CMD_PREFERUNATTACHED, + .tflag = CMD_SESSION_WITHPANE, + + .flags = CMD_STARTSERVER, .exec = cmd_attach_session_exec }; diff --git a/usr.bin/tmux/cmd-break-pane.c b/usr.bin/tmux/cmd-break-pane.c index 22df825dd35..a85be8bfb72 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.34 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-break-pane.c,v 1.35 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -37,7 +37,10 @@ const struct cmd_entry cmd_break_pane_entry = { .args = { "dPF:s:t:", 0, 0 }, .usage = "[-dP] [-F format] " CMD_SRCDST_PANE_USAGE, - .flags = CMD_PANE_S|CMD_INDEX_T, + .sflag = CMD_PANE, + .tflag = CMD_WINDOW_INDEX, + + .flags = 0, .exec = cmd_break_pane_exec }; diff --git a/usr.bin/tmux/cmd-capture-pane.c b/usr.bin/tmux/cmd-capture-pane.c index 4b8e4586b96..7af5e56462f 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.37 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-capture-pane.c,v 1.38 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado @@ -43,7 +43,9 @@ const struct cmd_entry cmd_capture_pane_entry = { .usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] " "[-S start-line]" CMD_TARGET_PANE_USAGE, - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_capture_pane_exec }; diff --git a/usr.bin/tmux/cmd-choose-buffer.c b/usr.bin/tmux/cmd-choose-buffer.c index 96dfd129844..d790e9c6cc5 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.27 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-choose-buffer.c,v 1.28 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott @@ -39,7 +39,9 @@ const struct cmd_entry cmd_choose_buffer_entry = { .args = { "F:t:", 0, 1 }, .usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_choose_buffer_exec }; diff --git a/usr.bin/tmux/cmd-choose-client.c b/usr.bin/tmux/cmd-choose-client.c index bc9a86cd4ae..5fa6c2feea7 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.27 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-choose-client.c,v 1.28 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -44,7 +44,9 @@ const struct cmd_entry cmd_choose_client_entry = { .args = { "F:t:", 0, 1 }, .usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_choose_client_exec }; diff --git a/usr.bin/tmux/cmd-choose-tree.c b/usr.bin/tmux/cmd-choose-tree.c index b6ad37a6cf0..e29e28cf6d4 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.30 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-choose-tree.c,v 1.31 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam @@ -51,7 +51,9 @@ const struct cmd_entry cmd_choose_tree_entry = { .usage = "[-suw] [-b session-template] [-c window template] " "[-S format] [-W format] " CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_choose_tree_exec }; @@ -60,10 +62,11 @@ const struct cmd_entry cmd_choose_session_entry = { .alias = NULL, .args = { "F:t:", 0, 1 }, - .usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_choose_tree_exec }; @@ -74,7 +77,9 @@ const struct cmd_entry cmd_choose_window_entry = { .args = { "F:t:", 0, 1 }, .usage = CMD_TARGET_WINDOW_USAGE "[-F format] [template]", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_choose_tree_exec }; diff --git a/usr.bin/tmux/cmd-clear-history.c b/usr.bin/tmux/cmd-clear-history.c index 7fd336991dd..a63408171da 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.16 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-clear-history.c,v 1.17 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -33,7 +33,9 @@ const struct cmd_entry cmd_clear_history_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_PANE_USAGE, - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_clear_history_exec }; diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c index 39b644670f6..2ca1ddc1913 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.31 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-command-prompt.c,v 1.32 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -42,7 +42,9 @@ const struct cmd_entry cmd_command_prompt_entry = { .usage = "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " " "[template]", - .flags = CMD_CLIENT_T, + .tflag = CMD_CLIENT, + + .flags = 0, .exec = cmd_command_prompt_exec }; diff --git a/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c index 34acf914607..07852c423d6 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.27 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-confirm-before.c,v 1.28 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -40,7 +40,9 @@ const struct cmd_entry cmd_confirm_before_entry = { .args = { "p:t:", 1, 1 }, .usage = "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", - .flags = CMD_CLIENT_T, + .tflag = CMD_CLIENT, + + .flags = 0, .exec = cmd_confirm_before_exec }; diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c index 9b1c0cfb228..3e83b2764f5 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.23 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-copy-mode.c,v 1.24 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -33,7 +33,9 @@ const struct cmd_entry cmd_copy_mode_entry = { .args = { "Met:u", 0, 0 }, .usage = "[-Mu] " CMD_TARGET_PANE_USAGE, - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_copy_mode_exec }; diff --git a/usr.bin/tmux/cmd-detach-client.c b/usr.bin/tmux/cmd-detach-client.c index 1a5fa93031c..25cf2ea1bbd 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.25 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-detach-client.c,v 1.26 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -35,7 +35,10 @@ const struct cmd_entry cmd_detach_client_entry = { .args = { "as:t:P", 0, 0 }, .usage = "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, - .flags = CMD_READONLY|CMD_CLIENT_T|CMD_SESSION_S, + .sflag = CMD_SESSION, + .tflag = CMD_CLIENT, + + .flags = CMD_READONLY, .exec = cmd_detach_client_exec }; @@ -46,7 +49,9 @@ const struct cmd_entry cmd_suspend_client_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_CLIENT_USAGE, - .flags = CMD_CLIENT_T, + .tflag = CMD_CLIENT, + + .flags = 0, .exec = cmd_detach_client_exec }; diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index 44cc7c9224e..f0a031721a2 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.34 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.35 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -42,7 +42,10 @@ const struct cmd_entry cmd_display_message_entry = { .usage = "[-p] [-c target-client] [-F format] " CMD_TARGET_PANE_USAGE " [message]", - .flags = CMD_CLIENT_C|CMD_PANE_T|CMD_CLIENT_CANFAIL, + .cflag = CMD_CLIENT_CANFAIL, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_display_message_exec }; diff --git a/usr.bin/tmux/cmd-display-panes.c b/usr.bin/tmux/cmd-display-panes.c index 8c8b8bae3c3..69c718ba4bb 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.10 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-display-panes.c,v 1.11 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -33,7 +33,9 @@ const struct cmd_entry cmd_display_panes_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_CLIENT_USAGE, - .flags = CMD_CLIENT_T, + .tflag = CMD_CLIENT, + + .flags = 0, .exec = cmd_display_panes_exec }; diff --git a/usr.bin/tmux/cmd-find-window.c b/usr.bin/tmux/cmd-find-window.c index cebcc117b7e..7daae0f55c0 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.35 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-find-window.c,v 1.36 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -54,7 +54,9 @@ const struct cmd_entry cmd_find_window_entry = { .args = { "F:CNt:T", 1, 4 }, .usage = "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_find_window_exec }; diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c index a6b4cfd3c2e..489353f2675 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.39 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-if-shell.c,v 1.40 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -43,7 +43,9 @@ const struct cmd_entry cmd_if_shell_entry = { .usage = "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command " "[command]", - .flags = CMD_PANE_T|CMD_CANFAIL, + .tflag = CMD_PANE_CANFAIL, + + .flags = 0, .exec = cmd_if_shell_exec }; diff --git a/usr.bin/tmux/cmd-join-pane.c b/usr.bin/tmux/cmd-join-pane.c index 9b392e9af55..85c1e7e45f5 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.21 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-join-pane.c,v 1.22 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2011 George Nachman @@ -40,7 +40,10 @@ const struct cmd_entry cmd_join_pane_entry = { .args = { "bdhvp:l:s:t:", 0, 0 }, .usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE, - .flags = CMD_PANE_MARKED_S|CMD_PANE_T, + .sflag = CMD_PANE_MARKED, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_join_pane_exec }; @@ -51,7 +54,10 @@ const struct cmd_entry cmd_move_pane_entry = { .args = { "bdhvp:l:s:t:", 0, 0 }, .usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE, - .flags = CMD_PANE_S|CMD_PANE_T, + .sflag = CMD_PANE, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_join_pane_exec }; diff --git a/usr.bin/tmux/cmd-kill-pane.c b/usr.bin/tmux/cmd-kill-pane.c index 67cc9cc7983..5b64f346467 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.18 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-kill-pane.c,v 1.19 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -35,7 +35,9 @@ const struct cmd_entry cmd_kill_pane_entry = { .args = { "at:", 0, 0 }, .usage = "[-a] " CMD_TARGET_PANE_USAGE, - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_kill_pane_exec }; diff --git a/usr.bin/tmux/cmd-kill-session.c b/usr.bin/tmux/cmd-kill-session.c index 41953476a40..3a1f8c17d8f 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.18 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-kill-session.c,v 1.19 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -36,7 +36,9 @@ const struct cmd_entry cmd_kill_session_entry = { .args = { "aCt:", 0, 0 }, .usage = "[-aC] " CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_kill_session_exec }; diff --git a/usr.bin/tmux/cmd-kill-window.c b/usr.bin/tmux/cmd-kill-window.c index 1a2e2f7ff9b..b4a9eadef6f 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.19 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-kill-window.c,v 1.20 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -33,7 +33,9 @@ const struct cmd_entry cmd_kill_window_entry = { .args = { "at:", 0, 0 }, .usage = "[-a] " CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_kill_window_exec }; @@ -44,7 +46,9 @@ const struct cmd_entry cmd_unlink_window_entry = { .args = { "kt:", 0, 0 }, .usage = "[-k] " CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_kill_window_exec }; diff --git a/usr.bin/tmux/cmd-list-clients.c b/usr.bin/tmux/cmd-list-clients.c index 953f5a6e378..e17d773e3fc 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.25 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-list-clients.c,v 1.26 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -42,7 +42,9 @@ const struct cmd_entry cmd_list_clients_entry = { .args = { "F:t:", 0, 0 }, .usage = "[-F format] " CMD_TARGET_SESSION_USAGE, - .flags = CMD_READONLY|CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = CMD_READONLY, .exec = cmd_list_clients_exec }; diff --git a/usr.bin/tmux/cmd-list-panes.c b/usr.bin/tmux/cmd-list-panes.c index 5b57608a7f2..6067545e4fc 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.25 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-list-panes.c,v 1.26 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -41,7 +41,9 @@ const struct cmd_entry cmd_list_panes_entry = { .args = { "asF:t:", 0, 0 }, .usage = "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_list_panes_exec }; diff --git a/usr.bin/tmux/cmd-list-windows.c b/usr.bin/tmux/cmd-list-windows.c index 3beb75ec55f..351514dd397 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.35 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-list-windows.c,v 1.36 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -52,7 +52,9 @@ const struct cmd_entry cmd_list_windows_entry = { .args = { "F:at:", 0, 0 }, .usage = "[-a] [-F format] " CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_list_windows_exec }; diff --git a/usr.bin/tmux/cmd-lock-server.c b/usr.bin/tmux/cmd-lock-server.c index af8f177ac81..57f15812624 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.20 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-lock-server.c,v 1.21 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -44,7 +44,9 @@ const struct cmd_entry cmd_lock_session_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_lock_server_exec }; @@ -55,7 +57,9 @@ const struct cmd_entry cmd_lock_client_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_CLIENT_USAGE, - .flags = CMD_CLIENT_T, + .tflag = CMD_CLIENT, + + .flags = 0, .exec = cmd_lock_server_exec }; diff --git a/usr.bin/tmux/cmd-move-window.c b/usr.bin/tmux/cmd-move-window.c index 3d2ba0bd42c..60dc82d6db0 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.23 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-move-window.c,v 1.24 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -35,7 +35,10 @@ const struct cmd_entry cmd_move_window_entry = { .args = { "adkrs:t:", 0, 0 }, .usage = "[-dkr] " CMD_SRCDST_WINDOW_USAGE, - .flags = CMD_WINDOW_S|CMD_MOVEW_R|CMD_INDEX_T, + .sflag = CMD_WINDOW, + .tflag = CMD_MOVEW_R, + + .flags = 0, .exec = cmd_move_window_exec }; @@ -46,7 +49,10 @@ const struct cmd_entry cmd_link_window_entry = { .args = { "adks:t:", 0, 0 }, .usage = "[-dk] " CMD_SRCDST_WINDOW_USAGE, - .flags = CMD_WINDOW_S|CMD_INDEX_T, + .sflag = CMD_WINDOW, + .tflag = CMD_WINDOW_INDEX, + + .flags = 0, .exec = cmd_move_window_exec }; diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index 1ddd3f1848a..9ebea1e27f8 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.82 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.83 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -44,7 +44,9 @@ const struct cmd_entry cmd_new_session_entry = { "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] " "[-y height] [command]", - .flags = CMD_STARTSERVER|CMD_CANFAIL|CMD_SESSION_T, + .tflag = CMD_SESSION_CANFAIL, + + .flags = CMD_STARTSERVER, .exec = cmd_new_session_exec }; @@ -55,7 +57,9 @@ const struct cmd_entry cmd_has_session_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_new_session_exec }; diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c index a3985a5276d..97c84a41321 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.57 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-new-window.c,v 1.58 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -42,7 +42,9 @@ const struct cmd_entry cmd_new_window_entry = { .usage = "[-adkP] [-c start-directory] [-F format] [-n window-name] " CMD_TARGET_WINDOW_USAGE " [command]", - .flags = CMD_INDEX_T, + .tflag = CMD_WINDOW_INDEX, + + .flags = 0, .exec = cmd_new_window_exec }; diff --git a/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c index f2f62ceb598..867a6369c65 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.32 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-paste-buffer.c,v 1.33 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -41,7 +41,9 @@ const struct cmd_entry cmd_paste_buffer_entry = { .usage = "[-dpr] [-s separator] " CMD_BUFFER_USAGE " " CMD_TARGET_PANE_USAGE, - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_paste_buffer_exec }; diff --git a/usr.bin/tmux/cmd-pipe-pane.c b/usr.bin/tmux/cmd-pipe-pane.c index a9faba384ee..f88cfdc0877 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.34 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-pipe-pane.c,v 1.35 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -44,7 +44,9 @@ const struct cmd_entry cmd_pipe_pane_entry = { .args = { "ot:", 0, 1 }, .usage = "[-o] " CMD_TARGET_PANE_USAGE " [command]", - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_pipe_pane_exec }; diff --git a/usr.bin/tmux/cmd-refresh-client.c b/usr.bin/tmux/cmd-refresh-client.c index 0d3e58f1cc3..cc8fb5c9b3f 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.17 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-refresh-client.c,v 1.18 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -33,7 +33,9 @@ const struct cmd_entry cmd_refresh_client_entry = { .args = { "C:St:", 0, 0 }, .usage = "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE, - .flags = CMD_CLIENT_T, + .tflag = CMD_CLIENT, + + .flags = 0, .exec = cmd_refresh_client_exec }; diff --git a/usr.bin/tmux/cmd-rename-session.c b/usr.bin/tmux/cmd-rename-session.c index f3b7af145f5..3a99e8eaed7 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.18 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-rename-session.c,v 1.19 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -35,7 +35,9 @@ const struct cmd_entry cmd_rename_session_entry = { .args = { "t:", 1, 1 }, .usage = CMD_TARGET_SESSION_USAGE " new-name", - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_rename_session_exec }; diff --git a/usr.bin/tmux/cmd-rename-window.c b/usr.bin/tmux/cmd-rename-window.c index ec1ed01a9e6..e264d53d471 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.14 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-rename-window.c,v 1.15 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -35,7 +35,9 @@ const struct cmd_entry cmd_rename_window_entry = { .args = { "t:", 1, 1 }, .usage = CMD_TARGET_WINDOW_USAGE " new-name", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_rename_window_exec }; diff --git a/usr.bin/tmux/cmd-resize-pane.c b/usr.bin/tmux/cmd-resize-pane.c index eacbc45b358..589d2924309 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.20 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-resize-pane.c,v 1.21 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -38,7 +38,9 @@ const struct cmd_entry cmd_resize_pane_entry = { .usage = "[-DLMRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " " "[adjustment]", - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_resize_pane_exec }; diff --git a/usr.bin/tmux/cmd-respawn-pane.c b/usr.bin/tmux/cmd-respawn-pane.c index 217a1a42b77..f6cb7c3cb26 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.18 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-respawn-pane.c,v 1.19 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -37,7 +37,9 @@ const struct cmd_entry cmd_respawn_pane_entry = { .args = { "kt:", 0, -1 }, .usage = "[-k] " CMD_TARGET_PANE_USAGE " [command]", - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_respawn_pane_exec }; diff --git a/usr.bin/tmux/cmd-respawn-window.c b/usr.bin/tmux/cmd-respawn-window.c index a614f9608e9..cb72b48a4bb 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.27 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-respawn-window.c,v 1.28 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -36,7 +36,9 @@ const struct cmd_entry cmd_respawn_window_entry = { .args = { "kt:", 0, -1 }, .usage = "[-k] " CMD_TARGET_WINDOW_USAGE " [command]", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_respawn_window_exec }; diff --git a/usr.bin/tmux/cmd-rotate-window.c b/usr.bin/tmux/cmd-rotate-window.c index f996a4ec8e5..14c28536d9f 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.17 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-rotate-window.c,v 1.18 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -33,7 +33,9 @@ const struct cmd_entry cmd_rotate_window_entry = { .args = { "Dt:U", 0, 0 }, .usage = "[-DU] " CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_rotate_window_exec }; diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c index 7b2119ceabc..e477ca43f7b 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.34 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-run-shell.c,v 1.35 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -42,7 +42,9 @@ const struct cmd_entry cmd_run_shell_entry = { .args = { "bt:", 1, 1 }, .usage = "[-b] " CMD_TARGET_PANE_USAGE " shell-command", - .flags = CMD_PANE_T|CMD_CANFAIL, + .tflag = CMD_PANE_CANFAIL, + + .flags = 0, .exec = cmd_run_shell_exec }; diff --git a/usr.bin/tmux/cmd-select-layout.c b/usr.bin/tmux/cmd-select-layout.c index 17bcc406306..cb3263aeafe 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.27 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-select-layout.c,v 1.28 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -35,7 +35,9 @@ const struct cmd_entry cmd_select_layout_entry = { .args = { "nopt:", 0, 1 }, .usage = "[-nop] " CMD_TARGET_WINDOW_USAGE " [layout-name]", - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_select_layout_exec }; @@ -46,7 +48,9 @@ const struct cmd_entry cmd_next_layout_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_select_layout_exec }; @@ -57,7 +61,9 @@ const struct cmd_entry cmd_previous_layout_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_select_layout_exec }; diff --git a/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c index 7e34b948e3b..08df3f81fcd 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.28 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-select-pane.c,v 1.29 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -33,7 +33,9 @@ const struct cmd_entry cmd_select_pane_entry = { .args = { "DdegLlMmP:Rt:U", 0, 0 }, .usage = "[-DdegLlMmRU] [-P style] " CMD_TARGET_PANE_USAGE, - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_select_pane_exec }; @@ -44,7 +46,9 @@ const struct cmd_entry cmd_last_pane_entry = { .args = { "det:", 0, 0 }, .usage = "[-de] " CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_select_pane_exec }; diff --git a/usr.bin/tmux/cmd-select-window.c b/usr.bin/tmux/cmd-select-window.c index 2a05be73ace..31e7fabf4dd 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.14 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-select-window.c,v 1.15 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -35,7 +35,9 @@ const struct cmd_entry cmd_select_window_entry = { .args = { "lnpTt:", 0, 0 }, .usage = "[-lnpT] " CMD_TARGET_WINDOW_USAGE, - .flags = CMD_WINDOW_T, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_select_window_exec }; @@ -46,7 +48,9 @@ const struct cmd_entry cmd_next_window_entry = { .args = { "at:", 0, 0 }, .usage = "[-a] " CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_select_window_exec }; @@ -57,7 +61,9 @@ const struct cmd_entry cmd_previous_window_entry = { .args = { "at:", 0, 0 }, .usage = "[-a] " CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_select_window_exec }; @@ -68,7 +74,9 @@ const struct cmd_entry cmd_last_window_entry = { .args = { "t:", 0, 0 }, .usage = CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_select_window_exec }; diff --git a/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c index f469e247eaf..a79d8e1c047 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.25 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-send-keys.c,v 1.26 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -36,7 +36,9 @@ const struct cmd_entry cmd_send_keys_entry = { .args = { "lRMt:", 0, -1 }, .usage = "[-lRM] " CMD_TARGET_PANE_USAGE " key ...", - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_send_keys_exec }; @@ -47,7 +49,9 @@ const struct cmd_entry cmd_send_prefix_entry = { .args = { "2t:", 0, 0 }, .usage = "[-2] " CMD_TARGET_PANE_USAGE, - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_send_keys_exec }; diff --git a/usr.bin/tmux/cmd-set-environment.c b/usr.bin/tmux/cmd-set-environment.c index 259de845d8a..ec2aca41abf 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.14 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-set-environment.c,v 1.15 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -36,7 +36,9 @@ const struct cmd_entry cmd_set_environment_entry = { .args = { "grt:u", 1, 2 }, .usage = "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_set_environment_exec }; diff --git a/usr.bin/tmux/cmd-set-hook.c b/usr.bin/tmux/cmd-set-hook.c index 8b709e279aa..7fb580ceeb9 100644 --- a/usr.bin/tmux/cmd-set-hook.c +++ b/usr.bin/tmux/cmd-set-hook.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-hook.c,v 1.4 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-set-hook.c,v 1.5 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2012 Thomas Adam @@ -36,7 +36,9 @@ const struct cmd_entry cmd_set_hook_entry = { .args = { "gt:u", 1, 2 }, .usage = "[-gu] " CMD_TARGET_SESSION_USAGE " hook-name [command]", - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_set_hook_exec }; @@ -47,7 +49,9 @@ const struct cmd_entry cmd_show_hooks_entry = { .args = { "gt:", 0, 1 }, .usage = "[-g] " CMD_TARGET_SESSION_USAGE, - .flags = CMD_SESSION_T, + .tflag = CMD_SESSION, + + .flags = 0, .exec = cmd_set_hook_exec }; diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index f25675bed88..ac8394055d6 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.91 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.92 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -71,7 +71,9 @@ const struct cmd_entry cmd_set_option_entry = { .args = { "agoqst:uw", 1, 2 }, .usage = "[-agosquw] [-t target-window] option [value]", - .flags = CMD_WINDOW_T|CMD_CANFAIL, + .tflag = CMD_WINDOW_CANFAIL, + + .flags = 0, .exec = cmd_set_option_exec }; @@ -82,7 +84,9 @@ const struct cmd_entry cmd_set_window_option_entry = { .args = { "agoqt:u", 1, 2 }, .usage = "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", - .flags = CMD_WINDOW_T|CMD_CANFAIL, + .tflag = CMD_WINDOW_CANFAIL, + + .flags = 0, .exec = cmd_set_option_exec }; diff --git a/usr.bin/tmux/cmd-show-environment.c b/usr.bin/tmux/cmd-show-environment.c index 144c5783771..e025b8edce3 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.15 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-show-environment.c,v 1.16 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -40,7 +40,9 @@ const struct cmd_entry cmd_show_environment_entry = { .args = { "gst:", 0, 1 }, .usage = "[-gs] " CMD_TARGET_SESSION_USAGE " [name]", - .flags = CMD_SESSION_T|CMD_CANFAIL, + .tflag = CMD_SESSION_CANFAIL, + + .flags = 0, .exec = cmd_show_environment_exec }; diff --git a/usr.bin/tmux/cmd-show-messages.c b/usr.bin/tmux/cmd-show-messages.c index be64e8112f9..5ce98ef839d 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.18 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-show-messages.c,v 1.19 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -38,7 +38,9 @@ const struct cmd_entry cmd_show_messages_entry = { .args = { "JTt:", 0, 0 }, .usage = "[-JT] " CMD_TARGET_CLIENT_USAGE, - .flags = CMD_CLIENT_T, + .tflag = CMD_CLIENT, + + .flags = 0, .exec = cmd_show_messages_exec }; diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c index 5ff9455b523..64ea8ac5e1a 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.28 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-show-options.c,v 1.29 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -41,7 +41,9 @@ const struct cmd_entry cmd_show_options_entry = { .args = { "gqst:vw", 0, 1 }, .usage = "[-gqsvw] [-t target-session|target-window] [option]", - .flags = CMD_WINDOW_T|CMD_CANFAIL, + .tflag = CMD_WINDOW_CANFAIL, + + .flags = 0, .exec = cmd_show_options_exec }; @@ -52,7 +54,9 @@ const struct cmd_entry cmd_show_window_options_entry = { .args = { "gvt:", 0, 1 }, .usage = "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]", - .flags = CMD_WINDOW_T|CMD_CANFAIL, + .tflag = CMD_WINDOW_CANFAIL, + + .flags = 0, .exec = cmd_show_options_exec }; diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c index 77396b8e75a..8ea11595989 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.66 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-split-window.c,v 1.67 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -43,7 +43,9 @@ const struct cmd_entry cmd_split_window_entry = { .usage = "[-bdhvP] [-c start-directory] [-F format] " "[-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]", - .flags = CMD_PANE_T, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_split_window_exec }; diff --git a/usr.bin/tmux/cmd-swap-pane.c b/usr.bin/tmux/cmd-swap-pane.c index 6c621166767..3ef973f54a1 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.23 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-swap-pane.c,v 1.24 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -35,14 +35,16 @@ const struct cmd_entry cmd_swap_pane_entry = { .args = { "dDs:t:U", 0, 0 }, .usage = "[-dDU] " CMD_SRCDST_PANE_USAGE, - .flags = CMD_PANE_MARKED_S|CMD_PANE_T, + .sflag = CMD_PANE_MARKED, + .tflag = CMD_PANE, + + .flags = 0, .exec = cmd_swap_pane_exec }; enum cmd_retval cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) { - struct args *args = self->args; struct winlink *src_wl, *dst_wl; struct window *src_w, *dst_w; struct window_pane *tmp_wp, *src_wp, *dst_wp; @@ -52,22 +54,23 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) dst_wl = cmdq->state.tflag.wl; dst_w = dst_wl->window; dst_wp = cmdq->state.tflag.wp; - src_wp = cmdq->state.sflag.wp; src_wl = cmdq->state.sflag.wl; src_w = src_wl->window; + src_wp = cmdq->state.sflag.wp; server_unzoom_window(dst_w); - if (!args_has(args, 's')) { + if (args_has(self->args, 'D')) { + src_wl = dst_wl; src_w = dst_w; - if (args_has(self->args, 'D')) { - src_wp = TAILQ_NEXT(dst_wp, entry); - if (src_wp == NULL) - src_wp = TAILQ_FIRST(&dst_w->panes); - } else if (args_has(self->args, 'U')) { - src_wp = TAILQ_PREV(dst_wp, window_panes, entry); - if (src_wp == NULL) - src_wp = TAILQ_LAST(&dst_w->panes, window_panes); - } + src_wp = TAILQ_NEXT(dst_wp, entry); + if (src_wp == NULL) + src_wp = TAILQ_FIRST(&dst_w->panes); + } else if (args_has(self->args, 'U')) { + src_wl = dst_wl; + src_w = dst_w; + src_wp = TAILQ_PREV(dst_wp, window_panes, entry); + if (src_wp == NULL) + src_wp = TAILQ_LAST(&dst_w->panes, window_panes); } server_unzoom_window(src_w); diff --git a/usr.bin/tmux/cmd-swap-window.c b/usr.bin/tmux/cmd-swap-window.c index 93d114f9aff..9c28b6bceb0 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.14 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-swap-window.c,v 1.15 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -35,7 +35,10 @@ const struct cmd_entry cmd_swap_window_entry = { .args = { "ds:t:", 0, 0 }, .usage = "[-d] " CMD_SRCDST_WINDOW_USAGE, - .flags = CMD_WINDOW_MARKED_S|CMD_WINDOW_MARKED_T, + .sflag = CMD_WINDOW_MARKED, + .tflag = CMD_WINDOW, + + .flags = 0, .exec = cmd_swap_window_exec }; diff --git a/usr.bin/tmux/cmd-switch-client.c b/usr.bin/tmux/cmd-switch-client.c index f68502cdf7b..d9264b11e12 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.39 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd-switch-client.c,v 1.40 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -37,8 +37,10 @@ const struct cmd_entry cmd_switch_client_entry = { .usage = "[-Elnpr] [-c target-client] [-t target-session] " "[-T key-table]", - .flags = CMD_READONLY|CMD_CLIENT_C|CMD_PANE_T|CMD_SESSION_T| - CMD_PREFERUNATTACHED, + .cflag = CMD_CLIENT, + .tflag = CMD_SESSION_WITHPANE, + + .flags = CMD_READONLY, .exec = cmd_switch_client_exec }; diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index 47b0c209725..6ada1b7b3dd 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.117 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.118 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -207,10 +207,6 @@ const struct cmd_entry *cmd_table[] = { NULL }; -static void cmd_clear_state(struct cmd_state *); -static struct client *cmd_get_state_client(struct cmd_q *, int); -static int cmd_set_state_flag(struct cmd *, struct cmd_q *, char); - int cmd_pack_argv(int argc, char **argv, char *buf, size_t len) { @@ -409,252 +405,131 @@ cmd_clear_state(struct cmd_state *state) } static int -cmd_set_state_flag(struct cmd *cmd, struct cmd_q *cmdq, char c) +cmd_prepare_state_flag(struct cmd_find_state *fs, enum cmd_entry_flag flag, + const char *target, struct cmd_q *cmdq) { - struct cmd_state *state = &cmdq->state; - struct cmd_find_state *fsf = NULL; - const char *flag; - int flags = cmd->entry->flags, everything = 0; - int allflags = 0, targetflags, error; - struct session *s; - struct window *w; - struct winlink *wl; - struct window_pane *wp; - - /* Set up state for either -t or -s. */ - if (c == 't') { - fsf = &cmdq->state.tflag; - allflags = CMD_ALL_T; - } else if (c == 's') { - fsf = &cmdq->state.sflag; - allflags = CMD_ALL_S; - } + int targetflags, error; - /* - * If the command wants something and no argument is present, use the - * base command instead. - */ - flag = args_get(cmd->args, c); - if (flag == NULL) { - if ((flags & allflags) == 0) - return (0); /* doesn't care about flag */ - cmd = cmdq->cmd; - everything = 1; - flag = args_get(cmd->args, c); + if (flag == CMD_SESSION_WITHPANE) { + if (target != NULL && target[strcspn(target, ":.")] != '\0') + flag = CMD_PANE; + else + flag = CMD_SESSION; } - /* - * If no flag and the current command is allowed to fail, just skip to - * fill in as much we can, otherwise continue and fail later if needed. - */ - if (flag == NULL && (flags & CMD_CANFAIL)) - goto complete_everything; - - /* Fill in state using command (current or base) flags. */ - if (flags & CMD_PREFERUNATTACHED) - targetflags = CMD_FIND_PREFER_UNATTACHED; - else + switch (flag) { + case CMD_NONE: + case CMD_CLIENT: + case CMD_CLIENT_CANFAIL: + return (0); + case CMD_SESSION: + case CMD_SESSION_CANFAIL: + case CMD_SESSION_PREFERUNATTACHED: + case CMD_SESSION_WITHPANE: targetflags = 0; - switch (cmd->entry->flags & allflags) { - case 0: - break; - case CMD_SESSION_T|CMD_PANE_T: - case CMD_SESSION_S|CMD_PANE_S: - if (flag != NULL && flag[strcspn(flag, ":.")] != '\0') { - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_PANE, - targetflags); - if (error != 0) - return (-1); - } else { - error = cmd_find_target(fsf, cmdq, flag, - CMD_FIND_SESSION, targetflags); - if (error != 0) - return (-1); - - if (flag == NULL) { - fsf->wl = fsf->s->curw; - fsf->wp = fsf->s->curw->window->active; - } else { - s = fsf->s; - if ((w = window_find_by_id_str(flag)) != NULL) - wp = w->active; - else { - wp = window_pane_find_by_id_str(flag); - if (wp != NULL) - w = wp->window; - } - wl = winlink_find_by_window(&s->windows, w); - if (wl != NULL) { - fsf->wl = wl; - fsf->wp = wp; - } - } - } - break; - case CMD_MOVEW_R|CMD_INDEX_T: - case CMD_MOVEW_R|CMD_INDEX_S: - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_SESSION, - targetflags|CMD_FIND_QUIET); - if (error != 0) { - error = cmd_find_target(fsf, cmdq, flag, - CMD_FIND_WINDOW, CMD_FIND_WINDOW_INDEX); - if (error != 0) - return (-1); - } - break; - case CMD_SESSION_T: - case CMD_SESSION_S: - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_SESSION, + if (flag == CMD_SESSION_CANFAIL) + targetflags |= CMD_FIND_QUIET; + if (flag == CMD_SESSION_PREFERUNATTACHED) + targetflags |= CMD_FIND_PREFER_UNATTACHED; + + error = cmd_find_target(fs, cmdq, target, CMD_FIND_SESSION, targetflags); - if (error != 0) + if (error != 0 && flag != CMD_SESSION_CANFAIL) return (-1); break; - case CMD_WINDOW_MARKED_T: - case CMD_WINDOW_MARKED_S: - targetflags |= CMD_FIND_DEFAULT_MARKED; + case CMD_MOVEW_R: + error = cmd_find_target(fs, cmdq, target, CMD_FIND_SESSION, + CMD_FIND_QUIET); + if (error == 0) + break; + flag = CMD_WINDOW_INDEX; /* FALLTHROUGH */ - case CMD_WINDOW_T: - case CMD_WINDOW_S: - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_WINDOW, + case CMD_WINDOW: + case CMD_WINDOW_CANFAIL: + case CMD_WINDOW_MARKED: + case CMD_WINDOW_INDEX: + targetflags = 0; + if (flag == CMD_WINDOW_CANFAIL) + targetflags |= CMD_FIND_QUIET; + if (flag == CMD_WINDOW_MARKED) + targetflags |= CMD_FIND_DEFAULT_MARKED; + if (flag == CMD_WINDOW_INDEX) + targetflags |= CMD_FIND_WINDOW_INDEX; + + error = cmd_find_target(fs, cmdq, target, CMD_FIND_WINDOW, targetflags); - if (error != 0) + if (error != 0 && flag != CMD_WINDOW_CANFAIL) return (-1); break; - case CMD_PANE_MARKED_T: - case CMD_PANE_MARKED_S: - targetflags |= CMD_FIND_DEFAULT_MARKED; - /* FALLTHROUGH */ - case CMD_PANE_T: - case CMD_PANE_S: - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_PANE, + case CMD_PANE: + case CMD_PANE_CANFAIL: + case CMD_PANE_MARKED: + targetflags = 0; + if (flag == CMD_PANE_CANFAIL) + targetflags |= CMD_FIND_QUIET; + if (flag == CMD_PANE_MARKED) + targetflags |= CMD_FIND_DEFAULT_MARKED; + + error = cmd_find_target(fs, cmdq, target, CMD_FIND_PANE, targetflags); - if (error != 0) - return (-1); - break; - case CMD_INDEX_T: - case CMD_INDEX_S: - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_WINDOW, - CMD_FIND_WINDOW_INDEX); - if (error != 0) + if (error != 0 && flag != CMD_PANE_CANFAIL) return (-1); break; - default: - fatalx("too many -%c for %s", c, cmd->entry->name); - } - - /* - * If this is still the current command, it wants what it asked for and - * nothing more. If it's the base command, fill in as much as possible - * because the current command may have different flags. - */ - if (!everything) - return (0); - -complete_everything: - if (fsf->s == NULL) { - if (state->c != NULL) - fsf->s = state->c->session; - if (fsf->s == NULL) { - error = cmd_find_target(fsf, cmdq, NULL, - CMD_FIND_SESSION, CMD_FIND_QUIET); - if (error != 0) - fsf->s = NULL; - } - if (fsf->s == NULL) { - if (flags & CMD_CANFAIL) - return (0); - cmdq_error(cmdq, "no current session"); - return (-1); - } - } - if (fsf->wl == NULL) { - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_WINDOW, 0); - if (error != 0) - return (-1); - } - if (fsf->wp == NULL) { - error = cmd_find_target(fsf, cmdq, flag, CMD_FIND_PANE, 0); - if (error != 0) - return (-1); } return (0); } -static struct client * -cmd_get_state_client(struct cmd_q *cmdq, int quiet) -{ - struct cmd *cmd = cmdq->cmd; - struct args *args = cmd->args; - - switch (cmd->entry->flags & (CMD_CLIENT_C|CMD_CLIENT_T)) { - case 0: - return (cmd_find_client(cmdq, NULL, 1)); - case CMD_CLIENT_C: - return (cmd_find_client(cmdq, args_get(args, 'c'), quiet)); - case CMD_CLIENT_T: - return (cmd_find_client(cmdq, args_get(args, 't'), quiet)); - default: - fatalx("both -t and -c for %s", cmd->entry->name); - } -} - int cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq) { - struct cmd_state *state = &cmdq->state; - struct args *args = cmd->args; - const char *cflag, *tflag; - char *tmp; - int error, quiet; + const struct cmd_entry *entry = cmd->entry; + struct cmd_state *state = &cmdq->state; + char *tmp; + enum cmd_entry_flag flag; + const char *s; + int error; tmp = cmd_print(cmd); - log_debug("preparing state for: %s (client %p)", tmp, cmdq->client); + log_debug("preparing state for %s (client %p)", tmp, cmdq->client); free(tmp); - /* Start with an empty state. */ cmd_clear_state(state); - /* No error messages if can fail. */ - quiet = 0; - if (cmd->entry->flags & CMD_CLIENT_CANFAIL) - quiet = 1; - - /* - * If the command wants a client and provides -c or -t, use it. If not, - * try the base command instead via cmd_get_state_client. No client is - * allowed if no flags, otherwise it must be available. - */ - switch (cmd->entry->flags & (CMD_CLIENT_C|CMD_CLIENT_T)) { - case 0: - state->c = cmd_get_state_client(cmdq, 1); - break; - case CMD_CLIENT_C: - cflag = args_get(args, 'c'); - if (cflag == NULL) - state->c = cmd_get_state_client(cmdq, quiet); - else - state->c = cmd_find_client(cmdq, cflag, quiet); - if (!quiet && state->c == NULL) - return (-1); - break; - case CMD_CLIENT_T: - tflag = args_get(args, 't'); - if (tflag == NULL) - state->c = cmd_get_state_client(cmdq, 0); + flag = cmd->entry->cflag; + if (flag == CMD_NONE) { + flag = cmd->entry->tflag; + if (flag == CMD_CLIENT || flag == CMD_CLIENT_CANFAIL) + s = args_get(cmd->args, 't'); else - state->c = cmd_find_client(cmdq, tflag, 0); - state->c = cmd_find_client(cmdq, args_get(args, 't'), quiet); - if (!quiet && state->c == NULL) + s = NULL; + } else + s = args_get(cmd->args, 'c'); + switch (flag) { + case CMD_CLIENT: + state->c = cmd_find_client(cmdq, s, 0); + if (state->c == NULL) return (-1); break; default: - fatalx("both -c and -t for %s", cmd->entry->name); + state->c = cmd_find_client(cmdq, s, 1); + break; } - error = cmd_set_state_flag(cmd, cmdq, 't'); - if (error == 0) - error = cmd_set_state_flag(cmd, cmdq, 's'); - return (error); + s = args_get(cmd->args, 't'); + log_debug("preparing -t state: target %s", s == NULL ? "none" : s); + + error = cmd_prepare_state_flag(&state->tflag, entry->tflag, s, cmdq); + if (error != 0) + return (error); + + s = args_get(cmd->args, 's'); + log_debug("preparing -s state: target %s", s == NULL ? "none" : s); + + error = cmd_prepare_state_flag(&state->sflag, entry->sflag, s, cmdq); + if (error != 0) + return (error); + + return (0); } char * diff --git a/usr.bin/tmux/log.c b/usr.bin/tmux/log.c index 4e1a25df012..c712133c9ae 100644 --- a/usr.bin/tmux/log.c +++ b/usr.bin/tmux/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.20 2015/11/24 21:19:46 nicm Exp $ */ +/* $OpenBSD: log.c,v 1.21 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -144,6 +144,7 @@ fatalx(const char *msg, ...) char *fmt; va_list ap; + abort(); va_start(ap, msg); if (asprintf(&fmt, "fatal: %s", msg) == -1) exit(1); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 01c9a661e37..f0c029b2c1e 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.608 2015/12/13 21:53:57 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.609 2015/12/14 00:31:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1387,6 +1387,30 @@ struct cmd_q { TAILQ_ENTRY(cmd_q) waitentry; }; +/* Command -c, -t or -s flags. */ +enum cmd_entry_flag { + CMD_NONE, + + CMD_CLIENT, + CMD_CLIENT_CANFAIL, + + CMD_SESSION, + CMD_SESSION_CANFAIL, + CMD_SESSION_PREFERUNATTACHED, + CMD_SESSION_WITHPANE, + + CMD_WINDOW, + CMD_WINDOW_CANFAIL, + CMD_WINDOW_MARKED, + CMD_WINDOW_INDEX, + + CMD_PANE, + CMD_PANE_CANFAIL, + CMD_PANE_MARKED, + + CMD_MOVEW_R, +}; + /* Command definition. */ struct cmd_entry { const char *name; @@ -1397,37 +1421,18 @@ struct cmd_entry { int lower; int upper; } args; - const char *usage; + enum cmd_entry_flag tflag; + enum cmd_entry_flag sflag; + enum cmd_entry_flag cflag; + #define CMD_STARTSERVER 0x1 #define CMD_READONLY 0x2 -#define CMD_SESSION_T 0x4 -#define CMD_SESSION_S 0x8 -#define CMD_WINDOW_T 0x10 -#define CMD_WINDOW_S 0x20 -#define CMD_PANE_T 0x40 -#define CMD_PANE_S 0x80 -#define CMD_CLIENT_T 0x100 -#define CMD_CLIENT_C 0x200 -#define CMD_INDEX_T 0x400 -#define CMD_INDEX_S 0x800 -#define CMD_CANFAIL 0x1000 -#define CMD_PREFERUNATTACHED 0x2000 -#define CMD_MOVEW_R 0x4000 /* for movew -r only */ -#define CMD_PANE_MARKED_S 0x8000 -#define CMD_PANE_MARKED_T 0x10000 -#define CMD_WINDOW_MARKED_T 0x20000 -#define CMD_WINDOW_MARKED_S 0x40000 -#define CMD_CLIENT_CANFAIL 0x80000 - int flags; + int flags; enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); }; -#define CMD_ALL_T (CMD_SESSION_T|CMD_WINDOW_T|CMD_PANE_T|CMD_INDEX_T| \ - CMD_MOVEW_R|CMD_PANE_MARKED_T|CMD_WINDOW_MARKED_T) -#define CMD_ALL_S (CMD_SESSION_S|CMD_WINDOW_S|CMD_PANE_S|CMD_INDEX_S| \ - CMD_PANE_MARKED_S|CMD_WINDOW_MARKED_S) /* Key binding and key table. */ struct key_binding { -- cgit v1.2.3