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

Diff for /src/usr.bin/tmux/cmd-list-clients.c between version 1.39 and 1.40

version 1.39, 2022/03/08 11:28:40 version 1.40, 2023/02/06 09:20:30
Line 41 
Line 41 
         .name = "list-clients",          .name = "list-clients",
         .alias = "lsc",          .alias = "lsc",
   
         .args = { "F:t:", 0, 0, NULL },          .args = { "F:f:t:", 0, 0, NULL },
         .usage = "[-F format] " CMD_TARGET_SESSION_USAGE,          .usage = "[-F format] [-f filter] " CMD_TARGET_SESSION_USAGE,
   
         .target = { 't', CMD_FIND_SESSION, 0 },          .target = { 't', CMD_FIND_SESSION, 0 },
   
Line 58 
Line 58 
         struct client           *c;          struct client           *c;
         struct session          *s;          struct session          *s;
         struct format_tree      *ft;          struct format_tree      *ft;
         const char              *template;          const char              *template, *filter;
         u_int                    idx;          u_int                    idx;
         char                    *line;          char                    *line, *expanded;
           int                      flag;
   
         if (args_has(args, 't'))          if (args_has(args, 't'))
                 s = target->s;                  s = target->s;
Line 69 
Line 70 
   
         if ((template = args_get(args, 'F')) == NULL)          if ((template = args_get(args, 'F')) == NULL)
                 template = LIST_CLIENTS_TEMPLATE;                  template = LIST_CLIENTS_TEMPLATE;
           filter = args_get(args, 'f');
   
         idx = 0;          idx = 0;
         TAILQ_FOREACH(c, &clients, entry) {          TAILQ_FOREACH(c, &clients, entry) {
Line 79 
Line 81 
                 format_add(ft, "line", "%u", idx);                  format_add(ft, "line", "%u", idx);
                 format_defaults(ft, c, NULL, NULL, NULL);                  format_defaults(ft, c, NULL, 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);
   

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