mirror of
https://github.com/tmux/tmux.git
synced 2024-11-19 19:08:50 +00:00
Expand formats in load-buffer and save-buffer.
This commit is contained in:
parent
e7d53020b4
commit
cfc81692e6
@ -56,11 +56,14 @@ cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct cmd_load_buffer_data *cdata;
|
||||
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;
|
||||
FILE *f;
|
||||
const char *path, *bufname;
|
||||
const char *bufname;
|
||||
char *pdata = NULL, *new_pdata, *cause;
|
||||
char *file;
|
||||
char *path, *file;
|
||||
size_t psize;
|
||||
int ch, error;
|
||||
|
||||
@ -68,8 +71,11 @@ cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (args_has(args, 'b'))
|
||||
bufname = args_get(args, 'b');
|
||||
|
||||
path = args->argv[0];
|
||||
path = format_single(item, args->argv[0], c, s, wl, wp);
|
||||
if (strcmp(path, "-") == 0) {
|
||||
free(path);
|
||||
c = item->client;
|
||||
|
||||
cdata = xcalloc(1, sizeof *cdata);
|
||||
cdata->item = item;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user