From cc42614fa92a0fd93ae359af6562401a2d3d00d7 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 30 Dec 2010 23:16:18 +0000 Subject: 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. --- cmd-save-buffer.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'cmd-save-buffer.c') diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c index 1d287cd2..7a30d12b 100644 --- a/cmd-save-buffer.c +++ b/cmd-save-buffer.c @@ -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); } -- cgit v1.2.3