# HG changeset patch # User Rob Landley # Date 1330741082 21600 # Node ID 45c10e86be43f6befbe92043dc3a3699f33953a0 # Parent e7c742f78361d9795722e9981598343d9a87b6fa Add copyright notice, fluff out help text, use xexec(). diff -r e7c742f78361 -r 45c10e86be43 toys/env.c --- 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 * 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); }