version 1.25, 2013/03/24 09:27:19 |
version 1.26, 2013/03/24 09:54:10 |
|
|
|
|
void cmd_command_prompt_key_binding(struct cmd *, int); |
void cmd_command_prompt_key_binding(struct cmd *, int); |
int cmd_command_prompt_check(struct args *); |
int cmd_command_prompt_check(struct args *); |
enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_ctx *); |
enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); |
|
|
int cmd_command_prompt_callback(void *, const char *); |
int cmd_command_prompt_callback(void *, const char *); |
void cmd_command_prompt_free(void *); |
void cmd_command_prompt_free(void *); |
|
|
} |
} |
|
|
enum cmd_retval |
enum cmd_retval |
cmd_command_prompt_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
const char *inputs, *prompts; |
const char *inputs, *prompts; |
|
|
char *prompt, *ptr, *input = NULL; |
char *prompt, *ptr, *input = NULL; |
size_t n; |
size_t n; |
|
|
if ((c = cmd_find_client(ctx, args_get(args, 't'), 0)) == NULL) |
if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
|
|
if (c->prompt_string != NULL) |
if (c->prompt_string != NULL) |
|
|
struct cmd_command_prompt_cdata *cdata = data; |
struct cmd_command_prompt_cdata *cdata = data; |
struct client *c = cdata->c; |
struct client *c = cdata->c; |
struct cmd_list *cmdlist; |
struct cmd_list *cmdlist; |
struct cmd_ctx *ctx; |
|
char *cause, *new_template, *prompt, *ptr; |
char *cause, *new_template, *prompt, *ptr; |
char *input = NULL; |
char *input = NULL; |
|
|
|
|
return (1); |
return (1); |
} |
} |
|
|
if (cmd_string_parse(new_template, &cmdlist, &cause) != 0) { |
if (cmd_string_parse(new_template, &cmdlist, NULL, 0, &cause) != 0) { |
if (cause != NULL) { |
if (cause != NULL) { |
*cause = toupper((u_char) *cause); |
*cause = toupper((u_char) *cause); |
status_message_set(c, "%s", cause); |
status_message_set(c, "%s", cause); |
|
|
return (0); |
return (0); |
} |
} |
|
|
ctx = cmd_get_ctx(NULL, c); |
cmdq_run(c->cmdq, cmdlist); |
ctx->error = key_bindings_error; |
|
ctx->print = key_bindings_print; |
|
ctx->info = key_bindings_info; |
|
|
|
cmd_list_exec(cmdlist, ctx); |
|
cmd_list_free(cmdlist); |
cmd_list_free(cmdlist); |
cmd_free_ctx(ctx); |
|
|
|
if (c->prompt_callbackfn != (void *) &cmd_command_prompt_callback) |
if (c->prompt_callbackfn != (void *) &cmd_command_prompt_callback) |
return (1); |
return (1); |