summaryrefslogtreecommitdiffstats
path: root/cmd-save-buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-12-30 23:16:18 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-12-30 23:16:18 +0000
commitcc42614fa92a0fd93ae359af6562401a2d3d00d7 (patch)
tree48971a7a344f23f480e8d8aa32c928e1bb537a60 /cmd-save-buffer.c
parent2231e72968629d67575b18979fed13b4f5ad730b (diff)
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.
Diffstat (limited to 'cmd-save-buffer.c')
-rw-r--r--cmd-save-buffer.c11
1 files changed, 4 insertions, 7 deletions
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);
}