summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/param/loadparm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index b98a75e441..9bcf9aada7 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -1017,6 +1017,20 @@ static int lp_ulong(const char *s)
}
/*******************************************************************
+convenience routine to return unsigned long parameters.
+********************************************************************/
+static double lp_double(const char *s)
+{
+
+ if (!s) {
+ DEBUG(0,("lp_double(%s): is called with NULL!\n",s));
+ return (-1);
+ }
+
+ return strtod(s, NULL);
+}
+
+/*******************************************************************
convenience routine to return boolean parameters.
********************************************************************/
static BOOL lp_bool(const char *s)
@@ -1112,6 +1126,17 @@ unsigned long lp_parm_ulong(int lookup_service, const char *type, const char *op
return default_v;
}
+
+double lp_parm_double(int lookup_service, const char *type, const char *option, double default_v)
+{
+ const char *value = lp_get_parametric(lookup_service, type, option);
+
+ if (value)
+ return lp_double(value);
+
+ return default_v;
+}
+
/* Return parametric option from a given service. Type is a part of option before ':' */
/* Parametric option has following syntax: 'Type: option = value' */