+2006-09-26 Paul Eggert <eggert@cs.ucla.edu>
+
+ * NEWS: "groups user" no longer outputs "user :"; you need at least
+ two users. "groups" now processes options like --help more compatibly.
+ * src/groups.sh: Implement the option-processing change.
+ Handle user and group names with special characters more robustly.
+ Report write errors instead of exiting silently with status 1.
+
2006-09-26 Jim Meyering <jim@meyering.net>
* README: Warn not to run autoreconf manually. Use bootstrap instead.
With --verbose (-v), cp and mv would sometimes generate no output,
or neglect to report file removal.
- "groups user" now exits nonzero when it gets a write error.
+ For the "groups" command:
+ "groups" no longer prefixes the output with "user :" unless more
+ than one user is specified; this is for compatibility with BSD.
+
+ "groups user" now exits nonzero when it gets a write error.
+
+ "groups" now processes options like --help more compatibly.
* Major changes in release 6.2 (2006-09-18) [stable candidate]
+2006-09-26 Paul Eggert <eggert@cs.ucla.edu>
+
+ * coreutils.texi (groups invocation): "groups" no longer prefixes
+ the output with "user :" unless more than one user is specified.
+
2006-09-19 Paul Eggert <eggert@cs.ucla.edu>
* coreutils.texi (cp invocation): Say that -i and -f are
@command{groups} prints the names of the primary and any supplementary
groups for each given @var{username}, or the current process if no names
-are given. If names are given, the name of each user is printed before
+are given. If more than one name is given, the name of each user is
+printed before
the list of that user's groups. Synopsis:
@example
version='groups (@GNU_PACKAGE@) @VERSION@
Written by David MacKenzie.
-Copyright (C) 2004 Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'
-fail=0
-case $# in
- 1 )
- case "z${1}" in
- z--help )
- echo "$usage" || fail=1; exit $fail;;
- z--version )
- echo "$version" || fail=1; exit $fail;;
- * ) ;;
- esac
- ;;
- * ) ;;
-esac
+for arg
+do
+ case $arg in
+ --help | --hel | --he | --h)
+ exec echo "$usage" ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v)
+ exec echo "$version" ;;
+ --)
+ shift
+ break ;;
+ -*)
+ echo "$0: invalid option: $arg" >&2
+ exit 1 ;;
+ esac
+done
# With fewer than two arguments, simply exec "id".
case $# in
- 0|1) exec id -Gn "$@" ;;
+ 0|1) exec id -Gn -- "$@" ;;
esac
# With more, we need a loop, and be sure to exit nonzero upon failure.
-for name in "$@"; do
- if groups=`id -Gn -- $name`; then
- echo $name : $groups || fail=1
+status=0
+write_error=0
+
+for name
+do
+ if groups=`id -Gn -- "$name"`; then
+ echo "$name : $groups" || {
+ status=$?
+ if test $write_error = 0; then
+ echo "$0: write error" >&2
+ write_error=1
+ fi
+ }
else
- fail=1
+ status=$?
fi
done
-exit $fail
+
+exit $status