summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-list-buffers.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-12-30 23:16:18 +0000
committernicm <nicm@openbsd.org>2010-12-30 23:16:18 +0000
commiteca05f1fc0ec6fc9c207193ddcba9f00995f6fdc (patch)
treecdf0e9851374e23108b26ce7898d7395f78cbbb4 /usr.bin/tmux/cmd-list-buffers.c
parentbe more cynical about boot-time entropy, and fold time and entropy data in. (diff)
downloadwireguard-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-list-buffers.c')
-rw-r--r--usr.bin/tmux/cmd-list-buffers.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/usr.bin/tmux/cmd-list-buffers.c b/usr.bin/tmux/cmd-list-buffers.c
index 21c670060e2..4be2baf9d14 100644
--- a/usr.bin/tmux/cmd-list-buffers.c
+++ b/usr.bin/tmux/cmd-list-buffers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-list-buffers.c,v 1.9 2010/06/21 21:44:09 nicm Exp $ */
+/* $OpenBSD: cmd-list-buffers.c,v 1.10 2010/12/30 23:16:18 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);