summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-28 14:55:25 +0100
committerChristian Grothoff <christian@grothoff.org>2015-01-28 14:55:25 +0100
commit49d4f24f8d031a9301676196bd6a17ea3e54cb62 (patch)
tree3bb4e1a73fff39eaf68839bba723be63f3ace6ad /src/util
parentea3fac606311d1c14362d387960a4913182b629e (diff)
downloadexchange-49d4f24f8d031a9301676196bd6a17ea3e54cb62.tar.gz
exchange-49d4f24f8d031a9301676196bd6a17ea3e54cb62.tar.bz2
exchange-49d4f24f8d031a9301676196bd6a17ea3e54cb62.zip
misc cleanup, moving TALER_MINT_config_load to libtalerutil
Diffstat (limited to 'src/util')
-rw-r--r--src/util/util.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/util/util.c b/src/util/util.c
index 440b49fab..de085d088 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -16,7 +16,7 @@
/**
* @file util.c
- * @brief Common utility functions
+ * @brief Common utility functions; we might choose to move those to GNUnet at some point
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
* @author Florian Dold
* @author Benedikt Mueller
@@ -60,4 +60,33 @@ TALER_data_to_string_alloc (const void *buf, size_t size)
}
+/**
+ * Load configuration by parsing all configuration
+ * files in the given directory.
+ *
+ * @param base_dir directory with the configuration files
+ * @return NULL on error, otherwise configuration
+ */
+struct GNUNET_CONFIGURATION_Handle *
+TALER_config_load (const char *base_dir)
+{
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+ char *cfg_dir;
+ int res;
+
+ res = GNUNET_asprintf (&cfg_dir,
+ "%s" DIR_SEPARATOR_STR "config",
+ base_dir);
+ GNUNET_assert (res > 0);
+ cfg = GNUNET_CONFIGURATION_create ();
+ res = GNUNET_CONFIGURATION_load_from (cfg, cfg_dir);
+ GNUNET_free (cfg_dir);
+ if (GNUNET_OK != res)
+ return NULL;
+ return cfg;
+}
+
+
+
+
/* end of util.c */