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

Diff for /src/usr.bin/tmux/cmd.c between version 1.100 and 1.101

version 1.100, 2015/04/21 22:42:27 version 1.101, 2015/04/24 23:17:11
Line 116 
Line 116 
         NULL          NULL
 };  };
   
   ARRAY_DECL(client_list, struct client *);
   
 int              cmd_session_better(struct session *, struct session *, int);  int              cmd_session_better(struct session *, struct session *, int);
 struct session  *cmd_choose_session_list(struct sessionslist *);  struct session  *cmd_choose_session_list(struct sessionslist *);
 struct session  *cmd_choose_session(int);  struct session  *cmd_choose_session(int);
 struct client   *cmd_choose_client(struct clients *);  struct client   *cmd_choose_client(struct client_list *);
 struct client   *cmd_lookup_client(const char *);  struct client   *cmd_lookup_client(const char *);
 struct session  *cmd_lookup_session(struct cmd_q *, const char *, int *);  struct session  *cmd_lookup_session(struct cmd_q *, const char *, int *);
 struct session  *cmd_lookup_session_id(const char *);  struct session  *cmd_lookup_session_id(const char *);
Line 452 
Line 454 
 {  {
         struct session          *s;          struct session          *s;
         struct client           *c;          struct client           *c;
         struct clients           cc;          struct client_list       cc;
         u_int                    i;  
   
         if (cmdq->client != NULL && cmdq->client->session != NULL)          if (cmdq->client != NULL && cmdq->client->session != NULL)
                 return (cmdq->client);                  return (cmdq->client);
Line 465 
Line 466 
         s = cmd_current_session(cmdq, 0);          s = cmd_current_session(cmdq, 0);
         if (s != NULL && !(s->flags & SESSION_UNATTACHED)) {          if (s != NULL && !(s->flags & SESSION_UNATTACHED)) {
                 ARRAY_INIT(&cc);                  ARRAY_INIT(&cc);
                 for (i = 0; i < ARRAY_LENGTH(&clients); i++) {                  TAILQ_FOREACH(c, &clients, entry) {
                         if ((c = ARRAY_ITEM(&clients, i)) == NULL)  
                                 continue;  
                         if (s == c->session)                          if (s == c->session)
                                 ARRAY_ADD(&cc, c);                                  ARRAY_ADD(&cc, c);
                 }                  }
Line 478 
Line 477 
                         return (c);                          return (c);
         }          }
   
         return (cmd_choose_client(&clients));          ARRAY_INIT(&cc);
           TAILQ_FOREACH(c, &clients, entry)
                   ARRAY_ADD(&cc, c);
           c = cmd_choose_client(&cc);
           ARRAY_FREE(&cc);
           return (c);
 }  }
   
 /* Choose the most recently used client from a list. */  /* Choose the most recently used client from a list. */
 struct client *  struct client *
 cmd_choose_client(struct clients *cc)  cmd_choose_client(struct client_list *cc)
 {  {
         struct client   *c, *cbest;          struct client   *c, *cbest;
         struct timeval  *tv = NULL;          struct timeval  *tv = NULL;
Line 615 
Line 619 
 {  {
         struct client   *c;          struct client   *c;
         const char      *path;          const char      *path;
         u_int            i;  
   
         for (i = 0; i < ARRAY_LENGTH(&clients); i++) {          TAILQ_FOREACH(c, &clients, entry) {
                 c = ARRAY_ITEM(&clients, i);                  if (c->session == NULL || c->tty.path == NULL)
                 if (c == NULL || c->session == NULL || c->tty.path == NULL)  
                         continue;                          continue;
                 path = c->tty.path;                  path = c->tty.path;
   

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.101