From eca05f1fc0ec6fc9c207193ddcba9f00995f6fdc Mon Sep 17 00:00:00 2001 From: nicm 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. --- usr.bin/tmux/cmd-save-buffer.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'usr.bin/tmux/cmd-save-buffer.c') diff --git a/usr.bin/tmux/cmd-save-buffer.c b/usr.bin/tmux/cmd-save-buffer.c index 318ed522ded..95344ef3fb6 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.8 2010/07/24 20:11:59 nicm Exp $ */ +/* $OpenBSD: cmd-save-buffer.c,v 1.9 2010/12/30 23:16:18 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -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-59-g8ed1b