From ee45a8a149e1a3c8fe7c232a9e32f3a007e21bee Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 22 Apr 2017 10:22:39 +0000 Subject: Get rid of the extra layer of flags and cmd_prepare() and just store the CMD_FIND_* flags in the cmd_entry and call it for the command. Commands with special requirements call it themselves and update the target for hooks to use. --- cmd-set-environment.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd-set-environment.c') diff --git a/cmd-set-environment.c b/cmd-set-environment.c index b3737e72..a80acd01 100644 --- a/cmd-set-environment.c +++ b/cmd-set-environment.c @@ -37,7 +37,7 @@ const struct cmd_entry cmd_set_environment_entry = { .args = { "grt:u", 1, 2 }, .usage = "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", - .tflag = CMD_SESSION_CANFAIL, + .target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL }, .flags = CMD_AFTERHOOK, .exec = cmd_set_environment_exec @@ -68,7 +68,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item) if (args_has(self->args, 'g')) env = global_environ; else { - if (item->state.tflag.s == NULL) { + if (item->target.s == NULL) { target = args_get(args, 't'); if (target != NULL) cmdq_error(item, "no such session: %s", target); @@ -76,7 +76,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item) cmdq_error(item, "no current session"); return (CMD_RETURN_ERROR); } - env = item->state.tflag.s->environ; + env = item->target.s->environ; } if (args_has(self->args, 'u')) { -- cgit v1.2.3