MCPcopy Create free account
hub / github.com/audacity/audacity / booleanValue

Function booleanValue

lib-src/sqlite/shell.c:14976–14993  ·  view source on GitHub ↗

** Interpret zArg as either an integer or a boolean value. Return 1 or 0 ** for TRUE and FALSE. Return the integer value if appropriate. */

Source from the content-addressed store, hash-verified

14974** for TRUE and FALSE. Return the integer value if appropriate.
14975*/
14976static int booleanValue(const char *zArg){
14977 int i;
14978 if( zArg[0]=='0' && zArg[1]=='x' ){
14979 for(i=2; hexDigitValue(zArg[i])>=0; i++){}
14980 }else{
14981 for(i=0; zArg[i]>='0' && zArg[i]<='9'; i++){}
14982 }
14983 if( i>0 && zArg[i]==0 ) return (int)(integerValue(zArg) & 0xffffffff);
14984 if( sqlite3_stricmp(zArg, "on")==0 || sqlite3_stricmp(zArg,"yes")==0 ){
14985 return 1;
14986 }
14987 if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){
14988 return 0;
14989 }
14990 utf8_printf(stderr, "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n",
14991 zArg);
14992 return 0;
14993}
14994
14995/*
14996** Set or clear a shell flag according to a boolean value.

Callers 2

setOrClearFlagFunction · 0.85
do_meta_commandFunction · 0.85

Calls 3

hexDigitValueFunction · 0.85
integerValueFunction · 0.85
utf8_printfFunction · 0.85

Tested by

no test coverage detected