Commit Graph

53 Commits

Author SHA1 Message Date
Mateusz Piotrowski
a4848c103c Document in the synopsis that -0 cannot be used with the utility argument 2020-11-11 14:53:03 +00:00
Mateusz Piotrowski
beb71006e7 Fix invalid use of macros and two typos
It turns out that currently mandoc(1) is not handling Fl in Ss
correctly (maybe it never was). Let's just replace "Fl S \&Ss ..."
with "-S ...". After all, this subsection title is stylized anyway, so Fl
is not that helpful.

MFC after:	2 weeks
2020-04-24 22:02:22 +00:00
Kyle Evans
85c8521e67 env(1): grow -L user/class and -U user/class options
This allows one to set the environment of the specified user either from
login.conf alone (-L) or both login.conf and ~/.login_conf if present (-U).

This is a supporting feature to allow service(8) to pull in the environment
of the "daemon" class before invoking the rc script.

This is a part of D21481.

Submitted by:	Andrew Gierth < andrew_tao173.riddles.org.uk>
2020-02-05 04:29:55 +00:00
Joseph Mingrone
5e5ceb11cb Add -0 option to ENV(1)
With the -0 option added to ENV(1), some ports will no longer require genv
from sysutils/coreutils.

Reviewed by:	kevans (prior version), swills
Approved by:	bcr (manpages), imp
Differential Revision:	https://reviews.freebsd.org/D22230
2019-11-07 17:14:59 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Baptiste Daroussin
95a27780e2 Escape Ss to avoid confusion by mdoc parser with the Ss macro
Reported by:	make manlint
MFC after:	2 days
2017-02-11 23:14:28 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Jilles Tjoelker
6ab1d4d9c3 env: Fix crash when -S string is not empty but no operand follows.
split_spaces() set argc in main() incorrectly, which caused trouble for
getopt().

Examples:
  env -S '\c'
  env -S -i

PR:		197769
MFC after:	1 week
2015-03-08 14:12:43 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Garance A Drosehn
3f8c1392ef Update the date on the man-page to reflect the date that the '-u name'
change was committed, instead of when I had first started writing it...
2008-05-06 16:06:02 +00:00
Garance A Drosehn
a414225db1 Add the '-u name' option to the env command, which will completely unset
the given variable name (removing it from the environment, instead of
just setting it to a null value).

PR:		bin/65649
MFC after:	2 weeks
2008-04-17 23:17:09 +00:00
Sean Farley
2966d28c32 Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
 - unsetenv returns an int.
 - putenv takes a char * instead of const char *.
 - putenv no longer makes a copy of the input string.
 - errno is set appropriately for POSIX.  Exceptions involve bad environ
   variable and internal initialization code.  These both set errno to
   EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit.  A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions.  It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR:		kern/99826
Approved by:	wes
Approved by:	re (kensmith)
2007-07-04 00:00:41 +00:00
Andrey A. Chernov
ba174a5e38 Back out all POSIXified *env() changes.
Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.
2007-05-01 16:02:44 +00:00
Andrey A. Chernov
ed4bcacfde env calls setenv("name=value", "value", 1); which violates POSIX:
"The setenv( ) function shall fail if:
[EINVAL] The name argument is a null pointer, points to an empty string,
or points to a string containing an '=' character."
The fix (like all others in this subject) is backward-compatible.
2007-04-30 19:25:00 +00:00
Garance A Drosehn
9afe6a5bf9 Fix minor memory leak when expanding ${variable}s
Noticed by:	Dave Hart
MFC plans:	after checking with re@
2005-07-18 22:18:16 +00:00
Garance A Drosehn
b5418f5134 Fix two minor parsing bugs in -S processing:
1) An unquoted space is always a separator, even when not "in_arg".
 2) When a new destination buffer must be allocated during variable
    substitution, only copy data from the active buffer to the new
    one when we *are* "in_arg".
These were noticed when testing variable-substitution of variables
which have null values, and are not inside quoted strings...

MFC plans:	after a few days, and re@ approval...
2005-07-13 15:56:30 +00:00
Ruslan Ermilov
5dea8a444f Tidy up the markup.
Approved by:	re (blanket)
OK'ed by:	gad
2005-06-22 19:04:07 +00:00
Garance A Drosehn
530aafd4d0 Fix a bug where the value of ${SOMEVAR} would simply disappear if there
was a separator character immediately before it.  This wasn't likely to
happen in #-lines, but we might as well get it right.  Also fix it so
that "" and "" will create a zero-length argument.

