summaryrefslogtreecommitdiffstats
path: root/cmd-show-buffer.c
authornicm <nicm>2009-01-19 18:23:40 (GMT)
committer nicm <nicm>2009-01-19 18:23:40 (GMT)
commit2fd1100a3889ead3be34561fe55c3317a655940c (patch) (side-by-side diff)
tree3691d38b018b82aacfe685a5c890ea3d4efec4aa /cmd-show-buffer.c
parent5abf6bb85a525ce227997f14cb442d6d0d97cf0b (diff)
downloadtmux-old-2fd1100a3889ead3be34561fe55c3317a655940c.zip
tmux-old-2fd1100a3889ead3be34561fe55c3317a655940c.tar.gz
tmux-old-2fd1100a3889ead3be34561fe55c3317a655940c.tar.bz2
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-show-buffer.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-show-buffer.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/cmd-show-buffer.c b/cmd-show-buffer.c
index 80099cf..b28d0dd 100644
--- a/cmd-show-buffer.c
+++ b/cmd-show-buffer.c
@@ -26,7 +26,7 @@
* Show a session paste buffer.
*/
-void cmd_show_buffer_exec(struct cmd *, struct cmd_ctx *);
+int cmd_show_buffer_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_show_buffer_entry = {
"show-buffer", "showb",
@@ -41,7 +41,7 @@ const struct cmd_entry cmd_show_buffer_entry = {
cmd_buffer_print
};
-void
+int
cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_buffer_data *data = self->data;
@@ -52,14 +52,16 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
size_t len;
if ((s = cmd_find_session(ctx, data->target)) == NULL)
- return;
+ return (-1);
if (data->buffer == -1) {
- if ((pb = paste_get_top(&s->buffers)) == NULL)
+ if ((pb = paste_get_top(&s->buffers)) == NULL) {
ctx->error(ctx, "no buffers");
- } else {
- if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL)
- ctx->error(ctx, "no buffer %d", data->buffer);
+ return (-1);
+ }
+ } else if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL) {
+ ctx->error(ctx, "no buffer %d", data->buffer);
+ return (-1);
}
if (pb != NULL) {
@@ -83,6 +85,5 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
ctx->print(ctx, buf);
}
- if (ctx->cmdclient != NULL)
- server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
+ return (0);
}