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