diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-12-22 15:36:44 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-12-22 15:36:44 +0000 |
commit | a373235106d22fdead116d478087d8f8f11c150d (patch) | |
tree | 2f4aba9efa49f7855e918e095d13f6085f8d4d91 /cmd-server-info.c | |
parent | 9f3399da001580aa8b2118bb38245c7c5f26e944 (diff) |
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')
-rw-r--r-- | cmd-server-info.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/cmd-server-info.c b/cmd-server-info.c index d168071d..aa950330 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 <nicm@users.sourceforge.net> @@ -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, " |