version 1.29, 2016/10/14 22:14:22 |
version 1.30, 2016/10/16 19:04:05 |
|
|
"[#{client_width}x#{client_height} #{client_termname}]" \ |
"[#{client_width}x#{client_height} #{client_termname}]" \ |
"#{?client_utf8, (utf8),} #{?client_readonly, (ro),}" |
"#{?client_utf8, (utf8),} #{?client_readonly, (ro),}" |
|
|
static enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmd_q *); |
static enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmdq_item *); |
|
|
const struct cmd_entry cmd_list_clients_entry = { |
const struct cmd_entry cmd_list_clients_entry = { |
.name = "list-clients", |
.name = "list-clients", |
|
|
}; |
}; |
|
|
static enum cmd_retval |
static enum cmd_retval |
cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq) |
cmd_list_clients_exec(struct cmd *self, struct cmdq_item *item) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct client *c; |
struct client *c; |
|
|
char *line; |
char *line; |
|
|
if (args_has(args, 't')) |
if (args_has(args, 't')) |
s = cmdq->state.tflag.s; |
s = item->state.tflag.s; |
else |
else |
s = NULL; |
s = NULL; |
|
|
|
|
if (c->session == NULL || (s != NULL && s != c->session)) |
if (c->session == NULL || (s != NULL && s != c->session)) |
continue; |
continue; |
|
|
ft = format_create(cmdq, 0); |
ft = format_create(item, 0); |
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); |
line = format_expand(ft, template); |
cmdq_print(cmdq, "%s", line); |
cmdq_print(item, "%s", line); |
free(line); |
free(line); |
|
|
format_free(ft); |
format_free(ft); |