[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.30 and 1.31

version 1.30, 2018/10/18 08:38:01 version 1.31, 2020/04/12 08:36:18
Line 42 
Line 42 
         .name = "list-sessions",          .name = "list-sessions",
         .alias = "ls",          .alias = "ls",
   
         .args = { "F:", 0, 0 },          .args = { "F:f:", 0, 0 },
         .usage = "[-F format]",          .usage = "[-F format] [-f filter]",
   
         .flags = CMD_AFTERHOOK,          .flags = CMD_AFTERHOOK,
         .exec = cmd_list_sessions_exec          .exec = cmd_list_sessions_exec
Line 56 
Line 56 
         struct session          *s;          struct session          *s;
         u_int                    n;          u_int                    n;
         struct format_tree      *ft;          struct format_tree      *ft;
         const char              *template;          const char              *template, *filter;
         char                    *line;          char                    *line, *expanded;
           int                      flag;
   
         if ((template = args_get(args, 'F')) == NULL)          if ((template = args_get(args, 'F')) == NULL)
                 template = LIST_SESSIONS_TEMPLATE;                  template = LIST_SESSIONS_TEMPLATE;
           filter = args_get(args, 'f');
   
         n = 0;          n = 0;
         RB_FOREACH(s, sessions, &sessions) {          RB_FOREACH(s, sessions, &sessions) {
Line 68 
Line 70 
                 format_add(ft, "line", "%u", n);                  format_add(ft, "line", "%u", n);
                 format_defaults(ft, NULL, s, NULL, NULL);                  format_defaults(ft, NULL, s, NULL, NULL);
   
                 line = format_expand(ft, template);                  if (filter != NULL) {
                 cmdq_print(item, "%s", line);                          expanded = format_expand(ft, filter);
                 free(line);                          flag = format_true(expanded);
                           free(expanded);
                   } else
                           flag = 1;
                   if (flag) {
                           line = format_expand(ft, template);
                           cmdq_print(item, "%s", line);
                           free(line);
                   }
   
                 format_free(ft);                  format_free(ft);
                 n++;                  n++;

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31