** Interpret zArg as either an integer or a boolean value. Return 1 or 0 ** for TRUE and FALSE. Return the integer value if appropriate. */
| 14974 | ** for TRUE and FALSE. Return the integer value if appropriate. |
| 14975 | */ |
| 14976 | static 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. |
no test coverage detected