Approved by:	re (blanket `env')
2005-06-21 21:37:53 +00:00
Garance A Drosehn
68ef20722d Put in a more descriptive heading for the `env' command.
Noticed by:	Matthew D Fuller
Approved by:	re (blanket `env')
2005-06-21 19:45:02 +00:00
Garance A Drosehn
2f739d3c1a Undo r1.14 to env.c. While it is unusual for environment variables to
start with a '/', they are more supported (by POSIX and SUSv3) than
filenames which have an '=' in them.

Noticed by:	tjr
Approved by:	re (blanket `env')
2005-06-21 19:38:26 +00:00
Garance A Drosehn
8fbe7ebf7d Add the '-S' and '-P' options. The '-S' option can be used to split
apart a string, and supports some text substitutions.  This can be
used to provide all the flexibility (and more!) that was lost by recent
changes to how the kernel parses #!-lines in shell scripts.

The '-P' option provides a way to specify an alternate set of directories
to use when searching for the 'utility' program to run.  This way you can
be sure what directories are used for that search, without changing the
value of PATH that the user has set.  Note that on FreeBSD 6.0, this
option is worthless unless the '-S' option is also used.

Approved by:	re (blanket `env')
2005-06-20 03:43:25 +00:00
Garance A Drosehn
6dcd6cac03 If the `utility' specified starts with a '/' character, then execute it
without checking it for an equals-sign.  If it starts with a slash, then
it cannot be a request to set the value of a valid environment variable.

Approved by:	re (blanket `env')
2005-06-20 03:14:29 +00:00
Garance A Drosehn
212274c3b6 Move the code that clears the environment when `-i' is specified, so it that
it does not happen until all single-letter options are processed.  This will
be important for the -S option, which will be coming soon.

Approved by:	re (blanket `env')
2005-06-20 03:09:49 +00:00
Garance A Drosehn
f66e378b5e Add a '-v' option to `env', to make it easier to discover exactly what steps
it is doing, and what order it does them.  This will be much more useful as
more options are added.

Approved by:	re (blanket `env')
2005-06-20 03:06:54 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov
607e48e7b5 Language and markup polishing. 2004-05-19 10:44:24 +00:00
Jens Schweikhardt
ec6001d98e Fix grammar bogon. 2004-02-29 12:52:21 +00:00
Ruslan Ermilov
52964a40af Removed (after the env(1)/printenv(1) split) extraneous arguments
to the .Nm macro.
2003-11-02 21:46:11 +00:00
Tim J. Robbins
14f566d3ca Split the env(1) manpage off from printenv(1); there is not much point
in keeping them together. Mention that printenv is obsolescent.
2003-06-01 06:29:47 +00:00
David Malone
f4ac32def2 ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
Tim J. Robbins
6ec9d03768 Discourage use of env(1)'s "-" flag by moving its description to the
Compatibility section of the manual page.
2002-06-28 09:23:39 +00:00
Tim J. Robbins
7e949b63e4 Indicate that env(1) allows you to supply arguments to the utility it
executes in the usage() message and manual page. Use "utility" instead of
"command" in both places to emphasise that shell builtins etc. will not work,
and to be consistent with the terminology used by POSIX.

PR:		39210
Submitted by:	Danny J. Zerkel <dzerkel@columbus.rr.com>
MFC after:	1 week
2002-06-19 07:09:44 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
Mike Barcroft
064692095c Leave the `copyright' variable exposed, since the main purpose of it
is to put a copyright in the object file.

Submitted by:	bde
2002-03-07 10:06:00 +00:00
Mike Barcroft
603460a71c Use new ID scheme.
Fix env(1)'s exit status to conform with SUSv3.

Submitted by:	Tim Robbins <tim@robbins.dropbear.id.au>
MFC after:	2 weeks
2002-02-21 02:17:57 +00:00
Mark Murray
91bd71d206 Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
Dima Dorfman
f6751868e4 Set WARNS=2 on programs that compile cleanly with it; add $FreeBSD$
where necessary.

Submitted by:	Mike Barcroft <mike@q9media.com>
2001-06-30 05:39:36 +00:00
Sheldon Hearn
85ab7ba1e0 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
1999-08-27 08:59:32 +00:00
Archie Cobbs
fa146c5335 Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00