MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / crm_str_to_boolean

Function crm_str_to_boolean

lib/common/utils.c:589–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589int
590crm_str_to_boolean(const char *s, int *ret)
591{
592 if (s == NULL) {
593 return -1;
594
595 } else if (strcasecmp(s, "true") == 0
596 || strcasecmp(s, "on") == 0
597 || strcasecmp(s, "yes") == 0 || strcasecmp(s, "y") == 0 || strcasecmp(s, "1") == 0) {
598 *ret = TRUE;
599 return 1;
600
601 } else if (strcasecmp(s, "false") == 0
602 || strcasecmp(s, "off") == 0
603 || strcasecmp(s, "no") == 0 || strcasecmp(s, "n") == 0 || strcasecmp(s, "0") == 0) {
604 *ret = FALSE;
605 return 1;
606 }
607 return -1;
608}
609
610#ifndef NUMCHARS
611# define NUMCHARS "0123456789."

Callers 6

check_booleanFunction · 0.85
crm_is_trueFunction · 0.85
unpack_actionFunction · 0.85
common_unpackFunction · 0.85
group_unpackFunction · 0.85
unpack_simple_rsc_orderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected