History log of /src/usr.bin/env/env.c |
Revision | | Date | Author | Comments |
1.25 |
| 09-Feb-2025 |
kre | PR bin/59058 Random minor corrections
Use the correct exit status values (126 vs 127), the latter when the utility cannot be located (no matter why) and the former when it could be located, but an execvp() attempt failed for some other reason.
Use exit status 125 for all errors detected by env itself, which require that it exit, but no longer consider including the -0 option along with a utility name to be such an error. The -0 is useless in such a case, but just ignore it (just as also happens if -u options are given with -i, which makes all -u options meaningless). Using 125 rather than a low number (like 1, which it mostly used to be) should make it slightly easier to detect cases where env has failed, rather than the named utility having failed.
Write errors to stdout, and failure of putenv() are now detected and cause an error message and exit(125).
The -C option now (also) causes PWD to be removed from the environment (better than it retaining an invalid value). (Currently OLDPWD is left alone, better might be possible.)
Document all of that (and make it much clearer than when a utility is successfully invoked, the exit status, any value at all, comes from the utility, rather than pretending that utilities were only permitted to exit with status from 0..125.
More wording fixes and clarifications in the man page.
While there, delete the BUGS section, after implementing, and documenting, a mechanism to allow utility names to contain an '=' character (as useless as this change is likely to be in practice) - the implemented mechanism is extraordinarily simple (much simpler than this paragraph!)
|
1.24 |
| 28-Oct-2024 |
kim | Implement "env -C dir" to chdir
Use err(3) to expose errno(2) if chdir(2) (or unsetenv(3)) fails.
|
1.23 |
| 08-Feb-2020 |
kamil | branches: 1.23.8; 1.23.10; Implement env(1) -0
-0 End each output line with NUL, not newline.
FreeBSD and GNU env(1) implement -0 which is used in 3rd party scripts.
This change is based on the FreeBSD code.
|
1.22 |
| 08-Feb-2020 |
kamil | Add CVS Id tag and switch __attribute__ to __dead.
|
1.21 |
| 08-Feb-2020 |
kamil | Implement env(1) -u
The option '-u name' causes removal of the name environment variable if it is in the environment. This is similar to the unset command in sh(1). The value for name must not include the '=' character.
Add HISTORY section in the man page.
The -u argument is implemented by Linux, FreeBSD and Darwin. The lack of -u in NetBSD is a cause for a frequent fallout in the LLVM toolchain test-suite.
|
1.20 |
| 16-Nov-2010 |
christos | branches: 1.20.46; minor KNF nits.
|
1.19 |
| 16-Oct-2010 |
njoly | Do use putenv(3) to handle the provided strings directly, instead of setenv(3) which need string splitting and later reassembly.
|
1.18 |
| 15-Oct-2010 |
jschauma | remove duplicate 'was' in a comment
|
1.17 |
| 21-Jul-2008 |
lukem | Remove the \n and tabs from the __COPYRIGHT() strings. Tweak to use a consistent format.
|
1.16 |
| 04-Jan-2006 |
perry | branches: 1.16.22; de-__P, add ANSI prototypes, and a teeny bit of KNF.
|
1.15 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
|
1.14 |
| 05-Feb-2001 |
christos | fix nested extern
|
1.13 |
| 14-Apr-2000 |
simonb | Don't declare 'extern opt*' getopt variables.
|
1.12 |
| 02-Nov-1999 |
lukem | revert previous
|
1.11 |
| 02-Nov-1999 |
lukem | remove superfluous '-' in getopt string
|
1.10 |
| 18-Oct-1997 |
lukem | branches: 1.10.6; WARNSify, fix .Nm usage
|
1.9 |
| 07-May-1996 |
jtc | Include appropriate header files to bring prototypes into scope. Removed explicit errno declarations.
|
1.8 |
| 28-Sep-1995 |
perry | Merge and Sync with 4.4BSD-Lite2 Mostly looks like the previous NetBSD version, actually -- only minimal Lite2 stigmata preserved although I started with Lite2. Mostly the changes were things like index->strchr and the rest was NetBSD code.
|
1.7 |
| 31-Dec-1993 |
jtc | Provide prototypes in static function declarations.
|
1.6 |
| 19-Nov-1993 |
jtc | POSIX.2 utilities must call setlocale(LC_ALL, "");
|
1.5 |
| 10-Nov-1993 |
jtc | simplify error message handling by using err() function.
|
1.4 |
| 27-Aug-1993 |
jtc | Minor tweaks: including header files to bring prototypes into scope, explicitly declaring function return values, etc. to make gcc -Wall shut up.
|
1.3 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
1.2 |
| 14-Jul-1993 |
jtc | Make Posix 1003.2 (Draft 11.2) compliant.
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.2 |
| 28-Sep-1995 |
perry | imported from 44lite2
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.10.6.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.16.22.1 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.20.46.1 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.23.10.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|
1.23.8.1 |
| 01-Nov-2024 |
martin | Pull up following revision(s) (requested by kim in ticket #993):
usr.bin/env/env.1: revision 1.16 usr.bin/env/env.c: revision 1.24
Implement "env -C dir" to chdir
Use err(3) to expose errno(2) if chdir(2) (or unsetenv(3)) fails.
|