Author: tjansen Date: Thu Oct 8 12:03:53 2009 New Revision: 1047 Log: Honor the -f command line option again in all daemons. {c,s,n}dconf_init has to be called before {c,s,n}d_get_cmdargs. init sets all fields to 0 or an empty string. get_cmdargs will then fill in all fields that are given in the command line. Command line options that are also read from the config file may be overwritten by the config settings. Modified: trunk/pisacd/cdmain.c trunk/pisand/ndmain.c trunk/pisasd/sdmain.c Modified: trunk/pisacd/cdmain.c ============================================================================== --- trunk/pisacd/cdmain.c Thu Oct 8 11:33:52 2009 (r1046) +++ trunk/pisacd/cdmain.c Thu Oct 8 12:03:53 2009 (r1047) @@ -153,11 +153,13 @@ signal(SIGBUS, cd_quit); signal(SIGALRM, cd_handle_sigalarm); + /* Set default values in context and config */ cdctx_init(&cd_ctx); + cdconf_init(&cd_cfg); /* Receive and parse command line arguments. * Note that command line args must be obtained before calling any - * cdconf_* operations. */ + * cdconf_* operations except for cdconf_init. */ cd_get_cmdargs(argc, argv); if (pisa_make_hipd_run() < 0) { @@ -166,9 +168,6 @@ exit(EXIT_FAILURE); } - /* Initialize general client daemon configurations */ - cdconf_init(&cd_cfg); - #ifdef CONFIG_PISA_PERFORMANCE cd_perf_init(); #endif Modified: trunk/pisand/ndmain.c ============================================================================== --- trunk/pisand/ndmain.c Thu Oct 8 11:33:52 2009 (r1046) +++ trunk/pisand/ndmain.c Thu Oct 8 12:03:53 2009 (r1047) @@ -137,11 +137,13 @@ signal(SIGSEGV, nd_quit); signal(SIGALRM, nd_handle_sigalarm); + /* Set default values in context and config */ ndctx_init(&nd_ctx); + ndconf_init(&nd_cfg); /* Receive and parse command line arguments. * Note that command line args must be obtained before calling any - * ndconf_* operations. */ + * ndconf_* operations except for ndconf_init. */ nd_get_cmdargs(argc, argv); if (pisa_make_hipd_run() < 0) { @@ -150,9 +152,6 @@ exit(EXIT_FAILURE); } - /* Initialize general neighbor daemon configurations */ - ndconf_init(&nd_cfg); - nd_perf_init(); /* fork in case of background running mode */ Modified: trunk/pisasd/sdmain.c ============================================================================== --- trunk/pisasd/sdmain.c Thu Oct 8 11:33:52 2009 (r1046) +++ trunk/pisasd/sdmain.c Thu Oct 8 12:03:53 2009 (r1047) @@ -173,11 +173,13 @@ signal(SIGBUS, sd_quit); signal(SIGALRM, sd_handle_sigalarm); + /* Set default values in context and config */ sdctx_init(&sd_ctx); + sdconf_init(&sd_cfg); /* Receive and parse command line arguments. * Note that command line args must be obtained before calling any - * sdconf_* operations. */ + * sdconf_* operations except for sdconf_init. */ sd_get_cmdargs(argc, argv); if (pisa_make_hipd_run() < 0) { @@ -186,9 +188,6 @@ exit(EXIT_FAILURE); } - /* Initialize general server daemon configurations */ - sdconf_init(&sd_cfg); - sd_perf_init(); /* set the default or command line specified debug level */