mirror of
https://github.com/tmux/tmux.git
synced 2024-12-24 18:21:33 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
2c755e3c55
@ -86,7 +86,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
||||
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
||||
format_defaults(ft, target_c, s, wl, wp);
|
||||
|
||||
msg = format_expand_time(ft, template, time(NULL));
|
||||
msg = format_expand_time(ft, template, 0);
|
||||
if (args_has(self->args, 'p'))
|
||||
cmdq_print(item, "%s", msg);
|
||||
else if (c != NULL)
|
||||
|
@ -109,7 +109,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
/* Expand the command. */
|
||||
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
||||
format_defaults(ft, c, s, wl, wp);
|
||||
cmd = format_expand_time(ft, args->argv[0], time(NULL));
|
||||
cmd = format_expand_time(ft, args->argv[0], 0);
|
||||
format_free(ft);
|
||||
|
||||
/* Fork the child. */
|
||||
|
21
format.c
21
format.c
@ -95,9 +95,10 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2)
|
||||
#define FORMAT_QUOTE 0x8
|
||||
#define FORMAT_LITERAL 0x10
|
||||
#define FORMAT_EXPAND 0x20
|
||||
#define FORMAT_SESSIONS 0x40
|
||||
#define FORMAT_WINDOWS 0x80
|
||||
#define FORMAT_PANES 0x100
|
||||
#define FORMAT_EXPANDTIME 0x40
|
||||
#define FORMAT_SESSIONS 0x80
|
||||
#define FORMAT_WINDOWS 0x100
|
||||
#define FORMAT_PANES 0x200
|
||||
|
||||
/* Entry in format tree. */
|
||||
struct format_entry {
|
||||
@ -1017,7 +1018,7 @@ format_build_modifiers(struct format_tree *ft, const char **s, u_int *count)
|
||||
|
||||
/*
|
||||
* Modifiers are a ; separated list of the forms:
|
||||
* l,m,C,b,d,t,q
|
||||
* l,m,C,b,d,t,q,E,T,S,W,P
|
||||
* =a
|
||||
* =/a
|
||||
* =/a/
|
||||
@ -1034,7 +1035,7 @@ format_build_modifiers(struct format_tree *ft, const char **s, u_int *count)
|
||||
cp++;
|
||||
|
||||
/* Check single character modifiers with no arguments. */
|
||||
if (strchr("lmCbdtqESWP", cp[0]) != NULL &&
|
||||
if (strchr("lmCbdtqETSWP", cp[0]) != NULL &&
|
||||
format_is_end(cp[1])) {
|
||||
format_add_modifier(&list, count, cp, 1, NULL, 0);
|
||||
cp++;
|
||||
@ -1321,6 +1322,9 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
|
||||
case 'E':
|
||||
modifiers |= FORMAT_EXPAND;
|
||||
break;
|
||||
case 'T':
|
||||
modifiers |= FORMAT_EXPANDTIME;
|
||||
break;
|
||||
case 'S':
|
||||
modifiers |= FORMAT_SESSIONS;
|
||||
break;
|
||||
@ -1448,6 +1452,11 @@ done:
|
||||
free(value);
|
||||
value = new;
|
||||
}
|
||||
else if (modifiers & FORMAT_EXPANDTIME) {
|
||||
new = format_expand_time(ft, value, 0);
|
||||
free(value);
|
||||
value = new;
|
||||
}
|
||||
|
||||
/* Perform substitution if any. */
|
||||
if (sub != NULL) {
|
||||
@ -1498,6 +1507,8 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
|
||||
if (fmt == NULL || *fmt == '\0')
|
||||
return (xstrdup(""));
|
||||
|
||||
if (t == 0)
|
||||
t = time(NULL);
|
||||
tm = localtime(&t);
|
||||
|
||||
if (strftime(s, sizeof s, fmt, tm) == 0)
|
||||
|
@ -1547,7 +1547,7 @@ server_client_set_title(struct client *c)
|
||||
ft = format_create(c, NULL, FORMAT_NONE, 0);
|
||||
format_defaults(ft, c, NULL, NULL, NULL);
|
||||
|
||||
title = format_expand_time(ft, template, time(NULL));
|
||||
title = format_expand_time(ft, template, 0);
|
||||
if (c->title == NULL || strcmp(title, c->title) != 0) {
|
||||
free(c->title);
|
||||
c->title = xstrdup(title);
|
||||
|
Loading…
Reference in New Issue
Block a user