summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-kill-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-06-18 09:16:16 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-06-18 09:16:16 +0000
commit35d75c80cd55e2f08ec65a3773447f6655c0c8bb (patch)
tree78db9cc427073d31c845f794887c133056de347f /usr.bin/tmux/cmd-kill-session.c
parenta55551ee77ba8886986b9266b927c77a1631b957 (diff)
Add -a for kill-session, from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/cmd-kill-session.c')
-rw-r--r--usr.bin/tmux/cmd-kill-session.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-kill-session.c b/usr.bin/tmux/cmd-kill-session.c
index a87ea910325..5897ecf0a66 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.9 2011/04/05 19:37:01 nicm Exp $ */
+/* $OpenBSD: cmd-kill-session.c,v 1.10 2012/06/18 09:16:15 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -31,8 +31,8 @@ int cmd_kill_session_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_kill_session_entry = {
"kill-session", NULL,
- "t:", 0, 0,
- CMD_TARGET_SESSION_USAGE,
+ "at:", 0, 0,
+ "[-a] " CMD_TARGET_SESSION_USAGE,
0,
NULL,
NULL,
@@ -43,13 +43,21 @@ int
cmd_kill_session_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
- struct session *s;
+ struct session *s, *s2, *s3;
if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL)
return (-1);
- server_destroy_session(s);
- session_destroy(s);
-
+ if (args_has(args, 'a')) {
+ RB_FOREACH_SAFE(s2, sessions, &sessions, s3) {
+ if (s != s2) {
+ server_destroy_session(s2);
+ session_destroy(s2);
+ }
+ }
+ } else {
+ server_destroy_session(s);
+ session_destroy(s);
+ }
return (0);
}