aboutsummaryrefslogtreecommitdiff
path: root/toys/env.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-03-02 20:18:02 -0600
committerRob Landley <rob@landley.net>2012-03-02 20:18:02 -0600
commit52265e9d360caa10d61ab9689424dc19225a04fd (patch)
treea61dfe19e9139b8c9670694593831805c8af232c /toys/env.c
parent03a8f7430ebe694602646873371fdf067b735eb9 (diff)
downloadtoybox-52265e9d360caa10d61ab9689424dc19225a04fd.tar.gz
Add copyright notice, fluff out help text, use xexec().
Diffstat (limited to 'toys/env.c')
-rw-r--r--toys/env.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/toys/env.c b/toys/env.c
index b23d98a0..7cda85f9 100644
--- a/toys/env.c
+++ b/toys/env.c
@@ -1,4 +1,8 @@
/* vi: set sw=4 ts=4:
+ *
+ * env.c - Set the environment for command invocation.
+ *
+ * Copyright 2012 Tryn Mirell <tryn@mirell.org>
* env.c
USE_ENV(NEWTOY(env, "^i", TOYFLAG_USR|TOYFLAG_BIN))
@@ -7,9 +11,11 @@ config ENV
bool "env"
default y
help
- usage: env [-i] [FOO=BAR...] [command [option...]]
+ usage: env [-i] [NAME=VALUE...] [command [option...]]
- Set the environment for command invocation
+ Set the environment for command invocation.
+
+ -i Clear existing environment.
*/
#include "toys.h"
@@ -40,8 +46,7 @@ void env_main(void)
if (!command) {
char **ep;
- for (ep = environ; *ep; ep++)
- xputs(*ep);
+ for (ep = environ; *ep; ep++) xputs(*ep);
return;
- } else execvp(*command, command);
+ } else xexec(command);
}