summaryrefslogtreecommitdiffstats
path: root/cmd-list-sessions.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-11 23:38:16 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-11 23:38:16 +0000
commit6a1ebb11df452e570b430ba16192c38b0e3a0f90 (patch)
treef2165e41abebbb503f4f8feba689468128a96cf7 /cmd-list-sessions.c
parent1fd3a405e69c7478ab29d29cd56ac5b23f2f4f71 (diff)
Sync OpenBSD patchset 371:
Add "grouped sessions" which have independent name, options, current window and so on but where the linked windows are synchronized (ie creating, killing windows and so on are mirrored between the sessions). A grouped session may be created by passing -t to new-session. Had this around for a while, tested by a couple of people.
Diffstat (limited to 'cmd-list-sessions.c')
-rw-r--r--cmd-list-sessions.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index 74274e05..e6be3bbc 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list-sessions.c,v 1.21 2009-07-28 22:12:16 tcunha Exp $ */
+/* $Id: cmd-list-sessions.c,v 1.22 2009-10-11 23:38:16 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -42,23 +42,32 @@ const struct cmd_entry cmd_list_sessions_entry = {
int
cmd_list_sessions_exec(unused struct cmd *self, struct cmd_ctx *ctx)
{
- struct session *s;
- char *tim;
- u_int i;
- time_t t;
+ struct session *s;
+ struct session_group *sg;
+ char *tim, tmp[64];
+ u_int i, idx;
+ time_t t;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
if (s == NULL)
continue;
+ sg = session_group_find(s);
+ if (sg == NULL)
+ *tmp = '\0';
+ else {
+ idx = session_group_index(sg);
+ xsnprintf(tmp, sizeof tmp, " (group %u)", idx);
+ }
+
t = s->tv.tv_sec;
tim = ctime(&t);
*strchr(tim, '\n') = '\0';
- ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s",
+ ctx->print(ctx, "%s: %u windows (created %s) [%ux%u]%s%s",
s->name, winlink_count(&s->windows), tim, s->sx, s->sy,
- s->flags & SESSION_UNATTACHED ? "" : " (attached)");
+ tmp, s->flags & SESSION_UNATTACHED ? "" : " (attached)");
}
return (0);