1 /* env.c - Set the environment for command invocation.
3 * Copyright 2012 Tryn Mirell <tryn@mirell.org>
5 * http://opengroup.org/onlinepubs/9699919799/utilities/env.html
7 USE_ENV(NEWTOY(env, "^iu*", TOYFLAG_USR|TOYFLAG_BIN))
13 usage: env [-i] [-u NAME] [NAME=VALUE...] [command [option...]]
15 Set the environment for command invocation.
17 -i Clear existing environment.
18 -u NAME Remove NAME from the environment
28 extern char **environ;
34 if (toys.optflags & FLAG_i) clearenv();
40 for (ev = toys.optargs; *ev; ev++) {
41 char *name = *ev, *val = strchr(name, '=');
49 if (environ) for (ev = environ; *ev; ev++) xputs(*ev);