summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-command-prompt.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-04-13 20:51:57 +0000
committernicm <nicm@openbsd.org>2020-04-13 20:51:57 +0000
commit035dc73d1aa2b06694f1c8fe08a74fa3650b6b4b (patch)
tree8f02eaf34f310252f3d53b5b224f63392f0b7810 /usr.bin/tmux/cmd-command-prompt.c
parentTry to send a DELETE message if the SA is reset with 'ikectl reset id'. (diff)
downloadwireguard-openbsd-035dc73d1aa2b06694f1c8fe08a74fa3650b6b4b.tar.xz
wireguard-openbsd-035dc73d1aa2b06694f1c8fe08a74fa3650b6b4b.zip
Make client -c and -t handling common in cmd-queue.c and try to be
clearer about whether the client is the target client (must have a session) or not.
Diffstat (limited to 'usr.bin/tmux/cmd-command-prompt.c')
-rw-r--r--usr.bin/tmux/cmd-command-prompt.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c
index 0cb37cddb48..b5eeed79c0d 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.50 2020/04/13 18:59:41 nicm Exp $ */
+/* $OpenBSD: cmd-command-prompt.c,v 1.51 2020/04/13 20:51:57 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -44,7 +44,7 @@ const struct cmd_entry cmd_command_prompt_entry = {
.usage = "[-1kiN] [-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " "
"[template]",
- .flags = 0,
+ .flags = CMD_CLIENT_TFLAG,
.exec = cmd_command_prompt_exec
};
@@ -65,16 +65,13 @@ static enum cmd_retval
cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
+ struct client *tc = cmdq_get_target_client(item);
const char *inputs, *prompts;
struct cmd_command_prompt_cdata *cdata;
- struct client *c;
char *prompt, *ptr, *input = NULL;
size_t n;
- if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
- return (CMD_RETURN_ERROR);
-
- if (c->prompt_string != NULL)
+ if (tc->prompt_string != NULL)
return (CMD_RETURN_NORMAL);
cdata = xcalloc(1, sizeof *cdata);
@@ -124,7 +121,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item)
cdata->flags |= PROMPT_INCREMENTAL;
else if (args_has(args, 'k'))
cdata->flags |= PROMPT_KEY;
- status_prompt_set(c, prompt, input, cmd_command_prompt_callback,
+ status_prompt_set(tc, prompt, input, cmd_command_prompt_callback,
cmd_command_prompt_free, cdata, cdata->flags);
free(prompt);