diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2013-09-21 14:15:45 +0200 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2013-09-21 14:15:45 +0200 |
commit | 2a0d241f69f7f3f5b826656a97f9bafb20bd8711 (patch) | |
tree | 3e23194ad9215ceee6f4f6cb2158b4f925318ea3 /doc | |
parent | b3578fc9ffe70b9466687f9f6470a85f1a0ab14f (diff) | |
download | coreutils-2a0d241f69f7f3f5b826656a97f9bafb20bd8711.tar.xz |
id: add -z, --zero option
* src/group-list.h (print_group_list): Add a parameter for the
delimiter of type char.
* src/group-list.c (print_group_list): Likewise, and use it instead
of a white space character to delimit the group entries.
* src/groups.c (main): Pass white space character to print_group_list().
* src/id.c (longopts): Add array element for the new long option.
(usage): Document the new option. While at it, fix the alignment
of the descriptions to match that of HELP_OPTION_DESCRIPTION.
(main): Define the bool flag opt_zero indicating the use of the
new option. In the getopt_long loop, handle it.
Output an error diagnostic in the case the --zero option has been
specified together with the default format.
In the case of -gG, pass either a NUL or a white space character to
print_group_list() - depending on the above new flag.
Likewise change the printing of the final newline character: output
a NUL instead if the --zero option has been specified.
* doc/coreutils.texi (id invocation): Document the new option.
While at it, move the @exitstatus macro down after the macro
@primaryAndSupplementaryGroups in order to be consistent with
other texinfo documents.
(groups invocation): Move @exitstatus down after the macro
@primaryAndSupplementaryGroups here, too.
* tests/misc/id-zero.sh: Add new test exercising the new option.
* tests/local.mk (all_tests): Reference it.
* NEWS (New features): Mention the new option.
Fixes http://bugs.gnu.org/9987
Diffstat (limited to 'doc')
-rw-r--r-- | doc/coreutils.texi | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 21216b4be..d022c4560 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -14516,9 +14516,20 @@ Print only the security context of the current user. If SELinux is disabled then print a warning and set the exit status to 1. -@end table +@item -z +@itemx --zero +@opindex -z +@opindex --zero +Delimit output items with NUL characters. +This option is not permitted when using the default format. -@exitstatus +Example: +@example +$ id -Gn --zero +users <NUL> devs <NUL> +@end example + +@end table @macro primaryAndSupplementaryGroups{cmd,arg} Primary and supplementary groups for a process are normally inherited @@ -14530,6 +14541,8 @@ database to be consulted afresh, and so will give a different result. @end macro @primaryAndSupplementaryGroups{id,user argument} +@exitstatus + @node logname invocation @section @command{logname}: Print current login name @@ -14587,13 +14600,12 @@ groups [@var{username}]@dots{} The group lists are equivalent to the output of the command @samp{id -Gn}. -@primaryAndSupplementaryGroups{groups,list of users} - The only options are @option{--help} and @option{--version}. @xref{Common options}. -@exitstatus +@primaryAndSupplementaryGroups{groups,list of users} +@exitstatus @node users invocation @section @command{users}: Print login names of users currently logged in |