summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-kill-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-04-23 22:10:46 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-04-23 22:10:46 +0000
commit75a200f26f06a195834b0c7a1259b59141029e04 (patch)
tree0de42ed3708e255485cd0119d1c6ccf977b885ce /usr.bin/tmux/cmd-kill-window.c
parenta623e17d6a09e634b929517f5374f8bc5d643e0f (diff)
Add -a flag to kill-window, from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/cmd-kill-window.c')
-rw-r--r--usr.bin/tmux/cmd-kill-window.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-kill-window.c b/usr.bin/tmux/cmd-kill-window.c
index b67c609b19b..1648d462c51 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.8 2011/01/04 00:42:46 nicm Exp $ */
+/* $OpenBSD: cmd-kill-window.c,v 1.9 2012/04/23 22:10:45 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,8 +28,8 @@ int cmd_kill_window_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_window_entry = {
"kill-window", "killw",
- "t:", 0, 0,
- CMD_TARGET_WINDOW_USAGE,
+ "at:", 0, 0,
+ "[-a] " CMD_TARGET_WINDOW_USAGE,
0,
NULL,
NULL,
@@ -40,13 +40,19 @@ int
cmd_kill_window_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
- struct winlink *wl;
+ struct winlink *wl, *wl2;
if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
return (-1);
- server_kill_window(wl->window);
- recalculate_sizes();
+ if (args_has(args, 'a')) {
+ RB_FOREACH(wl2, winlinks, &ctx->curclient->session->windows) {
+ if (wl != wl2)
+ server_kill_window(wl2->window);
+ }
+ } else
+ server_kill_window(wl->window);
+ recalculate_sizes();
return (0);
}