main: add a config struct argument to process_cmdline.
Michael
This commit is contained in:
parent
8945d9f0ae
commit
a09dd9cd00
10
src/main.c
10
src/main.c
@ -196,7 +196,7 @@ get_id (char *str)
|
|||||||
* This function parses command line arguments.
|
* This function parses command line arguments.
|
||||||
**/
|
**/
|
||||||
static void
|
static void
|
||||||
process_cmdline (int argc, char **argv)
|
process_cmdline (int argc, char **argv, struct config_s *conf)
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
@ -211,12 +211,12 @@ process_cmdline (int argc, char **argv)
|
|||||||
exit (EX_OK);
|
exit (EX_OK);
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
config.godaemon = FALSE;
|
conf->godaemon = FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
config.config_file = safestrdup (optarg);
|
conf->config_file = safestrdup (optarg);
|
||||||
if (!config.config_file) {
|
if (!conf->config_file) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"%s: Could not allocate memory.\n",
|
"%s: Could not allocate memory.\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
@ -325,7 +325,7 @@ main (int argc, char **argv)
|
|||||||
umask (0177);
|
umask (0177);
|
||||||
|
|
||||||
initialize_config_defaults (&config);
|
initialize_config_defaults (&config);
|
||||||
process_cmdline (argc, argv);
|
process_cmdline (argc, argv, &config);
|
||||||
|
|
||||||
log_message (LOG_INFO, "Initializing " PACKAGE " ...");
|
log_message (LOG_INFO, "Initializing " PACKAGE " ...");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user