From bbc0898060a02515461cbd90d7af35bf91d9cb3d Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 10 Jun 2015 12:56:04 +0000 Subject: wp->tty is a char [] not a char * so it can't be NULL. From Thomas Adam. --- format.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'format.c') diff --git a/format.c b/format.c index 72d6bfc9..eaa979da 100644 --- a/format.c +++ b/format.c @@ -872,8 +872,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "pane_synchronized", "%d", !!options_get_number(&wp->window->options, "synchronize-panes")); - if (wp->tty != NULL) - format_add(ft, "pane_tty", "%s", wp->tty); + format_add(ft, "pane_tty", "%s", wp->tty); format_add(ft, "pane_pid", "%ld", (long) wp->pid); if ((cmd = cmd_stringify_argv(wp->argc, wp->argv)) != NULL) { format_add(ft, "pane_start_command", "%s", cmd); -- cgit From 29c29e771767b037f2929b889bb0de2b0b6ee138 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 14 Jun 2015 10:07:44 +0000 Subject: Add a format for client PID (client_pid) and server PID (pid). Diff for client_pid from Thomas Adam. --- format.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'format.c') diff --git a/format.c b/format.c index eaa979da..49cf7506 100644 --- a/format.c +++ b/format.c @@ -271,6 +271,7 @@ format_create_status(int status) *ptr = '\0'; format_add(ft, "host_short", "%s", host); } + format_add(ft, "pid", "%ld", (long) getpid()); return (ft); } @@ -703,6 +704,7 @@ format_defaults_client(struct format_tree *ft, struct client *c) if (ft->s == NULL) ft->s = c->session; + format_add(ft, "client_pid", "%ld", (long) c->pid); format_add(ft, "client_height", "%u", c->tty.sy); format_add(ft, "client_width", "%u", c->tty.sx); if (c->tty.path != NULL) -- cgit From d96ab3401960ab4a7c9434dfda1ebdc5204873e0 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 15 Jun 2015 10:58:01 +0000 Subject: Add window_activity format, from Thomas Adam based on a diff originally from propos6 at gmail dot com. --- format.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'format.c') diff --git a/format.c b/format.c index 49cf7506..67bce925 100644 --- a/format.c +++ b/format.c @@ -749,6 +749,7 @@ void format_defaults_window(struct format_tree *ft, struct window *w) { char *layout; + time_t t; ft->w = w; @@ -757,6 +758,10 @@ format_defaults_window(struct format_tree *ft, struct window *w) else layout = layout_dump(w->layout_root); + t = w->activity_time.tv_sec; + format_add(ft, "window_activity", "%lld", (long long) t); + format_add(ft, "window_activity_string", "%s", format_time_string(t)); + format_add(ft, "window_id", "@%u", w->id); format_add(ft, "window_name", "%s", w->name); format_add(ft, "window_width", "%u", w->sx); -- cgit From b43b13faf9ba620c3150bfe459fe6b38e58f6079 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 18 Jun 2015 23:55:24 +0000 Subject: Use xsnprintf. --- format.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'format.c') diff --git a/format.c b/format.c index 67bce925..8a52b0e1 100644 --- a/format.c +++ b/format.c @@ -338,7 +338,7 @@ format_find(struct format_tree *ft, const char *key) case OPTIONS_STRING: return (o->str); case OPTIONS_NUMBER: - snprintf(s, sizeof s, "%lld", o->num); + xsnprintf(s, sizeof s, "%lld", o->num); return (s); case OPTIONS_STYLE: return (style_tostring(&o->style)); @@ -679,7 +679,7 @@ format_defaults_session(struct format_tree *ft, struct session *s) RB_FOREACH (wl, winlinks, &s->windows) { if ((wl->flags & WINLINK_ALERTFLAGS) == 0) continue; - snprintf(tmp, sizeof tmp, "%u", wl->idx); + xsnprintf(tmp, sizeof tmp, "%u", wl->idx); if (*alerts != '\0') strlcat(alerts, ",", sizeof alerts); -- cgit