- loglev = GNUNET_strdup ("WARNING");
- if ((-1 == (ret = GNUNET_GETOPT_run (binaryName,
- cc.cfg,
- allopts,
- (unsigned int) argc, argv))) ||
- ((GNUNET_OK !=
- GNUNET_log_setup (binaryName,
- loglev,
- NULL)) ||
- (GNUNET_OK != GNUNET_CONFIGURATION_load (cc.cfg, cc.cfgfile))))
-
- {
- GNUNET_free_non_null (cc.cfgfile);
- GNUNET_free (loglev);
- GNUNET_free (allopts);
- return GNUNET_SYSERR;
- }
+ loglev = NULL;
+ cc.cfgfile = GNUNET_strdup (GNUNET_DEFAULT_USER_CONFIG_FILE);
+ lpfx = GNUNET_strdup (binaryName);
+ if (NULL != (spc = strstr (lpfx, " ")))
+ *spc = '\0';
+ ret = GNUNET_GETOPT_run (binaryName, allopts, (unsigned int) argc, argv);
+ if ((GNUNET_OK > ret) ||
+ (GNUNET_OK != GNUNET_log_setup (lpfx, loglev, logfile)))
+ {
+ GNUNET_CONFIGURATION_destroy (cfg);
+ GNUNET_free_non_null (cc.cfgfile);
+ GNUNET_free_non_null (loglev);
+ GNUNET_free_non_null (logfile);
+ GNUNET_free (allopts);
+ GNUNET_free (lpfx);
+ return (ret == GNUNET_SYSERR) ? GNUNET_SYSERR : GNUNET_OK;
+ }
+ if (GNUNET_YES ==
+ GNUNET_DISK_file_test (cc.cfgfile))
+ (void) GNUNET_CONFIGURATION_load (cfg, cc.cfgfile);
+ else
+ {
+ (void) GNUNET_CONFIGURATION_load (cfg, NULL);
+ if (0 != strcmp (cc.cfgfile, GNUNET_DEFAULT_USER_CONFIG_FILE))
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Could not access configuration file `%s'\n"),
+ cc.cfgfile);
+ }