svn commit: samba r24602 - in branches: SAMBA_3_2/source/param
SAMBA_3_2_0/source/param
obnox at samba.org
obnox at samba.org
Tue Aug 21 14:47:18 GMT 2007
Author: obnox
Date: 2007-08-21 14:47:15 +0000 (Tue, 21 Aug 2007)
New Revision: 24602
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24602
Log:
Add function lp_string_is_valid_boolean() to check if a string
contains a correct representation of a boolean value (in the
understanding of loadparm.c).
Make set_boolean() catch passing NULL for the boolean target.
Michael
Modified:
branches/SAMBA_3_2/source/param/loadparm.c
branches/SAMBA_3_2_0/source/param/loadparm.c
Changeset:
Modified: branches/SAMBA_3_2/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_2/source/param/loadparm.c 2007-08-21 14:42:36 UTC (rev 24601)
+++ branches/SAMBA_3_2/source/param/loadparm.c 2007-08-21 14:47:15 UTC (rev 24602)
@@ -3087,26 +3087,42 @@
static BOOL set_boolean(BOOL *pb, const char *pszParmValue)
{
BOOL bRetval;
+ BOOL value;
bRetval = True;
if (strwicmp(pszParmValue, "yes") == 0 ||
strwicmp(pszParmValue, "true") == 0 ||
strwicmp(pszParmValue, "1") == 0)
- *pb = True;
+ value = True;
else if (strwicmp(pszParmValue, "no") == 0 ||
strwicmp(pszParmValue, "False") == 0 ||
strwicmp(pszParmValue, "0") == 0)
- *pb = False;
+ value = False;
else {
DEBUG(0,
("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
pszParmValue));
bRetval = False;
}
+
+ if (pb != NULL) {
+ *pb = value;
+ }
+
return (bRetval);
}
+
/***************************************************************************
+ Check if a given string correctly represents a boolean value.
+***************************************************************************/
+
+BOOL lp_string_is_valid_boolean(const char *parm_value)
+{
+ return set_boolean(NULL, parm_value);
+}
+
+/***************************************************************************
Get the standard string representation of a boolean value ("yes" or "no")
***************************************************************************/
Modified: branches/SAMBA_3_2_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_2_0/source/param/loadparm.c 2007-08-21 14:42:36 UTC (rev 24601)
+++ branches/SAMBA_3_2_0/source/param/loadparm.c 2007-08-21 14:47:15 UTC (rev 24602)
@@ -3092,26 +3092,42 @@
static BOOL set_boolean(BOOL *pb, const char *pszParmValue)
{
BOOL bRetval;
+ BOOL value;
bRetval = True;
if (strwicmp(pszParmValue, "yes") == 0 ||
strwicmp(pszParmValue, "true") == 0 ||
strwicmp(pszParmValue, "1") == 0)
- *pb = True;
+ value = True;
else if (strwicmp(pszParmValue, "no") == 0 ||
strwicmp(pszParmValue, "False") == 0 ||
strwicmp(pszParmValue, "0") == 0)
- *pb = False;
+ value = False;
else {
DEBUG(0,
("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
pszParmValue));
bRetval = False;
}
+
+ if (pb != NULL) {
+ *pb = value;
+ }
+
return (bRetval);
}
+
/***************************************************************************
+ Check if a given string correctly represents a boolean value.
+***************************************************************************/
+
+BOOL lp_string_is_valid_boolean(const char *parm_value)
+{
+ return set_boolean(NULL, parm_value);
+}
+
+/***************************************************************************
Get the standard string representation of a boolean value ("yes" or "no")
***************************************************************************/
More information about the samba-cvs
mailing list