summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2012-04-19 11:00:45 -0400
committerSimo Sorce <idra@samba.org>2012-04-19 18:14:02 -0400
commit74510b059e6852d1491a4cb6eaa9cc7c2ed61fbf (patch)
tree049cdb7c75680f5ad458969d60eb1ccf37eae0c0
parente0f425ab2d49779d0abbc0756326f548ff1ee19b (diff)
downloadsamba-74510b059e6852d1491a4cb6eaa9cc7c2ed61fbf.tar.gz
samba-74510b059e6852d1491a4cb6eaa9cc7c2ed61fbf.tar.bz2
samba-74510b059e6852d1491a4cb6eaa9cc7c2ed61fbf.zip
loadparm: Add convenience function to return long integers
-rw-r--r--lib/param/loadparm.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 3ccf4668fc..d68d585617 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -1713,6 +1713,20 @@ static unsigned long lp_ulong(const char *s)
/**
* convenience routine to return unsigned long parameters.
*/
+static long lp_long(const char *s)
+{
+
+ if (!s) {
+ DEBUG(0,("lp_long(%s): is called with NULL!\n",s));
+ return -1;
+ }
+
+ return strtol(s, NULL, 0);
+}
+
+/**
+ * convenience routine to return unsigned long parameters.
+ */
static double lp_double(const char *s)
{
@@ -1840,6 +1854,17 @@ unsigned long lpcfg_parm_ulong(struct loadparm_context *lp_ctx,
return default_v;
}
+long lpcfg_parm_long(struct loadparm_context *lp_ctx,
+ struct loadparm_service *service, const char *type,
+ const char *option, long default_v)
+{
+ const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
+
+ if (value)
+ return lp_long(value);
+
+ return default_v;
+}
double lpcfg_parm_double(struct loadparm_context *lp_ctx,
struct loadparm_service *service, const char *type,