=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/status.c,v retrieving revision 1.122 retrieving revision 1.123 diff -c -r1.122 -r1.123 *** src/usr.bin/tmux/status.c 2015/02/06 17:11:39 1.122 --- src/usr.bin/tmux/status.c 2015/02/06 17:21:08 1.123 *************** *** 1,4 **** ! /* $OpenBSD: status.c,v 1.122 2015/02/06 17:11:39 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: status.c,v 1.123 2015/02/06 17:21:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 29,44 **** #include "tmux.h" ! char *status_redraw_get_left( ! struct client *, time_t, int, struct grid_cell *, size_t *); ! char *status_redraw_get_right( ! struct client *, time_t, int, struct grid_cell *, size_t *); char *status_find_job(struct client *, char **); void status_job_free(void *); void status_job_callback(struct job *); ! char *status_print( ! struct client *, struct winlink *, time_t, struct grid_cell *); ! void status_replace1(struct client *, char **, char **, char *, size_t, int); void status_message_callback(int, short, void *); const char *status_prompt_up_history(u_int *); --- 29,45 ---- #include "tmux.h" ! char *status_redraw_get_left(struct client *, time_t, int, struct grid_cell *, ! size_t *); ! char *status_redraw_get_right(struct client *, time_t, int, ! struct grid_cell *, size_t *); char *status_find_job(struct client *, char **); void status_job_free(void *); void status_job_callback(struct job *); ! char *status_print(struct client *, struct winlink *, time_t, ! struct grid_cell *); ! char *status_replace(struct client *, struct winlink *, const char *, time_t); ! void status_replace1(struct client *, char **, char **, char *, size_t); void status_message_callback(int, short, void *); const char *status_prompt_up_history(u_int *); *************** *** 86,92 **** style_apply_update(gc, &s->options, "status-left-style"); template = options_get_string(&s->options, "status-left"); ! left = status_replace(c, NULL, template , t, 1); *size = options_get_number(&s->options, "status-left-length"); leftlen = screen_write_cstrlen(utf8flag, "%s", left); --- 87,93 ---- style_apply_update(gc, &s->options, "status-left-style"); template = options_get_string(&s->options, "status-left"); ! left = status_replace(c, NULL, template, t); *size = options_get_number(&s->options, "status-left-length"); leftlen = screen_write_cstrlen(utf8flag, "%s", left); *************** *** 108,114 **** style_apply_update(gc, &s->options, "status-right-style"); template = options_get_string(&s->options, "status-right"); ! right = status_replace(c, NULL, template, t, 1); *size = options_get_number(&s->options, "status-right-length"); rightlen = screen_write_cstrlen(utf8flag, "%s", right); --- 109,115 ---- style_apply_update(gc, &s->options, "status-right-style"); template = options_get_string(&s->options, "status-right"); ! right = status_replace(c, NULL, template, t); *size = options_get_number(&s->options, "status-right-length"); rightlen = screen_write_cstrlen(utf8flag, "%s", right); *************** *** 364,370 **** /* Replace a single special sequence (prefixed by #). */ void status_replace1(struct client *c, char **iptr, char **optr, char *out, ! size_t outsize, int jobsflag) { char ch, tmp[256], *ptr, *endptr; size_t ptrlen; --- 365,371 ---- /* Replace a single special sequence (prefixed by #). */ void status_replace1(struct client *c, char **iptr, char **optr, char *out, ! size_t outsize) { char ch, tmp[256], *ptr, *endptr; size_t ptrlen; *************** *** 382,391 **** switch (*(*iptr)++) { case '(': - if (!jobsflag) { - ch = ')'; - goto skip_to; - } if ((ptr = status_find_job(c, iptr)) == NULL) return; goto do_replace; --- 383,388 ---- *************** *** 434,444 **** /* Replace special sequences in fmt. */ char * ! status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t, ! int jobsflag) { - struct session *s = NULL; - struct window_pane *wp = NULL; static char out[BUFSIZ]; char in[BUFSIZ], ch, *iptr, *optr, *expanded; size_t len; --- 431,438 ---- /* Replace special sequences in fmt. */ char * ! status_replace(struct client *c, struct winlink *wl, const char *fmt, time_t t) { static char out[BUFSIZ]; char in[BUFSIZ], ch, *iptr, *optr, *expanded; size_t len; *************** *** 447,459 **** if (fmt == NULL) return (xstrdup("")); - if (c != NULL) - s = c->session; - if (wl == NULL && s != NULL) - wl = s->curw; - if (wl != NULL) - wp = wl->window->active; - len = strftime(in, sizeof in, fmt, localtime(&t)); in[len] = '\0'; --- 441,446 ---- *************** *** 469,480 **** *optr++ = ch; continue; } ! status_replace1(c, &iptr, &optr, out, sizeof out, jobsflag); } *optr = '\0'; ft = format_create(); ! format_defaults(ft, c, s, wl, wp); expanded = format_expand(ft, out); format_free(ft); return (expanded); --- 456,467 ---- *optr++ = ch; continue; } ! status_replace1(c, &iptr, &optr, out, sizeof out); } *optr = '\0'; ft = format_create(); ! format_defaults(ft, c, NULL, wl, NULL); expanded = format_expand(ft, out); format_free(ft); return (expanded); *************** *** 639,645 **** else if (wl->flags & (WINLINK_ACTIVITY|WINLINK_SILENCE)) style_apply_update(gc, oo, "window-status-activity-style"); ! text = status_replace(c, wl, fmt, t, 1); return (text); } --- 626,632 ---- else if (wl->flags & (WINLINK_ACTIVITY|WINLINK_SILENCE)) style_apply_update(gc, oo, "window-status-activity-style"); ! text = status_replace(c, wl, fmt, t); return (text); }