Commit Graph

6 Commits

Author SHA1 Message Date
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
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
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
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
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