aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/env.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-02-07 16:23:03 -0600
committerRob Landley <rob@landley.net>2015-02-07 16:23:03 -0600
commitd57c23b2f33eb39cd4221b82ff6901a6e2a1ef2b (patch)
tree0eaa5873367d635fd68f97fc3caa90aed7daf3a2 /toys/posix/env.c
parentc0045207a7cd3bc11aace920d895c69b027c16af (diff)
downloadtoybox-d57c23b2f33eb39cd4221b82ff6901a6e2a1ef2b.tar.gz
Cleanup pass on env, removing exec_optargs().
Diffstat (limited to 'toys/posix/env.c')
-rw-r--r--toys/posix/env.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/toys/posix/env.c b/toys/posix/env.c
index 4e819f24..f20517eb 100644
--- a/toys/posix/env.c
+++ b/toys/posix/env.c
@@ -24,28 +24,17 @@ extern char **environ;
void env_main(void)
{
char **ev;
- char **command = NULL;
char *del = "=";
if (toys.optflags) clearenv();
for (ev = toys.optargs; *ev != NULL; ev++) {
- char *env, *val = NULL;
-
- env = strtok(*ev, del);
-
- if (env) val = strtok(NULL, del);
+ char *env = strtok(*ev, del), *val = 0;
+ if (env) val = strtok(0, del);
if (val) setenv(env, val, 1);
- else {
- command = ev;
- break;
- }
+ else xexec(ev);
}
- if (!command) {
- char **ep;
- if (environ) for (ep = environ; *ep; ep++) xputs(*ep);
- } else xexec_optargs(command - toys.optargs);
-
+ if (environ) for (ev = environ; *ev; ev++) xputs(*ev);
}