Add `-i'' option, which is the same as
`-''. The -i option is the
recommended option in the manpage, but the - option remains for backward compatibility and is documented as such. PR: 13363 Reported by: James Howard <howardjp@wam.umd.edu> Reviewed by: bde
This commit is contained in:
parent
43faa6dff6
commit
85ab7ba1e0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50444
5
usr.bin/env/env.c
vendored
5
usr.bin/env/env.c
vendored
@ -60,9 +60,10 @@ main(argc, argv)
|
|||||||
char *cleanenv[1];
|
char *cleanenv[1];
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "-")) != -1)
|
while ((ch = getopt(argc, argv, "-i")) != -1)
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case '-':
|
case '-':
|
||||||
|
case 'i':
|
||||||
environ = cleanenv;
|
environ = cleanenv;
|
||||||
cleanenv[0] = NULL;
|
cleanenv[0] = NULL;
|
||||||
break;
|
break;
|
||||||
@ -85,6 +86,6 @@ static void
|
|||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: env [-] [name=value ...] [command]\n");
|
"usage: env [-] [-i] [name=value ...] [command]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)printenv.1 8.1 (Berkeley) 6/6/93
|
.\" @(#)printenv.1 8.1 (Berkeley) 6/6/93
|
||||||
.\" $Id$
|
.\" $Id: printenv.1,v 1.3 1999/07/12 20:23:52 nik Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd June 6, 1993
|
.Dd June 6, 1993
|
||||||
.Dt PRINTENV 1
|
.Dt PRINTENV 1
|
||||||
@ -45,6 +45,7 @@
|
|||||||
.Op Ar name
|
.Op Ar name
|
||||||
.Nm env
|
.Nm env
|
||||||
.Op Fl
|
.Op Fl
|
||||||
|
.Op Fl i
|
||||||
.Op Ar name=value ...
|
.Op Ar name=value ...
|
||||||
.Op Ar command
|
.Op Ar command
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@ -72,12 +73,21 @@ an environment variable,
|
|||||||
.Ar name ,
|
.Ar name ,
|
||||||
with a value of
|
with a value of
|
||||||
.Ar value .
|
.Ar value .
|
||||||
The option
|
.Pp
|
||||||
.Sq Fl
|
The options are as follows:
|
||||||
causes
|
.Bl -tag -width indent
|
||||||
|
.It Fl i
|
||||||
|
Execute the
|
||||||
|
.Ar command
|
||||||
|
with only those environment values specified. The environment inherited
|
||||||
|
by
|
||||||
.Nm env
|
.Nm env
|
||||||
to completely ignore the environment
|
is ignored completely.
|
||||||
it inherits.
|
.It Fl
|
||||||
|
Identical to the
|
||||||
|
.Fl i
|
||||||
|
option, available for backward compatibility.
|
||||||
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If no command is specified,
|
If no command is specified,
|
||||||
.Nm env
|
.Nm env
|
||||||
|
Loading…
Reference in New Issue
Block a user