Mercurial > hg > toybox
changeset 510:45c10e86be43
Add copyright notice, fluff out help text, use xexec().
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 02 Mar 2012 20:18:02 -0600 |
parents | e7c742f78361 |
children | 15bad33d5ded |
files | toys/env.c |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/env.c Fri Mar 02 08:33:01 2012 -0600 +++ b/toys/env.c Fri Mar 02 20:18:02 2012 -0600 @@ -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 @@ 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 @@ 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); }