version 1.4, 2011/04/05 19:37:01 |
version 1.5, 2012/03/22 11:11:57 |
|
|
|
|
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, |
"gt:", 0, 1, |
"[-g] " CMD_TARGET_SESSION_USAGE, |
"[-g] " CMD_TARGET_SESSION_USAGE " [name]", |
0, |
0, |
NULL, |
NULL, |
NULL, |
NULL, |
|
|
if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) |
if ((s = cmd_find_session(ctx, args_get(args, 't'), 0)) == NULL) |
return (-1); |
return (-1); |
env = &s->environ; |
env = &s->environ; |
|
} |
|
|
|
if (args->argc != 0) { |
|
envent = environ_find(env, args->argv[0]); |
|
if (envent == NULL) { |
|
ctx->error(ctx, "unknown variable: %s", args->argv[0]); |
|
return (-1); |
|
} |
|
if (envent->value != NULL) |
|
ctx->print(ctx, "%s=%s", envent->name, envent->value); |
|
else |
|
ctx->print(ctx, "-%s", envent->name); |
|
return (0); |
} |
} |
|
|
RB_FOREACH(envent, environ, env) { |
RB_FOREACH(envent, environ, env) { |