aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-05-14 08:09:42 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-05-14 08:09:42 +0000
commit62b5f9d7d649be845774ed4d876deb586f538c74 (patch)
tree1869ac86111aab6ad27edbc521222d94c387ffa1 /src/util
parent745109bb6a59a312e118c3242ce4ed861566fe79 (diff)
downloadgnunet-62b5f9d7d649be845774ed4d876deb586f538c74.tar.gz
gnunet-62b5f9d7d649be845774ed4d876deb586f538c74.zip
adding function to read float from cfg
Diffstat (limited to 'src/util')
-rw-r--r--src/util/configuration.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 3d9281e8d..8444c2d7d 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -879,6 +879,33 @@ GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle
879 return GNUNET_OK; 879 return GNUNET_OK;
880} 880}
881 881
882/**
883 * Get a configuration value that should be a floating point number.
884 *
885 * @param cfg configuration to inspect
886 * @param section section of interest
887 * @param option option of interest
888 * @param number where to store the floating value of the option
889 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
890 */
891int
892GNUNET_CONFIGURATION_get_value_float (const struct GNUNET_CONFIGURATION_Handle
893 *cfg, const char *section,
894 const char *option,
895 float *number)
896{
897 struct ConfigEntry *e;
898
899 if (NULL == (e = find_entry (cfg, section, option)))
900 return GNUNET_SYSERR;
901 if (NULL == e->val)
902 return GNUNET_SYSERR;
903 if (1 != SSCANF (e->val, "%f", number))
904 return GNUNET_SYSERR;
905 return GNUNET_OK;
906}
907
908
882 909
883/** 910/**
884 * Get a configuration value that should be a relative time. 911 * Get a configuration value that should be a relative time.