diff options
author | 2018-07-11 08:29:21 +0000 | |
---|---|---|
committer | 2018-07-11 08:29:21 +0000 | |
commit | 980ca5678e770454da3289a483ef53783004c45b (patch) | |
tree | 7fd49d5deabc379f42262a65948b6286ce35dd35 /usr.bin/tmux/cmd-save-buffer.c | |
parent | s/wuth/with/ in comment (diff) | |
download | wireguard-openbsd-980ca5678e770454da3289a483ef53783004c45b.tar.xz wireguard-openbsd-980ca5678e770454da3289a483ef53783004c45b.zip |
Expand formats in load-buffer and save-buffer.
Diffstat (limited to 'usr.bin/tmux/cmd-save-buffer.c')
-rw-r--r-- | usr.bin/tmux/cmd-save-buffer.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c index 7072d4698ad..1f433c72eed 100644 --- a/usr.bin/tmux/cmd-save-buffer.c +++ b/usr.bin/tmux/cmd-save-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-save-buffer.c,v 1.43 2017/04/22 06:13:30 nicm Exp $ */ +/* $OpenBSD: cmd-save-buffer.c,v 1.44 2018/07/11 08:29:21 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -60,11 +60,13 @@ static enum cmd_retval cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = self->args; - struct client *c = item->client; + struct client *c = cmd_find_client(item, NULL, 1); + struct session *s = item->target.s; + struct winlink *wl = item->target.wl; + struct window_pane *wp = item->target.wp; struct paste_buffer *pb; - const char *path, *bufname, *bufdata, *start, *end; - const char *flags; - char *msg, *file; + const char *bufname, *bufdata, *start, *end, *flags; + char *msg, *path, *file; size_t size, used, msglen, bufsize; FILE *f; @@ -84,10 +86,12 @@ cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item) bufdata = paste_buffer_data(pb, &bufsize); if (self->entry == &cmd_show_buffer_entry) - path = "-"; + path = xstrdup("-"); else - path = args->argv[0]; + path = format_single(item, args->argv[0], c, s, wl, wp); if (strcmp(path, "-") == 0) { + free(path); + c = item->client; if (c == NULL) { cmdq_error(item, "can't write to stdout"); return (CMD_RETURN_ERROR); @@ -118,6 +122,7 @@ cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item) fclose(f); free(file); + free(path); return (CMD_RETURN_NORMAL); |