diff options
author | Tiago Cunha <tcunha@gmx.com> | 2012-06-18 15:11:35 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2012-06-18 15:11:35 +0000 |
commit | 4a634a7da4b0e6e8fd66a650bd71f86d3b060c52 (patch) | |
tree | 553f94753f334fa8d6fb9e7d9a92ba496895ffa0 /cmd-detach-client.c | |
parent | 576f2694b1d35e677b09071ba8f27f6b12236bbc (diff) |
Sync OpenBSD patchset 1133:
Add -a flag for detach-client, from Thomas Adam.
Diffstat (limited to 'cmd-detach-client.c')
-rw-r--r-- | cmd-detach-client.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cmd-detach-client.c b/cmd-detach-client.c index d1010a5b..ed38f53d 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -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); |