diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-06-18 09:15:23 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2012-06-18 09:15:23 +0000 |
commit | a55551ee77ba8886986b9266b927c77a1631b957 (patch) | |
tree | 2acf5fd027b952ca0d826db23fd0e5ac382e9395 /usr.bin/tmux | |
parent | 0ec83015319ee73bec2ea24d2fbfa2080639f8fe (diff) |
Add -a flag for detach-client, from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-detach-client.c | 18 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 7 |
2 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-detach-client.c b/usr.bin/tmux/cmd-detach-client.c index d305578380a..f410acdd038 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.9 2011/04/11 16:44:36 nicm Exp $ */ +/* $OpenBSD: cmd-detach-client.c,v 1.10 2012/06/18 09:15:22 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -28,8 +28,8 @@ int cmd_detach_client_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_detach_client_entry = { "detach-client", "detach", - "s:t:P", 0, 0, - "[-P] [-s target-session] " CMD_TARGET_CLIENT_USAGE, + "as:t:P", 0, 0, + "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, CMD_READONLY, NULL, NULL, @@ -40,7 +40,7 @@ int cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; - struct client *c; + struct client *c, *c2; struct session *s; enum msgtype msgtype; u_int i; @@ -65,7 +65,15 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx) if (c == NULL) return (-1); - server_write_client(c, msgtype, NULL, 0); + if (args_has(args, 'a')) { + for (i = 0; i < ARRAY_LENGTH(&clients); i++) { + c2 = ARRAY_ITEM(&clients, i); + if (c2 == NULL || c == c2) + continue; + server_write_client(c2, msgtype, NULL, 0); + } + } else + server_write_client(c, msgtype, NULL, 0); } return (0); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index bc2905195bc..a61380c884e 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.295 2012/06/18 09:13:12 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.296 2012/06/18 09:15:22 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -585,6 +585,7 @@ recently used session. .It Xo Ic detach-client .Op Fl P +.Op Fl a .Op Fl s Ar target-session .Op Fl t Ar target-client .Xc @@ -593,6 +594,10 @@ Detach the current client if bound to a key, the client specified with .Fl t , or all clients currently attached to the session specified by .Fl s . +The +.Fl a +option kills all but the client given with +.Fl t . If .Fl P is given, send SIGHUP to the parent process of the client, typically causing it |