summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-set-environment.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-04-13 11:00:00 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-04-13 11:00:00 +0000
commit56530d4d9e327bc4c76b8b02290102a1fadfffb9 (patch)
treec902ce5f812b38436dec697a5fa08bf3615c0ed4 /usr.bin/tmux/cmd-set-environment.c
parent9947eee19da9830a3c591d7fb4574df8cdd144e6 (diff)
Also move cmdq_item and cmdq_list into cmd-queue.c (this is to make its
use more clearly defined and preparation for some future work).
Diffstat (limited to 'usr.bin/tmux/cmd-set-environment.c')
-rw-r--r--usr.bin/tmux/cmd-set-environment.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-set-environment.c b/usr.bin/tmux/cmd-set-environment.c
index b7ba371fdb4..1164d753ec8 100644
--- a/usr.bin/tmux/cmd-set-environment.c
+++ b/usr.bin/tmux/cmd-set-environment.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-environment.c,v 1.24 2020/04/13 08:26:27 nicm Exp $ */
+/* $OpenBSD: cmd-set-environment.c,v 1.25 2020/04/13 10:59:58 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -46,9 +46,10 @@ const struct cmd_entry cmd_set_environment_entry = {
static enum cmd_retval
cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item)
{
- struct args *args = cmd_get_args(self);
- struct environ *env;
- const char *name, *value, *target;
+ struct args *args = cmd_get_args(self);
+ struct cmd_find_state *target = cmdq_get_target(item);
+ struct environ *env;
+ const char *name, *value, *tflag;
name = args->argv[0];
if (*name == '\0') {
@@ -68,15 +69,15 @@ cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'g'))
env = global_environ;
else {
- if (item->target.s == NULL) {
- target = args_get(args, 't');
- if (target != NULL)
- cmdq_error(item, "no such session: %s", target);
+ if (target->s == NULL) {
+ tflag = args_get(args, 't');
+ if (tflag != NULL)
+ cmdq_error(item, "no such session: %s", tflag);
else
cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
}
- env = item->target.s->environ;
+ env = target->s->environ;
}
if (args_has(args, 'u')) {