summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-command-prompt.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-05-17 15:20:23 +0000
committernicm <nicm@openbsd.org>2017-05-17 15:20:23 +0000
commit3bf5ffec796c4ae00fdf9d61243def7135c9711a (patch)
tree7e7d188f7784d5232d46e43e64722915f7d29f8e /usr.bin/tmux/cmd-command-prompt.c
parentThere's no need to track the number of errors (and the counter might (diff)
downloadwireguard-openbsd-3bf5ffec796c4ae00fdf9d61243def7135c9711a.tar.xz
wireguard-openbsd-3bf5ffec796c4ae00fdf9d61243def7135c9711a.zip
Tidy command prompt callbacks and pass in the client.
Diffstat (limited to 'usr.bin/tmux/cmd-command-prompt.c')
-rw-r--r--usr.bin/tmux/cmd-command-prompt.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c
index 297fa742ec8..e44c7d5caf4 100644
--- a/usr.bin/tmux/cmd-command-prompt.c
+++ b/usr.bin/tmux/cmd-command-prompt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-command-prompt.c,v 1.43 2017/04/22 10:22:39 nicm Exp $ */
+/* $OpenBSD: cmd-command-prompt.c,v 1.44 2017/05/17 15:20:23 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -32,7 +32,8 @@
static enum cmd_retval cmd_command_prompt_exec(struct cmd *,
struct cmdq_item *);
-static int cmd_command_prompt_callback(void *, const char *, int);
+static int cmd_command_prompt_callback(struct client *, void *,
+ const char *, int);
static void cmd_command_prompt_free(void *);
const struct cmd_entry cmd_command_prompt_entry = {
@@ -48,17 +49,16 @@ const struct cmd_entry cmd_command_prompt_entry = {
};
struct cmd_command_prompt_cdata {
- struct client *c;
- int flags;
+ int flags;
- char *inputs;
- char *next_input;
+ char *inputs;
+ char *next_input;
- char *prompts;
- char *next_prompt;
+ char *prompts;
+ char *next_prompt;
- char *template;
- int idx;
+ char *template;
+ int idx;
};
static enum cmd_retval
@@ -78,7 +78,6 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL);
cdata = xcalloc(1, sizeof *cdata);
- cdata->c = c;
cdata->inputs = NULL;
cdata->next_input = NULL;
@@ -142,10 +141,10 @@ cmd_command_prompt_error(struct cmdq_item *item, void *data)
}
static int
-cmd_command_prompt_callback(void *data, const char *s, int done)
+cmd_command_prompt_callback(struct client *c, void *data, const char *s,
+ int done)
{
struct cmd_command_prompt_cdata *cdata = data;
- struct client *c = cdata->c;
struct cmd_list *cmdlist;
struct cmdq_item *new_item;
char *cause, *new_template, *prompt, *ptr;
@@ -193,7 +192,7 @@ cmd_command_prompt_callback(void *data, const char *s, int done)
if (!done)
free(new_template);
- if (c->prompt_callbackfn != cmd_command_prompt_callback)
+ if (c->prompt_inputcb != cmd_command_prompt_callback)
return (1);
return (0);
}