diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-06-17 20:02:56 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:53:24 -0500 |
commit | fdbc8e29c7c87e415d7e43589234526722698bd6 (patch) | |
tree | d0286d8a159295ee0d3103c8d4dce6fa27ab5e07 | |
parent | 428373743a4c5fdde89daa6584dcfc67510319e5 (diff) | |
download | samba-fdbc8e29c7c87e415d7e43589234526722698bd6.tar.gz samba-fdbc8e29c7c87e415d7e43589234526722698bd6.tar.bz2 samba-fdbc8e29c7c87e415d7e43589234526722698bd6.zip |
r23532: added lp_parm_double()
(This used to be commit 524ba04b1f6996023886190eee8a226b08aafa35)
-rw-r--r-- | source4/param/loadparm.c | 25 |
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' */ |