diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-10-23 15:03:50 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-10-23 15:03:50 +0000 |
commit | 1c1797e4f29012a60727a1793e5f75bd769f5d14 (patch) | |
tree | 3d293bdce5a7251b6919dd0fb47a36e6a29ace9c /format.c | |
parent | 653d1e2fc80a4eca4f819b31bacd7119038276d6 (diff) | |
download | rtmux-1c1797e4f29012a60727a1793e5f75bd769f5d14.tar.gz rtmux-1c1797e4f29012a60727a1793e5f75bd769f5d14.tar.bz2 rtmux-1c1797e4f29012a60727a1793e5f75bd769f5d14.zip |
Sync OpenBSD patchset 965:
Add client formats, from Ben Boeckel.
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -295,6 +295,42 @@ format_session(struct format_tree *ft, struct session *s) format_add(ft, "session_attached", "%d", 1); } +/* Set default format keys for a client. */ +void +format_client(struct format_tree *ft, struct client *c) +{ + char *tim; + time_t t; + + format_add(ft, "client_cwd", "%s", c->cwd); + format_add(ft, "client_height", "%u", c->tty.sx); + format_add(ft, "client_width", "%u", c->tty.sy); + format_add(ft, "client_tty", "%s", c->tty.path); + format_add(ft, "client_termname", "%s", c->tty.termname); + + t = c->creation_time.tv_sec; + format_add(ft, "client_created", "%ld", (long) t); + tim = ctime(&t); + *strchr(tim, '\n') = '\0'; + format_add(ft, "client_created_string", "%s", tim); + + t = c->activity_time.tv_sec; + format_add(ft, "client_activity", "%ld", (long) t); + tim = ctime(&t); + *strchr(tim, '\n') = '\0'; + format_add(ft, "client_activity_string", "%s", tim); + + if (c->tty.flags & TTY_UTF8) + format_add(ft, "client_utf8", "%d", 1); + else + format_add(ft, "client_utf8", "%d", 0); + + if (c->flags & CLIENT_READONLY) + format_add(ft, "client_readonly", "%d", 1); + else + format_add(ft, "client_readonly", "%d", 0); +} + /* Set default format keys for a winlink. */ void format_winlink(struct format_tree *ft, struct session *s, struct winlink *wl) |