* src/groupadd.c: Avoid implicit brackets.
* src/groupadd.c: Split the processing and checking of options out of
main() (process_flags).
+ * src/groupadd.c: New function check_flags(). Split the validation of
+ options and arguments out of process_flags.
* src/groupadd.c: Add the parameters' names in the prototypes.
2007-12-27 Nicolas François <nicolas.francois@centraliens.net>
static void fail_exit (int code);
static gid_t get_gid (const char *gidstr);
static void process_flags (int argc, char **argv);
+static void check_flags (void);
static void check_perms (void);
/*
/*
* Check the flags consistency
*/
- if (oflg && !gflg) {
+ if (optind != argc - 1) {
usage ();
}
+ group_name = argv[optind];
- if (optind != argc - 1) {
+ check_flags ();
+}
+
+static void check_flags (void)
+{
+ /* -o does not make sense without -g */
+ if (oflg && !gflg) {
usage ();
}
- group_name = argv[optind];
-
check_new_name ();
/*