aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/env.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-07-06 15:54:56 -0500
committerRob Landley <rob@landley.net>2019-07-06 15:54:56 -0500
commit6a63b625bfa2c0e86c18ccb5bdc71010e24c9829 (patch)
tree34e31ceefcf14059ef01131e9180912185a75905 /toys/posix/env.c
parent5822475e0d0be7825406c4f4197375a532fc831f (diff)
downloadtoybox-6a63b625bfa2c0e86c18ccb5bdc71010e24c9829.tar.gz
Add comment and test.
Diffstat (limited to 'toys/posix/env.c')
-rw-r--r--toys/posix/env.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/toys/posix/env.c b/toys/posix/env.c
index 01aa5ec4..19cd18a0 100644
--- a/toys/posix/env.c
+++ b/toys/posix/env.c
@@ -44,7 +44,11 @@ void env_main(void)
for (; *ev; ev++)
if (strchr(*ev, '=')) xsetenv(xstrdup(*ev), 0);
- else toys.stacktop = 0, xexec(ev);
+ else {
+ // a common use of env is to bypass shell builtins
+ toys.stacktop = 0;
+ xexec(ev);
+ }
for (ev = environ; *ev; ev++) xprintf("%s%c", *ev, '\n'*!FLAG(0));
}