summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2004-08-19 20:03:26 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2004-08-19 20:03:26 +0000
commit958ae74efa5f954acad07330b006b732b69808f3 (patch)
treeeeb9ac8dd18664f525bc4feb61a07e07b5ca0757 /src
parent67d22815449380023fbbfc2da7b7ba4668c525e6 (diff)
downloadcoreutils-958ae74efa5f954acad07330b006b732b69808f3.tar.xz
(usage): "chown '' file" is now allowed.
(main): Do not set user name to the empty string if the group name is null.
Diffstat (limited to 'src')
-rw-r--r--src/chown.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/chown.c b/src/chown.c
index 9179ac914..785f941a2 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -92,11 +92,10 @@ usage (int status)
else
{
printf (_("\
-Usage: %s [OPTION]... OWNER[:[GROUP]] FILE...\n\
- or: %s [OPTION]... :GROUP FILE...\n\
+Usage: %s [OPTION]... [OWNER][:[GROUP]] FILE...\n\
or: %s [OPTION]... --reference=RFILE FILE...\n\
"),
- program_name, program_name, program_name);
+ program_name, program_name);
fputs (_("\
Change the owner and/or group of each FILE to OWNER and/or GROUP.\n\
With --reference, change the owner and group of each FILE to those of RFILE.\n\
@@ -146,8 +145,8 @@ one takes effect.\n\
fputs (_("\
\n\
Owner is unchanged if missing. Group is unchanged if missing, but changed\n\
-to login group if implied by a `:'. OWNER and GROUP may be numeric as well\n\
-as symbolic.\n\
+to login group if implied by a `:' following a symbolic OWNER.\n\
+OWNER and GROUP may be numeric as well as symbolic.\n\
"), stdout);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
@@ -313,8 +312,10 @@ main (int argc, char **argv)
if (e)
error (EXIT_FAILURE, 0, "%s: %s", quote (argv[optind]), e);
- /* FIXME: set it to the empty string? */
- if (chopt.user_name == NULL)
+ /* If a group is specified but no user, set the user name to the
+ empty string so that diagnostics say "ownership :GROUP"
+ rather than "group GROUP". */
+ if (!chopt.user_name && chopt.group_name)
chopt.user_name = "";
optind++;