1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

r23532: added lp_parm_double()

(This used to be commit 524ba04b1f6996023886190eee8a226b08aafa35)
This commit is contained in:
Andrew Tridgell 2007-06-17 20:02:56 +00:00 committed by Gerald (Jerry) Carter
parent 428373743a
commit fdbc8e29c7

View File

@ -1016,6 +1016,20 @@ static int lp_ulong(const char *s)
return strtoul(s, NULL, 0);
}
/*******************************************************************
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.
********************************************************************/
@ -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' */