diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-03-04 22:26:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-03-04 22:26:15 +0000 |
commit | 5f7a1f1f2f20f07706275c9270f2f4ed0eb61d7a (patch) | |
tree | c5b661da3bd3dd07face32df7e68c37a9334cc53 | |
parent | 826d0b5c3deef513a4053342382a149ff844d004 (diff) | |
download | gnunet-5f7a1f1f2f20f07706275c9270f2f4ed0eb61d7a.tar.gz gnunet-5f7a1f1f2f20f07706275c9270f2f4ed0eb61d7a.zip |
-adding GNUNET_CONFIGURATION_load_from
-rw-r--r-- | src/include/gnunet_configuration_lib.h | 13 | ||||
-rw-r--r-- | src/util/configuration.c | 19 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index f8f302a18..0fcb4e054 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -87,6 +87,19 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
87 | 87 | ||
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Load default configuration. This function will parse the | ||
91 | * defaults from the given defaults_d directory. | ||
92 | * | ||
93 | * @param cfg configuration to update | ||
94 | * @param defaults_d directory with the defaults | ||
95 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
96 | */ | ||
97 | int | ||
98 | GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, | ||
99 | const char *defaults_d); | ||
100 | |||
101 | |||
102 | /** | ||
90 | * Parse a configuration file, add all of the options in the | 103 | * Parse a configuration file, add all of the options in the |
91 | * file to the configuration environment. | 104 | * file to the configuration environment. |
92 | * | 105 | * |
diff --git a/src/util/configuration.c b/src/util/configuration.c index f24b2c2c6..6ec9a7183 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -1236,6 +1236,25 @@ parse_configuration_file (void *cls, const char *filename) | |||
1236 | 1236 | ||
1237 | 1237 | ||
1238 | /** | 1238 | /** |
1239 | * Load default configuration. This function will parse the | ||
1240 | * defaults from the given defaults_d directory. | ||
1241 | * | ||
1242 | * @param cfg configuration to update | ||
1243 | * @param defaults_d directory with the defaults | ||
1244 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
1245 | */ | ||
1246 | int | ||
1247 | GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1248 | const char *defaults_d) | ||
1249 | { | ||
1250 | if (GNUNET_SYSERR == | ||
1251 | GNUNET_DISK_directory_scan (defaults_d, &parse_configuration_file, cfg)) | ||
1252 | return GNUNET_SYSERR; /* no configuration at all found */ | ||
1253 | return GNUNET_OK; | ||
1254 | } | ||
1255 | |||
1256 | |||
1257 | /** | ||
1239 | * Load configuration (starts with defaults, then loads | 1258 | * Load configuration (starts with defaults, then loads |
1240 | * system-specific configuration). | 1259 | * system-specific configuration). |
1241 | * | 1260 | * |