Pass return code from _exec; allow command sequences to work from the command line.

This commit is contained in:
Nicholas Marriott
2009-01-19 18:23:40 +00:00
parent 5f6a351df7
commit 93230a64bc
68 changed files with 458 additions and 494 deletions

View File

@ -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