=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-detach-client.c,v retrieving revision 1.23 retrieving revision 1.24 diff -c -r1.23 -r1.24 *** src/usr.bin/tmux/cmd-detach-client.c 2015/12/08 01:10:31 1.23 --- src/usr.bin/tmux/cmd-detach-client.c 2015/12/13 14:32:38 1.24 *************** *** 1,4 **** ! /* $OpenBSD: cmd-detach-client.c,v 1.23 2015/12/08 01:10:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-detach-client.c,v 1.24 2015/12/13 14:32:38 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 31,38 **** const struct cmd_entry cmd_detach_client_entry = { "detach-client", "detach", "as:t:P", 0, 0, ! "[-aP] [-s target-session] " CMD_TARGET_CLIENT_USAGE, ! CMD_READONLY, cmd_detach_client_exec }; --- 31,38 ---- const struct cmd_entry cmd_detach_client_entry = { "detach-client", "detach", "as:t:P", 0, 0, ! "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, ! CMD_READONLY|CMD_CLIENT_T|CMD_SESSION_S, cmd_detach_client_exec }; *************** *** 40,46 **** "suspend-client", "suspendc", "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, ! 0, cmd_detach_client_exec }; --- 40,46 ---- "suspend-client", "suspendc", "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, ! CMD_CLIENT_T, cmd_detach_client_exec }; *************** *** 48,60 **** cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; ! struct client *c, *cloop; struct session *s; enum msgtype msgtype; if (self->entry == &cmd_suspend_client_entry) { - if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) - return (CMD_RETURN_ERROR); tty_stop_tty(&c->tty); c->flags |= CLIENT_SUSPENDED; proc_send(c->peer, MSG_SUSPEND, -1, NULL, 0); --- 48,58 ---- cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; ! struct client *c = cmdq->state.c, *cloop; struct session *s; enum msgtype msgtype; if (self->entry == &cmd_suspend_client_entry) { tty_stop_tty(&c->tty); c->flags |= CLIENT_SUSPENDED; proc_send(c->peer, MSG_SUSPEND, -1, NULL, 0); *************** *** 67,86 **** msgtype = MSG_DETACH; if (args_has(args, 's')) { ! s = cmd_find_session(cmdq, args_get(args, 's'), 0); ! if (s == NULL) ! return (CMD_RETURN_ERROR); ! TAILQ_FOREACH(cloop, &clients, entry) { if (cloop->session == s) server_client_detach(cloop, msgtype); } return (CMD_RETURN_STOP); } - - c = cmd_find_client(cmdq, args_get(args, 't'), 0); - if (c == NULL) - return (CMD_RETURN_ERROR); if (args_has(args, 'a')) { TAILQ_FOREACH(cloop, &clients, entry) { --- 65,77 ---- msgtype = MSG_DETACH; if (args_has(args, 's')) { ! s = cmdq->state.sflag.s; TAILQ_FOREACH(cloop, &clients, entry) { if (cloop->session == s) server_client_detach(cloop, msgtype); } return (CMD_RETURN_STOP); } if (args_has(args, 'a')) { TAILQ_FOREACH(cloop, &clients, entry) {