summaryrefslogtreecommitdiffstats
path: root/cmd-list-buffers.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-list-buffers.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-list-buffers.c')
-rw-r--r--cmd-list-buffers.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index c2b0edc9..efc86f97 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -30,29 +30,25 @@ int cmd_list_buffers_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_list_buffers_entry = {
"list-buffers", "lsb",
- CMD_TARGET_SESSION_USAGE,
+ "",
0, "",
- cmd_target_init,
- cmd_target_parse,
+ NULL,
+ NULL,
cmd_list_buffers_exec,
- cmd_target_free,
- cmd_target_print
+ NULL,
+ NULL
};
+/* ARGSUSED */
int
-cmd_list_buffers_exec(struct cmd *self, struct cmd_ctx *ctx)
+cmd_list_buffers_exec(unused struct cmd *self, struct cmd_ctx *ctx)
{
- struct cmd_target_data *data = self->data;
- struct session *s;
struct paste_buffer *pb;
u_int idx;
char *tmp;
- if ((s = cmd_find_session(ctx, data->target)) == NULL)
- return (-1);
-
idx = 0;
- while ((pb = paste_walk_stack(&s->buffers, &idx)) != NULL) {
+ while ((pb = paste_walk_stack(&global_buffers, &idx)) != NULL) {
tmp = paste_print(pb, 50);
ctx->print(ctx,
"%u: %zu bytes: \"%s\"", idx - 1, pb->size, tmp);