diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-12-30 23:16:18 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-12-30 23:16:18 +0000 |
commit | cc42614fa92a0fd93ae359af6562401a2d3d00d7 (patch) | |
tree | 48971a7a344f23f480e8d8aa32c928e1bb537a60 /cmd-show-buffer.c | |
parent | 2231e72968629d67575b18979fed13b4f5ad730b (diff) | |
download | rtmux-cc42614fa92a0fd93ae359af6562401a2d3d00d7.tar.gz rtmux-cc42614fa92a0fd93ae359af6562401a2d3d00d7.tar.bz2 rtmux-cc42614fa92a0fd93ae359af6562401a2d3d00d7.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 'cmd-show-buffer.c')
-rw-r--r-- | cmd-show-buffer.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/cmd-show-buffer.c b/cmd-show-buffer.c index b8c3c05d..b6d0c231 100644 --- a/cmd-show-buffer.c +++ b/cmd-show-buffer.c @@ -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) |