summaryrefslogtreecommitdiff
path: root/src/chown.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chown.c')
-rw-r--r--src/chown.c174
1 files changed, 87 insertions, 87 deletions
diff --git a/src/chown.c b/src/chown.c
index 00cdb242b..35488d90e 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -85,14 +85,14 @@ usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
- program_name);
+ program_name);
else
{
printf (_("\
Usage: %s [OPTION]... [OWNER][:[GROUP]] FILE...\n\
or: %s [OPTION]... --reference=RFILE FILE...\n\
"),
- 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\
@@ -152,7 +152,7 @@ Examples:\n\
%s root:staff /u Likewise, but also change its group to \"staff\".\n\
%s -hR root /u Change the owner of /u and subfiles to \"root\".\n\
"),
- program_name, program_name, program_name);
+ program_name, program_name, program_name);
emit_bug_reporting_address ();
}
exit (status);
@@ -193,86 +193,86 @@ main (int argc, char **argv)
chopt_init (&chopt);
while ((optc = getopt_long (argc, argv, "HLPRcfhv", long_options, NULL))
- != -1)
+ != -1)
{
switch (optc)
- {
- case 'H': /* Traverse command-line symlinks-to-directories. */
- bit_flags = FTS_COMFOLLOW | FTS_PHYSICAL;
- break;
-
- case 'L': /* Traverse all symlinks-to-directories. */
- bit_flags = FTS_LOGICAL;
- break;
-
- case 'P': /* Traverse no symlinks-to-directories. */
- bit_flags = FTS_PHYSICAL;
- break;
-
- case 'h': /* --no-dereference: affect symlinks */
- dereference = 0;
- break;
-
- case DEREFERENCE_OPTION: /* --dereference: affect the referent
- of each symlink */
- dereference = 1;
- break;
-
- case NO_PRESERVE_ROOT:
- preserve_root = false;
- break;
-
- case PRESERVE_ROOT:
- preserve_root = true;
- break;
-
- case REFERENCE_FILE_OPTION:
- reference_file = optarg;
- break;
-
- case FROM_OPTION:
- {
- char *u_dummy, *g_dummy;
- const char *e = parse_user_spec (optarg,
- &required_uid, &required_gid,
- &u_dummy, &g_dummy);
- if (e)
- error (EXIT_FAILURE, 0, "%s: %s", e, quote (optarg));
- break;
- }
-
- case 'R':
- chopt.recurse = true;
- break;
-
- case 'c':
- chopt.verbosity = V_changes_only;
- break;
-
- case 'f':
- chopt.force_silent = true;
- break;
-
- case 'v':
- chopt.verbosity = V_high;
- break;
-
- case_GETOPT_HELP_CHAR;
- case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
- default:
- usage (EXIT_FAILURE);
- }
+ {
+ case 'H': /* Traverse command-line symlinks-to-directories. */
+ bit_flags = FTS_COMFOLLOW | FTS_PHYSICAL;
+ break;
+
+ case 'L': /* Traverse all symlinks-to-directories. */
+ bit_flags = FTS_LOGICAL;
+ break;
+
+ case 'P': /* Traverse no symlinks-to-directories. */
+ bit_flags = FTS_PHYSICAL;
+ break;
+
+ case 'h': /* --no-dereference: affect symlinks */
+ dereference = 0;
+ break;
+
+ case DEREFERENCE_OPTION: /* --dereference: affect the referent
+ of each symlink */
+ dereference = 1;
+ break;
+
+ case NO_PRESERVE_ROOT:
+ preserve_root = false;
+ break;
+
+ case PRESERVE_ROOT:
+ preserve_root = true;
+ break;
+
+ case REFERENCE_FILE_OPTION:
+ reference_file = optarg;
+ break;
+
+ case FROM_OPTION:
+ {
+ char *u_dummy, *g_dummy;
+ const char *e = parse_user_spec (optarg,
+ &required_uid, &required_gid,
+ &u_dummy, &g_dummy);
+ if (e)
+ error (EXIT_FAILURE, 0, "%s: %s", e, quote (optarg));
+ break;
+ }
+
+ case 'R':
+ chopt.recurse = true;
+ break;
+
+ case 'c':
+ chopt.verbosity = V_changes_only;
+ break;
+
+ case 'f':
+ chopt.force_silent = true;
+ break;
+
+ case 'v':
+ chopt.verbosity = V_high;
+ break;
+
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+ default:
+ usage (EXIT_FAILURE);
+ }
}
if (chopt.recurse)
{
if (bit_flags == FTS_PHYSICAL)
- {
- if (dereference == 1)
- error (EXIT_FAILURE, 0,
- _("-R --dereference requires either -H or -L"));
- dereference = 0;
- }
+ {
+ if (dereference == 1)
+ error (EXIT_FAILURE, 0,
+ _("-R --dereference requires either -H or -L"));
+ dereference = 0;
+ }
}
else
{
@@ -283,9 +283,9 @@ main (int argc, char **argv)
if (argc - optind < (reference_file ? 1 : 2))
{
if (argc <= optind)
- error (0, 0, _("missing operand"));
+ error (0, 0, _("missing operand"));
else
- error (0, 0, _("missing operand after %s"), quote (argv[argc - 1]));
+ error (0, 0, _("missing operand after %s"), quote (argv[argc - 1]));
usage (EXIT_FAILURE);
}
@@ -293,8 +293,8 @@ main (int argc, char **argv)
{
struct stat ref_stats;
if (stat (reference_file, &ref_stats))
- error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
- quote (reference_file));
+ error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+ quote (reference_file));
uid = ref_stats.st_uid;
gid = ref_stats.st_gid;
@@ -304,13 +304,13 @@ main (int argc, char **argv)
else
{
const char *e = parse_user_spec (argv[optind], &uid, &gid,
- &chopt.user_name, &chopt.group_name);
+ &chopt.user_name, &chopt.group_name);
if (e)
error (EXIT_FAILURE, 0, "%s: %s", e, quote (argv[optind]));
/* 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". */
+ empty string so that diagnostics say "ownership :GROUP"
+ rather than "group GROUP". */
if (!chopt.user_name && chopt.group_name)
chopt.user_name = bad_cast ("");
@@ -322,14 +322,14 @@ main (int argc, char **argv)
static struct dev_ino dev_ino_buf;
chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
if (chopt.root_dev_ino == NULL)
- error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
- quote ("/"));
+ error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+ quote ("/"));
}
bit_flags |= FTS_DEFER_STAT;
ok = chown_files (argv + optind, bit_flags,
- uid, gid,
- required_uid, required_gid, &chopt);
+ uid, gid,
+ required_uid, required_gid, &chopt);
chopt_free (&chopt);