Split the processing of options out of main().
This commit is contained in:
parent
08e09354b2
commit
cc1f6c10be
@ -14,6 +14,7 @@
|
||||
the return code was E_SUCCESS, fail_exit() wouldn't have exited. Fix
|
||||
the scope of #idef WITH_AUDIT.
|
||||
* src/groupadd.c: Avoid implicit brackets.
|
||||
* src/groupadd.c: Split the processing of options out of main().
|
||||
|
||||
2007-12-27 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
|
@ -353,34 +353,12 @@ static gid_t get_gid (const char *gidstr)
|
||||
}
|
||||
|
||||
/*
|
||||
* main - groupadd command
|
||||
* process_args - parse the command line options
|
||||
*
|
||||
* It will not return if an error is encountered.
|
||||
*/
|
||||
|
||||
int main (int argc, char **argv)
|
||||
static void process_args (int argc, char **argv)
|
||||
{
|
||||
#ifdef USE_PAM
|
||||
pam_handle_t *pamh = NULL;
|
||||
int retval;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_AUDIT
|
||||
audit_help_open ();
|
||||
#endif
|
||||
/*
|
||||
* Get my name so that I can use it to report errors.
|
||||
*/
|
||||
Prog = Basename (argv[0]);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
OPENLOG ("groupadd");
|
||||
|
||||
{
|
||||
/*
|
||||
* Parse the command line options.
|
||||
*/
|
||||
char *cp;
|
||||
int option_index = 0;
|
||||
int c;
|
||||
@ -441,7 +419,6 @@ int main (int argc, char **argv)
|
||||
usage ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oflg && !gflg) {
|
||||
usage ();
|
||||
@ -451,8 +428,39 @@ int main (int argc, char **argv)
|
||||
usage ();
|
||||
}
|
||||
|
||||
group_name = argv[argc - 1];
|
||||
group_name = argv[optind];
|
||||
|
||||
check_new_name ();
|
||||
}
|
||||
|
||||
/*
|
||||
* main - groupadd command
|
||||
*/
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
#ifdef USE_PAM
|
||||
pam_handle_t *pamh = NULL;
|
||||
int retval;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_AUDIT
|
||||
audit_help_open ();
|
||||
#endif
|
||||
/*
|
||||
* Get my name so that I can use it to report errors.
|
||||
*/
|
||||
Prog = Basename (argv[0]);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
OPENLOG ("groupadd");
|
||||
|
||||
/*
|
||||
* Parse the command line options.
|
||||
*/
|
||||
process_args (argc, argv);
|
||||
|
||||
#ifdef USE_PAM
|
||||
retval = PAM_SUCCESS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user