[BACK]Return to server-fn.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/server-fn.c between version 1.38 and 1.39

version 1.38, 2010/06/26 23:55:50 version 1.39, 2010/06/27 00:22:22
Line 24 
Line 24 
   
 #include "tmux.h"  #include "tmux.h"
   
 void    server_callback_identify(int, short, void *);  struct session *server_next_session(struct session *);
   void            server_callback_identify(int, short, void *);
   
 void  void
 server_fill_environ(struct session *s, struct environ *env)  server_fill_environ(struct session *s, struct environ *env)
Line 358 
Line 359 
         }          }
 }  }
   
   struct session *
   server_next_session(struct session *s)
   {
           struct session *s_loop, *s_out;
           u_int           i;
   
           s_out = NULL;
           for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
                   s_loop = ARRAY_ITEM(&sessions, i);
                   if (s_loop == s)
                           continue;
                   if (s_out == NULL ||
                       timercmp(&s_loop->activity_time, &s_out->activity_time, <))
                           s_out = s_loop;
           }
           return (s_out);
   }
   
 void  void
 server_destroy_session(struct session *s)  server_destroy_session(struct session *s)
 {  {
         struct client   *c;          struct client   *c;
           struct session  *s_new;
         u_int            i;          u_int            i;
   
           if (!options_get_number(&s->options, "detach-on-destroy"))
                   s_new = server_next_session(s);
           else
                   s_new = NULL;
   
         for (i = 0; i < ARRAY_LENGTH(&clients); i++) {          for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
                 c = ARRAY_ITEM(&clients, i);                  c = ARRAY_ITEM(&clients, i);
                 if (c == NULL || c->session != s)                  if (c == NULL || c->session != s)
                         continue;                          continue;
                 c->session = NULL;                  if (s_new == NULL) {
                 server_write_client(c, MSG_EXIT, NULL, 0);                          c->session = NULL;
                           server_write_client(c, MSG_EXIT, NULL, 0);
                   } else {
                           c->session = s_new;
                           server_redraw_client(c);
                   }
         }          }
         recalculate_sizes();          recalculate_sizes();
 }  }

Legend:
Removed from v.1.38  
changed lines
  Added in v.1.39