MCPcopy Create free account
hub / github.com/Kitware/VTK / booleanValue

Function booleanValue

ThirdParty/sqlite/vtksqlite/shell.c:25811–25828  ·  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

25809** for TRUE and FALSE. Return the integer value if appropriate.
25810*/
25811static int booleanValue(const char *zArg){
25812 int i;
25813 if( zArg[0]=='0' && zArg[1]=='x' ){
25814 for(i=2; hexDigitValue(zArg[i])>=0; i++){}
25815 }else{
25816 for(i=0; zArg[i]>='0' && zArg[i]<='9'; i++){}
25817 }
25818 if( i>0 && zArg[i]==0 ) return (int)(integerValue(zArg) & 0xffffffff);
25819 if( sqlite3_stricmp(zArg, "on")==0 || sqlite3_stricmp(zArg,"yes")==0 ){
25820 return 1;
25821 }
25822 if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){
25823 return 0;
25824 }
25825 sqlite3_fprintf(stderr,
25826 "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n", zArg);
25827 return 0;
25828}
25829
25830/*
25831** Set or clear a shell flag according to a boolean value.

Callers 3

_isEquivalentToMethod · 0.85
setOrClearFlagFunction · 0.85
do_meta_commandFunction · 0.85

Calls 3

hexDigitValueFunction · 0.85
integerValueFunction · 0.85
sqlite3_fprintfFunction · 0.85

Tested by

no test coverage detected