diff options
author | 2010-12-30 23:16:18 +0000 | |
---|---|---|
committer | 2010-12-30 23:16:18 +0000 | |
commit | eca05f1fc0ec6fc9c207193ddcba9f00995f6fdc (patch) | |
tree | cdf0e9851374e23108b26ce7898d7395f78cbbb4 /usr.bin/tmux/cmd-show-buffer.c | |
parent | be more cynical about boot-time entropy, and fold time and entropy data in. (diff) | |
download | wireguard-openbsd-eca05f1fc0ec6fc9c207193ddcba9f00995f6fdc.tar.xz wireguard-openbsd-eca05f1fc0ec6fc9c207193ddcba9f00995f6fdc.zip |
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 'usr.bin/tmux/cmd-show-buffer.c')
-rw-r--r-- | usr.bin/tmux/cmd-show-buffer.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-show-buffer.c b/usr.bin/tmux/cmd-show-buffer.c index 4e67bc25c42..e6631f61e2a 100644 --- a/usr.bin/tmux/cmd-show-buffer.c +++ b/usr.bin/tmux/cmd-show-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-buffer.c,v 1.8 2009/12/03 22:50:10 nicm Exp $ */ +/* $OpenBSD: cmd-show-buffer.c,v 1.9 2010/12/30 23:16:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -30,7 +30,7 @@ int cmd_show_buffer_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_show_buffer_entry = { "show-buffer", "showb", - CMD_BUFFER_SESSION_USAGE, + CMD_BUFFER_USAGE, 0, "", cmd_buffer_init, cmd_buffer_parse, @@ -49,20 +49,21 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) size_t size, len; u_int width; - if ((s = cmd_find_session(ctx, data->target)) == NULL) + if ((s = cmd_find_session(ctx, NULL)) == 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) { - ctx->error(ctx, "no buffer %d", data->buffer); - return (-1); + } else { + pb = paste_get_index(&global_buffers, data->buffer); + if (pb == NULL) { + ctx->error(ctx, "no buffer %d", data->buffer); + return (-1); + } } - if (pb == NULL) - return (0); size = pb->size; if (size > SIZE_MAX / 4 - 1) |