summaryrefslogtreecommitdiffstats
path: root/cmd-server-info.c
authortcunha <tcunha>2010-12-22 15:36:44 (GMT)
committer tcunha <tcunha>2010-12-22 15:36:44 (GMT)
commit6d8b0cf7022a818fadff9dddbb6fbcc6b65deada (patch) (side-by-side diff)
treec1111e0330a6e79afc634e1834631185e4e2f374 /cmd-server-info.c
parent433d1e5cd8199cb8f3bb9115f65e592ac581bbbb (diff)
downloadtmux-old-6d8b0cf7022a818fadff9dddbb6fbcc6b65deada.zip
tmux-old-6d8b0cf7022a818fadff9dddbb6fbcc6b65deada.tar.gz
tmux-old-6d8b0cf7022a818fadff9dddbb6fbcc6b65deada.tar.bz2
Sync OpenBSD patchset 806:
Store sessions in an RB tree by name rather than a list, this is tidier and allows them to easily be shown sorted in various lists (list-sessions/choose-sessions). Keep a session index which is used in a couple of places internally but make it an ever-increasing number rather than filling in gaps with new sessions.
Diffstat (limited to 'cmd-server-info.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-server-info.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/cmd-server-info.c b/cmd-server-info.c
index b8d4bc3..39e47f9 100644
--- a/cmd-server-info.c
+++ b/cmd-server-info.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-server-info.c,v 1.37 2009/12/10 16:59:02 tcunha Exp $ */
+/* $Id: cmd-server-info.c,v 1.38 2010/12/22 15:36:44 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <[email protected]>
@@ -81,8 +81,6 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
else
ctx->print(ctx, "configuration file not specified");
ctx->print(ctx, "protocol version is %d", PROTOCOL_VERSION);
- ctx->print(ctx, "%u clients, %u sessions",
- ARRAY_LENGTH(&clients), ARRAY_LENGTH(&sessions));
ctx->print(ctx, "%s", "");
ctx->print(ctx, "Clients:");
@@ -101,19 +99,14 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
ctx->print(ctx, "Sessions: [%zu/%zu]",
sizeof (struct grid_cell), sizeof (struct grid_utf8));
- for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
- s = ARRAY_ITEM(&sessions, i);
- if (s == NULL)
- continue;
-
+ RB_FOREACH(s, sessions, &sessions) {
t = s->creation_time.tv_sec;
tim = ctime(&t);
*strchr(tim, '\n') = '\0';
ctx->print(ctx, "%2u: %s: %u windows (created %s) [%ux%u] "
- "[flags=0x%x, references=%u]", i, s->name,
- winlink_count(&s->windows), tim, s->sx, s->sy, s->flags,
- s->references);
+ "[flags=0x%x]", s->idx, s->name,
+ winlink_count(&s->windows), tim, s->sx, s->sy, s->flags);
RB_FOREACH(wl, winlinks, &s->windows) {
w = wl->window;
ctx->print(ctx, "%4u: %s [%ux%u] [flags=0x%x, "