version 1.2, 2009/11/13 19:53:29 |
version 1.3, 2011/01/04 00:42:47 |
|
|
|
|
const struct cmd_entry cmd_show_environment_entry = { |
const struct cmd_entry cmd_show_environment_entry = { |
"show-environment", "showenv", |
"show-environment", "showenv", |
|
"gt:", 0, 0, |
"[-g] " CMD_TARGET_SESSION_USAGE, |
"[-g] " CMD_TARGET_SESSION_USAGE, |
0, "g", |
0, |
cmd_target_init, |
NULL, |
cmd_target_parse, |
NULL, |
cmd_show_environment_exec, |
cmd_show_environment_exec |
cmd_target_free, |
|
cmd_target_print |
|
}; |
}; |
|
|
int |
int |
cmd_show_environment_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_show_environment_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct cmd_target_data *data = self->data; |
struct args *args = self->args; |
struct session *s; |
struct session *s; |
struct environ *env; |
struct environ *env; |
struct environ_entry *envent; |
struct environ_entry *envent; |
|
|
if (cmd_check_flag(data->chflags, 'g')) |
if (args_has(self->args, 'g')) |
env = &global_environ; |
env = &global_environ; |
else { |
else { |
if ((s = cmd_find_session(ctx, data->target)) == NULL) |
if ((s = cmd_find_session(ctx, args_get(args, 't'))) == NULL) |
return (-1); |
return (-1); |
env = &s->environ; |
env = &s->environ; |
} |
} |