mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Pass output from jobs through format_expand() so they are expanded again
(this was the previous behaviour).
This commit is contained in:
parent
3034a71488
commit
3faa51a0ca
22
format.c
22
format.c
@ -39,7 +39,7 @@ struct format_entry;
|
|||||||
typedef void (*format_cb)(struct format_tree *, struct format_entry *);
|
typedef void (*format_cb)(struct format_tree *, struct format_entry *);
|
||||||
|
|
||||||
void format_job_callback(struct job *);
|
void format_job_callback(struct job *);
|
||||||
const char *format_job_get(struct format_tree *, const char *);
|
char *format_job_get(struct format_tree *, const char *);
|
||||||
void format_job_timer(int, short, void *);
|
void format_job_timer(int, short, void *);
|
||||||
|
|
||||||
void format_cb_host(struct format_tree *, struct format_entry *);
|
void format_cb_host(struct format_tree *, struct format_entry *);
|
||||||
@ -212,7 +212,7 @@ format_job_callback(struct job *job)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Find a job. */
|
/* Find a job. */
|
||||||
const char *
|
char *
|
||||||
format_job_get(struct format_tree *ft, const char *cmd)
|
format_job_get(struct format_tree *ft, const char *cmd)
|
||||||
{
|
{
|
||||||
struct format_job fj0, *fj;
|
struct format_job fj0, *fj;
|
||||||
@ -242,7 +242,7 @@ format_job_get(struct format_tree *ft, const char *cmd)
|
|||||||
if (ft->flags & FORMAT_STATUS)
|
if (ft->flags & FORMAT_STATUS)
|
||||||
fj->status = 1;
|
fj->status = 1;
|
||||||
|
|
||||||
return (fj->out);
|
return (format_expand(ft, fj->out));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove old jobs. */
|
/* Remove old jobs. */
|
||||||
@ -709,9 +709,9 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
|
|||||||
char *
|
char *
|
||||||
format_expand(struct format_tree *ft, const char *fmt)
|
format_expand(struct format_tree *ft, const char *fmt)
|
||||||
{
|
{
|
||||||
char *buf, *tmp, *cmd;
|
char *buf, *tmp, *cmd, *out;
|
||||||
const char *ptr, *s, *saved = fmt;
|
const char *ptr, *s, *saved = fmt;
|
||||||
size_t off, len, n, slen;
|
size_t off, len, n, outlen;
|
||||||
int ch, brackets;
|
int ch, brackets;
|
||||||
|
|
||||||
if (fmt == NULL)
|
if (fmt == NULL)
|
||||||
@ -751,18 +751,20 @@ format_expand(struct format_tree *ft, const char *fmt)
|
|||||||
tmp[n] = '\0';
|
tmp[n] = '\0';
|
||||||
cmd = format_expand(ft, tmp);
|
cmd = format_expand(ft, tmp);
|
||||||
|
|
||||||
s = format_job_get(ft, cmd);
|
out = format_job_get(ft, cmd);
|
||||||
slen = strlen(s);
|
outlen = strlen(out);
|
||||||
|
|
||||||
free(cmd);
|
free(cmd);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
while (len - off < slen + 1) {
|
while (len - off < outlen + 1) {
|
||||||
buf = xreallocarray(buf, 2, len);
|
buf = xreallocarray(buf, 2, len);
|
||||||
len *= 2;
|
len *= 2;
|
||||||
}
|
}
|
||||||
memcpy(buf + off, s, slen);
|
memcpy(buf + off, out, outlen);
|
||||||
off += slen;
|
off += outlen;
|
||||||
|
|
||||||
|
free(out);
|
||||||
|
|
||||||
fmt += n + 1;
|
fmt += n + 1;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user