summaryrefslogtreecommitdiffstats
path: root/cmd-confirm-before.c
diff options
context:
space:
mode:
authornicm <nicm>2020-04-13 20:51:57 +0000
committernicm <nicm>2020-04-13 20:51:57 +0000
commit3f7f9a0e20522c73e33480673496240f1bac724b (patch)
treec0ec19a026014bfd6981622ecd9ee2783344ef25 /cmd-confirm-before.c
parent187277eaadc4a675659bf7ede88f50bfe6cc7be9 (diff)
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 'cmd-confirm-before.c')
-rw-r--r--cmd-confirm-before.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index 026d0e11..0d881178 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -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);