From 84e229cfbe00d27ce81dad66c982bec0d50cdfd7 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 29 Mar 2001 22:48:33 +0000 Subject: Add in a new standalone env applet for fixing up app's environments -Erik --- sh.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'sh.c') diff --git a/sh.c b/sh.c index 22c56d444..28015cbb3 100644 --- a/sh.c +++ b/sh.c @@ -143,7 +143,6 @@ struct close_me { /* function prototypes for builtins */ static int builtin_cd(struct child_prog *cmd); -static int builtin_env(struct child_prog *dummy); static int builtin_exec(struct child_prog *cmd); static int builtin_exit(struct child_prog *cmd); static int builtin_fg_bg(struct child_prog *cmd); @@ -203,7 +202,6 @@ static struct built_in_command bltins[] = { /* Table of forking built-in functions (things that fork cannot change global * variables in the parent process, such as the current working directory) */ static struct built_in_command bltins_forking[] = { - {"env", "Print all environment variables", builtin_env}, {"pwd", "Print current directory", builtin_pwd}, {"help", "List shell built-in commands", builtin_help}, {NULL, NULL, NULL} @@ -256,14 +254,13 @@ static inline void debug_printf(const char *format, ...) { } builtin previous use notes ------ ----------------- --------- cd cmd->progs[0] -env 0 exec cmd->progs[0] squashed bug: didn't look for applets or forking builtins exit cmd->progs[0] fg_bg cmd->progs[0], job_list->head, job_list->fg help 0 jobs job_list->head pwd 0 -export cmd->progs[0] passes cmd, job_list to builtin_env(), which ignores them +export cmd->progs[0] source cmd->progs[0] unset cmd->progs[0] read cmd->progs[0] @@ -302,17 +299,6 @@ static int builtin_cd(struct child_prog *child) return EXIT_SUCCESS; } -/* built-in 'env' handler */ -static int builtin_env(struct child_prog *dummy) -{ - char **e; - - for (e = environ; *e; e++) { - printf( "%s\n", *e); - } - return (0); -} - /* built-in 'exec' handler */ static int builtin_exec(struct child_prog *child) { @@ -436,7 +422,10 @@ static int builtin_export(struct child_prog *child) char *v = child->argv[1]; if (v == NULL) { - return (builtin_env(child)); + char **e; + for (e = environ; *e; e++) { + printf( "%s\n", *e); + } } res = putenv(v); if (res) -- cgit v1.2.3