summaryrefslogtreecommitdiffstats
path: root/cmd-command-prompt.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-command-prompt.c
parent5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff)
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-command-prompt.c')
-rw-r--r--cmd-command-prompt.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c
index eca662fe..be962173 100644
--- a/cmd-command-prompt.c
+++ b/cmd-command-prompt.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-command-prompt.c,v 1.11 2009-01-18 17:20:52 nicm Exp $ */
+/* $Id: cmd-command-prompt.c,v 1.12 2009-01-19 18:23:40 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -28,7 +28,7 @@
*/
void cmd_command_prompt_init(struct cmd *, int);
-void cmd_command_prompt_exec(struct cmd *, struct cmd_ctx *);
+int cmd_command_prompt_exec(struct cmd *, struct cmd_ctx *);
int cmd_command_prompt_callback(void *, const char *);
@@ -68,7 +68,7 @@ cmd_command_prompt_init(struct cmd *self, int key)
}
}
-void
+int
cmd_command_prompt_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
@@ -77,10 +77,10 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_ctx *ctx)
char *hdr, *ptr;
if ((c = cmd_find_client(ctx, data->target)) == NULL)
- return;
+ return (-1);
if (c->prompt_string != NULL)
- return;
+ return (0);
cdata = xmalloc(sizeof *cdata);
cdata->c = c;
@@ -96,8 +96,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_ctx *ctx)
server_set_client_prompt(c, hdr, cmd_command_prompt_callback, cdata, 0);
xfree(hdr);
- if (ctx->cmdclient != NULL)
- server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
+ return (0);
}
int