summaryrefslogtreecommitdiff
path: root/src/chgrp.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-11-09 23:31:16 +0000
committerJim Meyering <jim@meyering.net>1995-11-09 23:31:16 +0000
commitec2a94a41079f023443be393594d12e8315a706e (patch)
treeed8157f685a6f54560f868edbf373b9475489de9 /src/chgrp.c
parent4796ddfe368143bf7c89d98c8ff23a181dc542f1 (diff)
downloadcoreutils-ec2a94a41079f023443be393594d12e8315a706e.tar.xz
(main): Move to the end.
Remove most fwd dcls.
Diffstat (limited to 'src/chgrp.c')
-rw-r--r--src/chgrp.c140
1 files changed, 68 insertions, 72 deletions
diff --git a/src/chgrp.c b/src/chgrp.c
index c2a9e5a6b..0cc33c60d 100644
--- a/src/chgrp.c
+++ b/src/chgrp.c
@@ -53,11 +53,7 @@ char *savedir ();
char *xmalloc ();
char *xrealloc ();
-static int change_file_group (char *file, int group);
-static int change_dir_group (char *dir, int group, struct stat *statp);
-static void describe_change (char *file, int changed);
-static void parse_group (char *name, int *g);
-static void usage (int status);
+static int change_dir_group __P ((char *dir, int group, struct stat *statp));
/* The name the program was run with. */
char *program_name;
@@ -95,62 +91,16 @@ static struct option const long_options[] =
{0, 0, 0, 0}
};
-void
-main (int argc, char **argv)
-{
- int group;
- int errors = 0;
- int optc;
-
- program_name = argv[0];
- recurse = force_silent = verbose = changes_only = 0;
-
- while ((optc = getopt_long (argc, argv, "Rcfv", long_options, (int *) 0))
- != EOF)
- {
- switch (optc)
- {
- case 0:
- break;
- case 'R':
- recurse = 1;
- break;
- case 'c':
- verbose = 1;
- changes_only = 1;
- break;
- case 'f':
- force_silent = 1;
- break;
- case 'v':
- verbose = 1;
- break;
- default:
- usage (1);
- }
- }
-
- if (show_version)
- {
- printf ("chgrp - %s\n", version_string);
- exit (0);
- }
-
- if (show_help)
- usage (0);
-
- if (argc - optind <= 1)
- {
- error (0, 0, "too few arguments");
- usage (1);
- }
-
- parse_group (argv[optind++], &group);
-
- for (; optind < argc; ++optind)
- errors |= change_file_group (argv[optind], group);
+/* Tell the user the group name to which ownership of FILE
+ has been given; if CHANGED is zero, FILE was that group already. */
- exit (errors);
+static void
+describe_change (char *file, int changed)
+{
+ if (changed)
+ printf ("group of %s changed to %s\n", file, groupname);
+ else
+ printf ("group of %s retained as %s\n", file, groupname);
}
/* Set *G according to NAME. */
@@ -289,18 +239,6 @@ change_dir_group (char *dir, int group, struct stat *statp)
return errors;
}
-/* Tell the user the group name to which ownership of FILE
- has been given; if CHANGED is zero, FILE was that group already. */
-
-static void
-describe_change (char *file, int changed)
-{
- if (changed)
- printf ("group of %s changed to %s\n", file, groupname);
- else
- printf ("group of %s retained as %s\n", file, groupname);
-}
-
static void
usage (int status)
{
@@ -322,3 +260,61 @@ Change the group membership of each FILE to GROUP.\n\
}
exit (status);
}
+
+void
+main (int argc, char **argv)
+{
+ int group;
+ int errors = 0;
+ int optc;
+
+ program_name = argv[0];
+ recurse = force_silent = verbose = changes_only = 0;
+
+ while ((optc = getopt_long (argc, argv, "Rcfv", long_options, (int *) 0))
+ != EOF)
+ {
+ switch (optc)
+ {
+ case 0:
+ break;
+ case 'R':
+ recurse = 1;
+ break;
+ case 'c':
+ verbose = 1;
+ changes_only = 1;
+ break;
+ case 'f':
+ force_silent = 1;
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ default:
+ usage (1);
+ }
+ }
+
+ if (show_version)
+ {
+ printf ("chgrp - %s\n", version_string);
+ exit (0);
+ }
+
+ if (show_help)
+ usage (0);
+
+ if (argc - optind <= 1)
+ {
+ error (0, 0, "too few arguments");
+ usage (1);
+ }
+
+ parse_group (argv[optind++], &group);
+
+ for (; optind < argc; ++optind)
+ errors |= change_file_group (argv[optind], group);
+
+ exit (errors);
+}