diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-16 11:10:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-16 11:10:55 +0000 |
commit | d49d16a84422346630c3196e3de9727ea872371c (patch) | |
tree | b22d333f140a1476f793a76fec824c17ad4bccff /src | |
parent | 1d3dc794d9a5e82375995af14e91668430a31293 (diff) | |
download | gnunet-d49d16a84422346630c3196e3de9727ea872371c.tar.gz gnunet-d49d16a84422346630c3196e3de9727ea872371c.zip |
support overriding GNUNET_DEFAULT_USER_CONFIG_FILE
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_constants.h | 5 | ||||
-rw-r--r-- | src/include/gnunet_os_lib.h | 5 | ||||
-rw-r--r-- | src/util/os_installation.c | 2 | ||||
-rw-r--r-- | src/util/program.c | 2 | ||||
-rw-r--r-- | src/util/service.c | 2 |
5 files changed, 9 insertions, 7 deletions
diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index 747b8afd5..000def902 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h | |||
@@ -41,11 +41,6 @@ extern "C" | |||
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Last resort choice for configuration file name. | ||
45 | */ | ||
46 | #define GNUNET_DEFAULT_USER_CONFIG_FILE "~/.config/gnunet.conf" | ||
47 | |||
48 | /** | ||
49 | * Bandwidth (in/out) to assume initially (before either peer has | 44 | * Bandwidth (in/out) to assume initially (before either peer has |
50 | * communicated any particular preference). Should be rather low; set | 45 | * communicated any particular preference). Should be rather low; set |
51 | * so that at least one maximum-size message can be send roughly once | 46 | * so that at least one maximum-size message can be send roughly once |
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index 5785bd67f..d4893f906 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h | |||
@@ -255,6 +255,11 @@ struct GNUNET_OS_ProjectData | |||
255 | */ | 255 | */ |
256 | const char *config_file; | 256 | const char *config_file; |
257 | 257 | ||
258 | /** | ||
259 | * Configuration file name to use (if $XDG_CONFIG_HOME is not set). | ||
260 | */ | ||
261 | const char *user_config_file; | ||
262 | |||
258 | }; | 263 | }; |
259 | 264 | ||
260 | 265 | ||
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 8606d5c58..45f5052aa 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -60,6 +60,8 @@ static const struct GNUNET_OS_ProjectData default_pd = { | |||
60 | .env_varname = "GNUNET_PREFIX", | 60 | .env_varname = "GNUNET_PREFIX", |
61 | .bug_email = "gnunet-developers@gnu.org", | 61 | .bug_email = "gnunet-developers@gnu.org", |
62 | .homepage = "http://www.gnu.org/s/gnunet/", | 62 | .homepage = "http://www.gnu.org/s/gnunet/", |
63 | .config_file = "gnunet.conf", | ||
64 | .user_config_file = "~/.config/gnunet.conf" | ||
63 | }; | 65 | }; |
64 | 66 | ||
65 | /** | 67 | /** |
diff --git a/src/util/program.c b/src/util/program.c index a313ce87e..bf7885fe9 100644 --- a/src/util/program.c +++ b/src/util/program.c | |||
@@ -225,7 +225,7 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName, | |||
225 | DIR_SEPARATOR_STR, | 225 | DIR_SEPARATOR_STR, |
226 | GNUNET_OS_project_data_get ()->config_file); | 226 | GNUNET_OS_project_data_get ()->config_file); |
227 | else | 227 | else |
228 | cfg_fn = GNUNET_strdup (GNUNET_DEFAULT_USER_CONFIG_FILE); | 228 | cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); |
229 | lpfx = GNUNET_strdup (binaryName); | 229 | lpfx = GNUNET_strdup (binaryName); |
230 | if (NULL != (spc = strstr (lpfx, " "))) | 230 | if (NULL != (spc = strstr (lpfx, " "))) |
231 | *spc = '\0'; | 231 | *spc = '\0'; |
diff --git a/src/util/service.c b/src/util/service.c index c7f965021..93a51f220 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1429,7 +1429,7 @@ GNUNET_SERVICE_run (int argc, char *const *argv, | |||
1429 | DIR_SEPARATOR_STR, | 1429 | DIR_SEPARATOR_STR, |
1430 | GNUNET_OS_project_data_get ()->config_file); | 1430 | GNUNET_OS_project_data_get ()->config_file); |
1431 | else | 1431 | else |
1432 | cfg_fn = GNUNET_strdup (GNUNET_DEFAULT_USER_CONFIG_FILE); | 1432 | cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); |
1433 | memset (&sctx, 0, sizeof (sctx)); | 1433 | memset (&sctx, 0, sizeof (sctx)); |
1434 | sctx.options = options; | 1434 | sctx.options = options; |
1435 | sctx.ready_confirm_fd = -1; | 1435 | sctx.ready_confirm_fd = -1; |