Update of /cvsroot/tmux/tmux
In directory vz-cvs-2.sog:/tmp/cvs-serv27705

Modified Files:
        cmd-detach-client.c tmux.1 
Log Message:
Add -s option to detach all clients attached to a session, from Zac
Sprackett.



Index: cmd-detach-client.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-detach-client.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cmd-detach-client.c 19 Mar 2011 23:27:35 -0000      1.13
+++ cmd-detach-client.c 11 Apr 2011 06:44:56 -0000      1.14
@@ -28,7 +28,7 @@
 
 const struct cmd_entry cmd_detach_client_entry = {
        "detach-client", "detach",
-       "t:P", 0, 0,
+       "s:t:P", 0, 0,
        "[-P] " CMD_TARGET_CLIENT_USAGE,
        CMD_READONLY,
        NULL,
@@ -41,14 +41,32 @@
 {
        struct args     *args = self->args;
        struct client   *c;
-
-       if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL)
-               return (-1);
+       struct session  *s;
+       enum msgtype     msgtype;
+       u_int            i;
 
        if (args_has(args, 'P'))
-               server_write_client(c, MSG_DETACHKILL, NULL, 0);
+               msgtype = MSG_DETACHKILL;
        else
-               server_write_client(c, MSG_DETACH, NULL, 0);
+               msgtype = MSG_DETACH;
+
+       if (args_has(args, 's')) {
+               s = cmd_find_session(ctx, args_get(args, 's'), 0);
+               if (s == NULL)
+                       return (-1);
+
+               for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+                       c = ARRAY_ITEM(&clients, i);
+                       if (c != NULL && c->session == s)
+                               server_write_client(c, msgtype, NULL, 0);
+               }
+       } else {
+               c = cmd_find_client(ctx, args_get(args, 't'));
+               if (c == NULL)
+                       return (-1);
+
+               server_write_client(c, msgtype, NULL, 0);
+       }
 
        return (0);
 }

Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.303
retrieving revision 1.304
diff -u -d -r1.303 -r1.304
--- tmux.1      6 Apr 2011 22:31:23 -0000       1.303
+++ tmux.1      11 Apr 2011 06:44:56 -0000      1.304
@@ -580,10 +580,13 @@
 .It Xo Ic detach-client
 .Op Fl P
 .Op Fl t Ar target-client
+.Op Fl s Ar target-session
 .Xc
 .D1 (alias: Ic detach )
-Detach the current client if bound to a key, or the specified client with
-.Fl t .
+Detach the current client if bound to a key, the client specified with
+.Fl t ,
+or all clients currently attached to to the session specified by
+.Fl s .
 If
 .Fl P
 is given, send SIGHUP to the parent process of the client, typically causing it


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to