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;
{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. */
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)
{
}
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);
+}
#include "version.h"
#include "error.h"
-static void usage (int status);
-
/* The name this program was run with. */
char *program_name;
{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)
{
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);
-}
-