diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-19 18:23:40 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-19 18:23:40 +0000 |
commit | 93230a64bc9369c726cc68d3f539b3bf66cff069 (patch) | |
tree | 0ad90cda9a0db39a058cbac8ceec67e6e7215354 /cmd-attach-session.c | |
parent | 5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff) | |
download | rtmux-93230a64bc9369c726cc68d3f539b3bf66cff069.tar.gz rtmux-93230a64bc9369c726cc68d3f539b3bf66cff069.tar.bz2 rtmux-93230a64bc9369c726cc68d3f539b3bf66cff069.zip |
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-attach-session.c')
-rw-r--r-- | cmd-attach-session.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 2686563a..1a403c65 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -1,4 +1,4 @@ -/* $Id: cmd-attach-session.c,v 1.22 2009-01-19 17:16:09 nicm Exp $ */ +/* $Id: cmd-attach-session.c,v 1.23 2009-01-19 18:23:40 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -24,7 +24,7 @@ * Attach existing session to the current terminal. */ -void cmd_attach_session_exec(struct cmd *, struct cmd_ctx *); +int cmd_attach_session_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_attach_session_entry = { "attach-session", "attach", @@ -39,7 +39,7 @@ const struct cmd_entry cmd_attach_session_entry = { cmd_target_print }; -void +int cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_target_data *data = self->data; @@ -47,24 +47,24 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) char *cause; if (ctx->curclient != NULL) - return; + return (0); if (ARRAY_LENGTH(&sessions) == 0) { ctx->error(ctx, "no sessions"); - return; + return (-1); } if ((s = cmd_find_session(ctx, data->target)) == NULL) - return; + return (-1); if (!(ctx->cmdclient->flags & CLIENT_TERMINAL)) { ctx->error(ctx, "not a terminal"); - return; + return (-1); } if (tty_open(&ctx->cmdclient->tty, &cause) != 0) { ctx->error(ctx, "%s", cause); xfree(cause); - return; + return (-1); } if (data->flags & CMD_DFLAG) @@ -74,5 +74,7 @@ cmd_attach_session_exec(struct cmd *self, struct cmd_ctx *ctx) server_write_client(ctx->cmdclient, MSG_READY, NULL, 0); recalculate_sizes(); server_redraw_client(ctx->cmdclient); + + return (1); } |