summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-set-environment.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-10-16 19:04:06 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-10-16 19:04:06 +0000
commit3f0dad54b9b7fbe7e951cb592fa147fbdc7bdde6 (patch)
treea685fa2872c014d3bc9be168c7338d3974fcab39 /usr.bin/tmux/cmd-set-environment.c
parentf71299d662dee69becff6a71ecf049a77fbacd95 (diff)
Mass rename struct cmd_q to struct cmdq_item and related.
Diffstat (limited to 'usr.bin/tmux/cmd-set-environment.c')
-rw-r--r--usr.bin/tmux/cmd-set-environment.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/usr.bin/tmux/cmd-set-environment.c b/usr.bin/tmux/cmd-set-environment.c
index 9d3cf2ade1c..0690384b8ba 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.20 2016/10/14 22:14:22 nicm Exp $ */
+/* $OpenBSD: cmd-set-environment.c,v 1.21 2016/10/16 19:04:05 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -27,7 +27,8 @@
* Set an environment variable.
*/
-static enum cmd_retval cmd_set_environment_exec(struct cmd *, struct cmd_q *);
+static enum cmd_retval cmd_set_environment_exec(struct cmd *,
+ struct cmdq_item *);
const struct cmd_entry cmd_set_environment_entry = {
.name = "set-environment",
@@ -43,7 +44,7 @@ const struct cmd_entry cmd_set_environment_entry = {
};
static enum cmd_retval
-cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
+cmd_set_environment_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
struct environ *env;
@@ -51,11 +52,11 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
name = args->argv[0];
if (*name == '\0') {
- cmdq_error(cmdq, "empty variable name");
+ cmdq_error(item, "empty variable name");
return (CMD_RETURN_ERROR);
}
if (strchr(name, '=') != NULL) {
- cmdq_error(cmdq, "variable name contains =");
+ cmdq_error(item, "variable name contains =");
return (CMD_RETURN_ERROR);
}
@@ -67,32 +68,32 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
if (args_has(self->args, 'g'))
env = global_environ;
else {
- if (cmdq->state.tflag.s == NULL) {
+ if (item->state.tflag.s == NULL) {
target = args_get(args, 't');
if (target != NULL)
- cmdq_error(cmdq, "no such session: %s", target);
+ cmdq_error(item, "no such session: %s", target);
else
- cmdq_error(cmdq, "no current session");
+ cmdq_error(item, "no current session");
return (CMD_RETURN_ERROR);
}
- env = cmdq->state.tflag.s->environ;
+ env = item->state.tflag.s->environ;
}
if (args_has(self->args, 'u')) {
if (value != NULL) {
- cmdq_error(cmdq, "can't specify a value with -u");
+ cmdq_error(item, "can't specify a value with -u");
return (CMD_RETURN_ERROR);
}
environ_unset(env, name);
} else if (args_has(self->args, 'r')) {
if (value != NULL) {
- cmdq_error(cmdq, "can't specify a value with -r");
+ cmdq_error(item, "can't specify a value with -r");
return (CMD_RETURN_ERROR);
}
environ_clear(env, name);
} else {
if (value == NULL) {
- cmdq_error(cmdq, "no value specified");
+ cmdq_error(item, "no value specified");
return (CMD_RETURN_ERROR);
}
environ_set(env, name, "%s", value);