mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-09 05:54:47 +02:00
Change from a per-session stack of buffers to one global stack which is
much more convenient and also simplifies lot of code. This renders copy-buffer useless and makes buffer-limit now a server option. By Tiago Cunha.
This commit is contained in:
@ -32,7 +32,7 @@ int cmd_save_buffer_exec(struct cmd *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_save_buffer_entry = {
|
||||
"save-buffer", "saveb",
|
||||
"[-a] " CMD_BUFFER_SESSION_USAGE " path",
|
||||
"[-a] " CMD_BUFFER_USAGE " path",
|
||||
CMD_ARG1, "a",
|
||||
cmd_buffer_init,
|
||||
cmd_buffer_parse,
|
||||
@ -45,21 +45,18 @@ int
|
||||
cmd_save_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct cmd_buffer_data *data = self->data;
|
||||
struct session *s;
|
||||
struct paste_buffer *pb;
|
||||
mode_t mask;
|
||||
FILE *f;
|
||||
|
||||
if ((s = cmd_find_session(ctx, data->target)) == NULL)
|
||||
return (-1);
|
||||
|
||||
if (data->buffer == -1) {
|
||||
if ((pb = paste_get_top(&s->buffers)) == NULL) {
|
||||
if ((pb = paste_get_top(&global_buffers)) == NULL) {
|
||||
ctx->error(ctx, "no buffers");
|
||||
return (-1);
|
||||
}
|
||||
} else {
|
||||
if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL) {
|
||||
pb = paste_get_index(&global_buffers, data->buffer);
|
||||
if (pb == NULL) {
|
||||
ctx->error(ctx, "no buffer %d", data->buffer);
|
||||
return (-1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user