(main): Move to the end.
authorJim Meyering <jim@meyering.net>
Thu, 9 Nov 1995 23:31:16 +0000 (23:31 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 9 Nov 1995 23:31:16 +0000 (23:31 +0000)
Remove most fwd dcls.

src/chgrp.c
src/mkdir.c

index c2a9e5a..0cc33c6 100644 (file)
@@ -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);
+}
index 1b6a27c..6312bb3 100644 (file)
@@ -38,8 +38,6 @@
 #include "version.h"
 #include "error.h"
 
-static void usage (int status);
-
 /* The name this program was run with. */
 char *program_name;
 
@@ -62,6 +60,27 @@ static struct option const longopts[] =
   {NULL, 0, NULL, 0}
 };
 
+static void
+usage (int status)
+{
+  if (status != 0)
+    fprintf (stderr, "Try `%s --help' for more information.\n",
+            program_name);
+  else
+    {
+      printf ("Usage: %s [OPTION] DIRECTORY...\n", program_name);
+      printf ("\
+Create the DIRECTORY(ies), if they do not already exist.\n\
+\n\
+  -p, --parents     no error if existing, make parent directories as needed\n\
+  -m, --mode=MODE   set permission mode (as in chmod), not rwxrwxrwx - umask\n\
+      --help        display this help and exit\n\
+      --version     output version information and exit\n");
+    }
+  exit (status);
+}
+
+
 void
 main (int argc, char **argv)
 {
@@ -134,24 +153,3 @@ main (int argc, char **argv)
 
   exit (errors);
 }
-
-static void
-usage (int status)
-{
-  if (status != 0)
-    fprintf (stderr, "Try `%s --help' for more information.\n",
-            program_name);
-  else
-    {
-      printf ("Usage: %s [OPTION] DIRECTORY...\n", program_name);
-      printf ("\
-Create the DIRECTORY(ies), if they do not already exist.\n\
-\n\
-  -p, --parents     no error if existing, make parent directories as needed\n\
-  -m, --mode=MODE   set permission mode (as in chmod), not rwxrwxrwx - umask\n\
-      --help        display this help and exit\n\
-      --version     output version information and exit\n");
-    }
-  exit (status);
-}
-