Add mandoc-manpage for env(1)

and mark it as finished in the README.
This commit is contained in:
FRIGN 2015-01-24 00:22:06 +01:00
parent 22c6502b67
commit 616379f8ca
3 changed files with 47 additions and 42 deletions

2
README
View File

@ -27,7 +27,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
=* dirname yes none =* dirname yes none
= du no -H, -L, (-x) = du no -H, -L, (-x)
=* echo yes none =* echo yes none
= env yes none =* env yes none
# expand yes none # expand yes none
expr yes none expr yes none
=* false yes none =* false yes none

85
env.1
View File

@ -1,41 +1,46 @@
.TH ENV 1 sbase\-VERSION .Dd January 24, 2015
.SH NAME .Dt ENV 1 sbase\-VERSION
env \- modify the environment, then print it or run a command. .Sh NAME
.SH SYNOPSIS .Nm env
.B env .Nd modify the environment, then print it or run a command
.RB [ \-i ] .Sh SYNOPSIS
.RB [ \-u .Nm env
.IR name ]... .Op Fl i
.RI [ name=value ]... .Oo Fl u Ar variable Oc ...
.RI [ cmd .Oo Ar variable Ns = Ns Ar value Oc ...
.RI [ arg ...]] .Oo Ar cmd Oo arg ... Oc Oc
.Sh DESCRIPTION
.SH DESCRIPTION .Nm
.B env unsets each
removes part of the environment according to the flags, then adds or .Ar variable ,
sets each variable specified by then adds or sets each
.IR name .Ar ( variable , value )
to equal tuple in the environment.
.IR value . .Pp
If If
.IR cmd .Ar cmd
is given, it is executed in this new environment; otherwise, the is given, it is executed in this new environment;
modified environment is printed to standard out. otherwise, the modified environment is printed to stdout.
.Sh OPTIONS
.SH OPTIONS .Bl -tag -width Ds
.TP .It Fl i
.B \-i Completely ignore the existing environment and execute
Comptetely ignore the existing environment; start fresh. .Ar cmd
only with each
.TP .Ar ( variable , value )
.B \-u name specified.
Unsets .El
.IR name .Sh SEE ALSO
from the environment. .Xr printenv 1 ,
.Xr putenv 3 ,
.SH SEE ALSO .Xr environ 7
.IR printenv (1) .Sh STANDARDS
.IR putenv (3) The
.IR environ (7) .Nm
utility is compliant with the
.St -p1003.1-2008
specification.
.Pp
The
.Op Fl u
flag is an extension to that specification.

2
env.c
View File

@ -12,7 +12,7 @@ extern char **environ;
static void static void
usage(void) usage(void)
{ {
eprintf("usage: env [-i] [-u name]... [name=value]... [cmd [arg...]]\n"); eprintf("usage: env [-i] [-u variable] ... [variable=value] ... [cmd [arg ...]]\n");
} }
int int