case insensitive compare in boolean attributes (attr=false, attr=True, attr=FALSE, attr=1)
This commit is contained in:
parent
bf46fd3e7b
commit
2d11c5086c
|
|
@ -82,10 +82,10 @@ int my_strncasecmp(const char *s1, const char *s2, size_t n)
|
||||||
/* same as strcmp(), but allow "1" for "true" and "0" for "false" */
|
/* same as strcmp(), but allow "1" for "true" and "0" for "false" */
|
||||||
int strboolcmp(const char *str, const char *boolean)
|
int strboolcmp(const char *str, const char *boolean)
|
||||||
{
|
{
|
||||||
if(!strcmp(boolean, "true")) {
|
if(!my_strcasecmp(boolean, "true")) {
|
||||||
return (strcmp(str, "true") != 0 && strcmp(str,"1") != 0);
|
return (my_strcasecmp(str, "true") != 0 && strcmp(str,"1") != 0);
|
||||||
} else if(!strcmp(boolean, "false")) {
|
} else if(!my_strcasecmp(boolean, "false")) {
|
||||||
return (strcmp(str, "false") != 0 && strcmp(str,"0") != 0);
|
return (my_strcasecmp(str, "false") != 0 && strcmp(str,"0") != 0);
|
||||||
} else {
|
} else {
|
||||||
return strcmp(str, boolean);
|
return strcmp(str, boolean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue