version 1.12, 2015/10/28 09:51:55 |
version 1.13, 2015/12/13 14:32:38 |
|
|
"show-environment", "showenv", |
"show-environment", "showenv", |
"gst:", 0, 1, |
"gst:", 0, 1, |
"[-gs] " CMD_TARGET_SESSION_USAGE " [name]", |
"[-gs] " CMD_TARGET_SESSION_USAGE " [name]", |
0, |
CMD_SESSION_T, |
cmd_show_environment_exec |
cmd_show_environment_exec |
}; |
}; |
|
|
|
|
cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq) |
cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct session *s; |
|
struct environ *env; |
struct environ *env; |
struct environ_entry *envent; |
struct environ_entry *envent; |
|
|
if (args_has(self->args, 'g')) |
if (args_has(self->args, 'g')) |
env = global_environ; |
env = global_environ; |
else { |
else |
s = cmd_find_session(cmdq, args_get(args, 't'), 0); |
env = cmdq->state.tflag.s->environ; |
if (s == NULL) |
|
return (CMD_RETURN_ERROR); |
|
env = s->environ; |
|
} |
|
|
|
if (args->argc != 0) { |
if (args->argc != 0) { |
envent = environ_find(env, args->argv[0]); |
envent = environ_find(env, args->argv[0]); |