From 0119f629b3603e9635932b691fc31967ff085f7e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 17 Mar 2015 10:48:12 +0100 Subject: move TALER_CONFIG_get_denom into util lib --- src/util/util.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/util') diff --git a/src/util/util.c b/src/util/util.c index f2ff01d0f..5c1e5eb9a 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -29,6 +29,34 @@ #include +/** + * Obtain denomination amount from configuration file. + * + * @param section section of the configuration to access + * @param option option of the configuration to access + * @param denom[OUT] set to the amount found in configuration + * @return #GNUNET_OK on success, #GNUNET_SYSERR on error + */ +int +TALER_config_get_denom (struct GNUNET_CONFIGURATION_Handle *cfg, + const char *section, + const char *option, + struct TALER_Amount *denom) +{ + char *str; + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_string (cfg, + section, + option, + &str)) + return GNUNET_NO; + if (GNUNET_OK != TALER_string_to_amount (str, + denom)) + return GNUNET_SYSERR; + return GNUNET_OK; +} + /** * Load configuration by parsing all configuration -- cgit v1.2.3