summaryrefslogtreecommitdiffstats
path: root/cmd-paste-buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
commit93230a64bc9369c726cc68d3f539b3bf66cff069 (patch)
tree0ad90cda9a0db39a058cbac8ceec67e6e7215354 /cmd-paste-buffer.c
parent5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff)
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-paste-buffer.c')
-rw-r--r--cmd-paste-buffer.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index 5077b392..2598b39d 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-paste-buffer.c,v 1.14 2009-01-11 23:31:46 nicm Exp $ */
+/* $Id: cmd-paste-buffer.c,v 1.15 2009-01-19 18:23:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -26,7 +26,7 @@
* Paste paste buffer if present.
*/
-void cmd_paste_buffer_exec(struct cmd *, struct cmd_ctx *);
+int cmd_paste_buffer_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_paste_buffer_entry = {
"paste-buffer", "pasteb",
@@ -41,7 +41,7 @@ const struct cmd_entry cmd_paste_buffer_entry = {
cmd_buffer_print
};
-void
+int
cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_buffer_data *data = self->data;
@@ -51,14 +51,16 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
struct paste_buffer *pb;
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
- return;
+ return (-1);
w = wl->window;
if (data->buffer == -1)
pb = paste_get_top(&s->buffers);
else {
- if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL)
+ if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL) {
ctx->error(ctx, "no buffer %d", data->buffer);
+ return (-1);
+ }
}
if (pb != NULL)
@@ -72,6 +74,5 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
paste_free_index(&s->buffers, data->buffer);
}
- if (ctx->cmdclient != NULL)
- server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
+ return (0);
}