summaryrefslogtreecommitdiff
path: root/lash.c
diff options
context:
space:
mode:
Diffstat (limited to 'lash.c')
-rw-r--r--lash.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/lash.c b/lash.c
index 22c56d4..28015cb 100644
--- a/lash.c
+++ b/lash.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)