summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-confirm-before.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-confirm-before.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-confirm-before.c')
-rw-r--r--usr.bin/tmux/cmd-confirm-before.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-confirm-before.c b/usr.bin/tmux/cmd-confirm-before.c
index 9c8f127fc13..d60360a6d33 100644
--- a/usr.bin/tmux/cmd-confirm-before.c
+++ b/usr.bin/tmux/cmd-confirm-before.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-confirm-before.c,v 1.40 2020/04/13 18:59:41 nicm Exp $ */
+/* $OpenBSD: cmd-confirm-before.c,v 1.41 2020/04/13 20:51:57 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -42,7 +42,7 @@ const struct cmd_entry cmd_confirm_before_entry = {
.args = { "p:t:", 1, 1 },
.usage = "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
- .flags = 0,
+ .flags = CMD_CLIENT_TFLAG,
.exec = cmd_confirm_before_exec
};
@@ -55,13 +55,10 @@ cmd_confirm_before_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = cmd_get_args(self);
struct cmd_confirm_before_data *cdata;
- struct client *c;
+ struct client *tc = cmdq_get_target_client(item);
char *cmd, *copy, *new_prompt, *ptr;
const char *prompt;
- if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
- return (CMD_RETURN_ERROR);
-
if ((prompt = args_get(args, 'p')) != NULL)
xasprintf(&new_prompt, "%s ", prompt);
else {
@@ -74,9 +71,8 @@ cmd_confirm_before_exec(struct cmd *self, struct cmdq_item *item)
cdata = xmalloc(sizeof *cdata);
cdata->cmd = xstrdup(args->argv[0]);
- status_prompt_set(c, new_prompt, NULL,
- cmd_confirm_before_callback, cmd_confirm_before_free, cdata,
- PROMPT_SINGLE);
+ status_prompt_set(tc, new_prompt, NULL, cmd_confirm_before_callback,
+ cmd_confirm_before_free, cdata, PROMPT_SINGLE);
free(new_prompt);
return (CMD_RETURN_NORMAL);