mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 21:56:57 +00:00
Accept 0 time as a shorthand for now to format_expand_time.
This commit is contained in:
@ -86,7 +86,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
||||||
format_defaults(ft, target_c, s, wl, wp);
|
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'))
|
if (args_has(self->args, 'p'))
|
||||||
cmdq_print(item, "%s", msg);
|
cmdq_print(item, "%s", msg);
|
||||||
else if (c != NULL)
|
else if (c != NULL)
|
||||||
|
@ -110,7 +110,7 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
/* Expand the command. */
|
/* Expand the command. */
|
||||||
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
ft = format_create(item->client, item, FORMAT_NONE, 0);
|
||||||
format_defaults(ft, c, s, wl, wp);
|
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);
|
format_free(ft);
|
||||||
|
|
||||||
/* Fork the child. */
|
/* Fork the child. */
|
||||||
|
2
format.c
2
format.c
@ -1482,6 +1482,8 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t)
|
|||||||
if (fmt == NULL || *fmt == '\0')
|
if (fmt == NULL || *fmt == '\0')
|
||||||
return (xstrdup(""));
|
return (xstrdup(""));
|
||||||
|
|
||||||
|
if (t == 0)
|
||||||
|
t = time(NULL);
|
||||||
tm = localtime(&t);
|
tm = localtime(&t);
|
||||||
|
|
||||||
if (strftime(s, sizeof s, fmt, tm) == 0)
|
if (strftime(s, sizeof s, fmt, tm) == 0)
|
||||||
|
@ -1537,7 +1537,7 @@ server_client_set_title(struct client *c)
|
|||||||
ft = format_create(c, NULL, FORMAT_NONE, 0);
|
ft = format_create(c, NULL, FORMAT_NONE, 0);
|
||||||
format_defaults(ft, c, NULL, NULL, NULL);
|
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) {
|
if (c->title == NULL || strcmp(title, c->title) != 0) {
|
||||||
free(c->title);
|
free(c->title);
|
||||||
c->title = xstrdup(title);
|
c->title = xstrdup(title);
|
||||||
|
Reference in New Issue
Block a user