=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-list-clients.c,v retrieving revision 1.39 retrieving revision 1.40 diff -c -r1.39 -r1.40 *** src/usr.bin/tmux/cmd-list-clients.c 2022/03/08 11:28:40 1.39 --- src/usr.bin/tmux/cmd-list-clients.c 2023/02/06 09:20:30 1.40 *************** *** 1,4 **** ! /* $OpenBSD: cmd-list-clients.c,v 1.39 2022/03/08 11:28:40 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-list-clients.c,v 1.40 2023/02/06 09:20:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 41,48 **** .name = "list-clients", .alias = "lsc", ! .args = { "F:t:", 0, 0, NULL }, ! .usage = "[-F format] " CMD_TARGET_SESSION_USAGE, .target = { 't', CMD_FIND_SESSION, 0 }, --- 41,48 ---- .name = "list-clients", .alias = "lsc", ! .args = { "F:f:t:", 0, 0, NULL }, ! .usage = "[-F format] [-f filter] " CMD_TARGET_SESSION_USAGE, .target = { 't', CMD_FIND_SESSION, 0 }, *************** *** 58,66 **** struct client *c; struct session *s; struct format_tree *ft; ! const char *template; u_int idx; ! char *line; if (args_has(args, 't')) s = target->s; --- 58,67 ---- struct client *c; struct session *s; struct format_tree *ft; ! const char *template, *filter; u_int idx; ! char *line, *expanded; ! int flag; if (args_has(args, 't')) s = target->s; *************** *** 69,74 **** --- 70,76 ---- if ((template = args_get(args, 'F')) == NULL) template = LIST_CLIENTS_TEMPLATE; + filter = args_get(args, 'f'); idx = 0; TAILQ_FOREACH(c, &clients, entry) { *************** *** 79,87 **** format_add(ft, "line", "%u", idx); format_defaults(ft, c, NULL, NULL, NULL); ! line = format_expand(ft, template); ! cmdq_print(item, "%s", line); ! free(line); format_free(ft); --- 81,97 ---- format_add(ft, "line", "%u", idx); format_defaults(ft, c, NULL, NULL, NULL); ! if (filter != NULL) { ! expanded = format_expand(ft, filter); ! 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);