version 1.25, 2020/04/13 08:26:27 |
version 1.26, 2020/04/13 10:59:58 |
|
|
cmd_show_environment_exec(struct cmd *self, struct cmdq_item *item) |
cmd_show_environment_exec(struct cmd *self, struct cmdq_item *item) |
{ |
{ |
struct args *args = cmd_get_args(self); |
struct args *args = cmd_get_args(self); |
|
struct cmd_find_state *target = cmdq_get_target(item); |
struct environ *env; |
struct environ *env; |
struct environ_entry *envent; |
struct environ_entry *envent; |
const char *target; |
const char *tflag; |
|
|
if ((target = args_get(args, 't')) != NULL) { |
if ((tflag = args_get(args, 't')) != NULL) { |
if (item->target.s == NULL) { |
if (target->s == NULL) { |
cmdq_error(item, "no such session: %s", target); |
cmdq_error(item, "no such session: %s", tflag); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
} |
} |
|
|
if (args_has(args, 'g')) |
if (args_has(args, 'g')) |
env = global_environ; |
env = global_environ; |
else { |
else { |
if (item->target.s == NULL) { |
if (target->s == NULL) { |
target = args_get(args, 't'); |
tflag = args_get(args, 't'); |
if (target != NULL) |
if (tflag != NULL) |
cmdq_error(item, "no such session: %s", target); |
cmdq_error(item, "no such session: %s", tflag); |
else |
else |
cmdq_error(item, "no current session"); |
cmdq_error(item, "no current session"); |
return (CMD_RETURN_ERROR); |
return (CMD_RETURN_ERROR); |
} |
} |
env = item->target.s->environ; |
env = target->s->environ; |
} |
} |
|
|
if (args->argc != 0) { |
if (args->argc != 0) { |