MCPcopy Create free account
hub / github.com/couchbase/forestdb / iniparser_getboolean

Function iniparser_getboolean

utils/iniparser.cc:823–838  ·  view source on GitHub ↗

-------------------------------------------------------------------------*/ @brief Get the string associated to a key, convert to a boolean @param d Dictionary to search @param key Key string to look for @param notfound Value to return in case of error @return integer This function queries a dictionary for a key. A key as read from an ini file is given as "section:key".

Source from the content-addressed store, hash-verified

821 */
822/*--------------------------------------------------------------------------*/
823int iniparser_getboolean(dictionary * d, char * key, int notfound)
824{
825 char * c ;
826 int ret ;
827
828 c = iniparser_getstring(d, key, INI_INVALID_KEY);
829 if (c==INI_INVALID_KEY) return notfound ;
830 if (c[0]=='y' || c[0]=='Y' || c[0]=='1' || c[0]=='t' || c[0]=='T') {
831 ret = 1 ;
832 } else if (c[0]=='n' || c[0]=='N' || c[0]=='0' || c[0]=='f' || c[0]=='F') {
833 ret = 0 ;
834 } else {
835 ret = notfound ;
836 }
837 return ret;
838}
839
840
841/*-------------------------------------------------------------------------*/

Callers

nothing calls this directly

Calls 1

iniparser_getstringFunction · 0.85

Tested by

no test coverage detected