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

Diff for /src/usr.bin/tmux/cmd-list-sessions.c between version 1.3 and 1.4

version 1.3, 2009/07/26 12:58:44 version 1.4, 2009/10/10 10:02:48
Line 42 
Line 42 
 int  int
 cmd_list_sessions_exec(unused struct cmd *self, struct cmd_ctx *ctx)  cmd_list_sessions_exec(unused struct cmd *self, struct cmd_ctx *ctx)
 {  {
         struct session  *s;          struct session          *s;
         char            *tim;          struct session_group    *sg;
         u_int            i;          char                    *tim, tmp[64];
         time_t           t;          u_int                    i, idx;
           time_t                   t;
   
         for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {          for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
                 s = ARRAY_ITEM(&sessions, i);                  s = ARRAY_ITEM(&sessions, i);
                 if (s == NULL)                  if (s == NULL)
                         continue;                          continue;
   
                   sg = session_group_find(s);
                   if (sg == NULL)
                           *tmp = '\0';
                   else {
                           idx = session_group_index(sg);
                           xsnprintf(tmp, sizeof tmp, " (group %u)", idx);
                   }
   
                 t = s->tv.tv_sec;                  t = s->tv.tv_sec;
                 tim = ctime(&t);                  tim = ctime(&t);
                 *strchr(tim, '\n') = '\0';                  *strchr(tim, '\n') = '\0';
   
                 ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s",                  ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s%s",
                     s->name, winlink_count(&s->windows), tim, s->sx, s->sy,                      s->name, winlink_count(&s->windows), tim, s->sx, s->sy,
                     s->flags & SESSION_UNATTACHED ? "" : " (attached)");                      tmp, s->flags & SESSION_UNATTACHED ? "" : " (attached)");
         }          }
   
         return (0);          return (0);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4