diff options
author | Eric Blake <ebb9@byu.net> | 2009-10-27 06:36:40 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-10-27 19:55:35 -0600 |
commit | d6de2f198ef0f59f5210af0bf9bcf42687386a04 (patch) | |
tree | a1c5072f0b9aae40c24263d03e42ef92d81edbc9 /doc | |
parent | 1a813420896317aecf5598f76c852195796e534b (diff) | |
download | coreutils-d6de2f198ef0f59f5210af0bf9bcf42687386a04.tar.xz |
env, printenv: add -0/--null option
Allows for unambiguous processing when environment values (or even
non-portable names!) contain newline.
* src/env.c (longopts): Add new option.
(usage): Document it.
(main): Implement it.
* src/printenv.c (longopts): New variable.
(usage): Document new option.
(main): Implement it.
* doc/coreutils.texi (Common options): New macro optNull.
(du invocation, env invocation, printenv invocation): Use it.
* NEWS: Mention this.
* tests/misc/env-null: New test.
* tests/Makefile.am (TESTS): Run it.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/coreutils.texi | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 138cf0184..c5f5135b7 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -574,6 +574,18 @@ Do not treat the last operand specially when it is a directory or a symbolic link to a directory. @xref{Target directory}. @end macro +@macro optNull{cmd} +@item -0 +@opindex -0 +@itemx --null +@opindex --null +@cindex output @sc{nul}-byte-terminated lines +Output a zero byte (@acronym{ASCII} @sc{nul}) at the end of each line, +rather than a newline. This option enables other programs to parse the +output of @command{\cmd\} even when that output would contain data +with embedded newlines. +@end macro + @macro optSi @itemx --si @opindex --si @@ -10376,15 +10388,7 @@ Show the total for each directory (and file if --all) that is at most MAX_DEPTH levels down from the root of the hierarchy. The root is at level 0, so @code{du --max-depth=0} is equivalent to @code{du -s}. -@item -0 -@opindex -0 -@itemx --null -@opindex --null -@cindex output null-byte-terminated lines -Output a zero byte (@acronym{ASCII} @sc{nul}) at the end of each line, -rather than a newline. This option enables other programs to parse the -output of @command{du} even when that output would contain file names -with embedded newlines. +@optNull{du} @optSi @@ -12806,8 +12810,13 @@ If no @var{variable}s are specified, @command{printenv} prints the value of every environment variable. Otherwise, it prints the value of each @var{variable} that is set, and nothing for those that are not set. -The only options are a lone @option{--help} or @option{--version}. -@xref{Common options}. +The program accepts the following option. Also see @ref{Common options}. + +@table @samp + +@optNull{printenv} + +@end table @cindex exit status of @command{printenv} Exit status: @@ -14438,6 +14447,8 @@ Options must precede operands. @table @samp +@optNull{env} + @item -u @var{name} @itemx --unset=@var{name} @opindex -u |