version 1.31, 2017/04/19 14:00:28 |
version 1.32, 2017/04/22 10:22:39 |
|
|
.usage = "[-aP] [-E shell-command] " |
.usage = "[-aP] [-E shell-command] " |
"[-s target-session] " CMD_TARGET_CLIENT_USAGE, |
"[-s target-session] " CMD_TARGET_CLIENT_USAGE, |
|
|
.sflag = CMD_SESSION, |
.source = { 's', CMD_FIND_SESSION, CMD_FIND_CANFAIL }, |
.tflag = CMD_CLIENT, |
|
|
|
.flags = CMD_READONLY, |
.flags = CMD_READONLY, |
.exec = cmd_detach_client_exec |
.exec = cmd_detach_client_exec |
|
|
.args = { "t:", 0, 0 }, |
.args = { "t:", 0, 0 }, |
.usage = CMD_TARGET_CLIENT_USAGE, |
.usage = CMD_TARGET_CLIENT_USAGE, |
|
|
.tflag = CMD_CLIENT, |
|
|
|
.flags = 0, |
.flags = 0, |
.exec = cmd_detach_client_exec |
.exec = cmd_detach_client_exec |
}; |
}; |
|
|
cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item) |
cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct client *c = item->state.c, *cloop; |
struct client *c, *cloop; |
struct session *s; |
struct session *s; |
enum msgtype msgtype; |
enum msgtype msgtype; |
const char *cmd = args_get(args, 'E'); |
const char *cmd = args_get(args, 'E'); |
|
|
|
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL) |
|
return (CMD_RETURN_ERROR); |
|
|
if (self->entry == &cmd_suspend_client_entry) { |
if (self->entry == &cmd_suspend_client_entry) { |
server_client_suspend(c); |
server_client_suspend(c); |
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
|
|
msgtype = MSG_DETACH; |
msgtype = MSG_DETACH; |
|
|
if (args_has(args, 's')) { |
if (args_has(args, 's')) { |
s = item->state.sflag.s; |
s = item->source.s; |
|
if (s == NULL) |
|
return (CMD_RETURN_NORMAL); |
TAILQ_FOREACH(cloop, &clients, entry) { |
TAILQ_FOREACH(cloop, &clients, entry) { |
if (cloop->session == s) { |
if (cloop->session == s) { |
if (cmd != NULL) |
if (cmd != NULL) |