version 1.9, 2011/04/11 16:44:36 |
version 1.10, 2012/06/18 09:15:22 |
|
|
|
|
const struct cmd_entry cmd_detach_client_entry = { |
const struct cmd_entry cmd_detach_client_entry = { |
"detach-client", "detach", |
"detach-client", "detach", |
"s:t:P", 0, 0, |
"as:t:P", 0, 0, |
"[-P] [-s target-session] " CMD_TARGET_CLIENT_USAGE, |
"[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, |
CMD_READONLY, |
CMD_READONLY, |
NULL, |
NULL, |
NULL, |
NULL, |
|
|
cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_detach_client_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct client *c; |
struct client *c, *c2; |
struct session *s; |
struct session *s; |
enum msgtype msgtype; |
enum msgtype msgtype; |
u_int i; |
u_int i; |
|
|
if (c == NULL) |
if (c == NULL) |
return (-1); |
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); |
return (0); |