=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-list-clients.c,v retrieving revision 1.20 retrieving revision 1.21 diff -c -r1.20 -r1.21 *** src/usr.bin/tmux/cmd-list-clients.c 2015/02/05 10:29:43 1.20 --- src/usr.bin/tmux/cmd-list-clients.c 2015/04/24 23:17:11 1.21 *************** *** 1,4 **** ! /* $OpenBSD: cmd-list-clients.c,v 1.20 2015/02/05 10:29:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-list-clients.c,v 1.21 2015/04/24 23:17:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 51,57 **** struct session *s; struct format_tree *ft; const char *template; ! u_int i; char *line; if (args_has(args, 't')) { --- 51,57 ---- struct session *s; struct format_tree *ft; const char *template; ! u_int idx; char *line; if (args_has(args, 't')) { *************** *** 64,79 **** if ((template = args_get(args, 'F')) == NULL) template = LIST_CLIENTS_TEMPLATE; ! for (i = 0; i < ARRAY_LENGTH(&clients); i++) { ! c = ARRAY_ITEM(&clients, i); ! if (c == NULL || c->session == NULL) continue; - if (s != NULL && s != c->session) - continue; - ft = format_create(); ! format_add(ft, "line", "%u", i); format_defaults(ft, c, NULL, NULL, NULL); line = format_expand(ft, template); --- 64,76 ---- if ((template = args_get(args, 'F')) == NULL) template = LIST_CLIENTS_TEMPLATE; ! idx = 0; ! TAILQ_FOREACH(c, &clients, entry) { ! if (c->session == NULL || (s != NULL && s != c->session)) continue; ft = format_create(); ! format_add(ft, "line", "%u", idx); format_defaults(ft, c, NULL, NULL, NULL); line = format_expand(ft, template); *************** *** 81,86 **** --- 78,85 ---- free(line); format_free(ft); + + idx++; } return (CMD_RETURN_NORMAL);