| | @@ -893,10 +893,30 @@ |
| 893 | 893 | sqlite3_trace(g.db, db_sql_trace, 0); |
| 894 | 894 | } |
| 895 | 895 | once = 0; |
| 896 | 896 | } |
| 897 | 897 | } |
| 898 | + |
| 899 | +/* |
| 900 | +** Return true if the string zVal represents "true" (or "false"). |
| 901 | +*/ |
| 902 | +int is_truth(const char *zVal){ |
| 903 | + static const char *azOn[] = { "on", "yes", "true", "1" }; |
| 904 | + int i; |
| 905 | + for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ |
| 906 | + if( strcmp(zVal,azOn[i])==0 ) return 1; |
| 907 | + } |
| 908 | + return 0; |
| 909 | +} |
| 910 | +int is_false(const char *zVal){ |
| 911 | + static const char *azOff[] = { "off", "no", "false", "0" }; |
| 912 | + int i; |
| 913 | + for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ |
| 914 | + if( strcmp(zVal,azOff[i])==0 ) return 1; |
| 915 | + } |
| 916 | + return 0; |
| 917 | +} |
| 898 | 918 | |
| 899 | 919 | /* |
| 900 | 920 | ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the |
| 901 | 921 | ** repository and local databases. |
| 902 | 922 | */ |
| | @@ -956,20 +976,13 @@ |
| 956 | 976 | db_multi_exec("DELETE FROM config WHERE name=%Q", zName); |
| 957 | 977 | } |
| 958 | 978 | db_end_transaction(0); |
| 959 | 979 | } |
| 960 | 980 | int db_get_boolean(const char *zName, int dflt){ |
| 961 | | - static const char *azOn[] = { "on", "yes", "true", "1" }; |
| 962 | | - static const char *azOff[] = { "off", "no", "false", "0" }; |
| 963 | | - int i; |
| 964 | 981 | char *zVal = db_get(zName, dflt ? "on" : "off"); |
| 965 | | - for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ |
| 966 | | - if( strcmp(zVal,azOn[i])==0 ) return 1; |
| 967 | | - } |
| 968 | | - for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ |
| 969 | | - if( strcmp(zVal,azOff[i])==0 ) return 0; |
| 970 | | - } |
| 982 | + if( is_truth(zVal) ) return 1; |
| 983 | + if( is_false(zVal) ) return 0; |
| 971 | 984 | return dflt; |
| 972 | 985 | } |
| 973 | 986 | char *db_lget(const char *zName, char *zDefault){ |
| 974 | 987 | return db_text((char*)zDefault, |
| 975 | 988 | "SELECT value FROM vvar WHERE name=%Q", zName); |
| | @@ -1063,10 +1076,12 @@ |
| 1063 | 1076 | ** false, all HTTP requests from localhost have |
| 1064 | 1077 | ** unrestricted access to the repository. |
| 1065 | 1078 | ** |
| 1066 | 1079 | ** omitsign When enabled, fossil will not attempt to sign any |
| 1067 | 1080 | ** commit with gpg. All commits will be unsigned. |
| 1081 | +** |
| 1082 | +** proxy URL of the HTTP proxy to use |
| 1068 | 1083 | ** |
| 1069 | 1084 | ** diff-command External command to run when performing a diff. |
| 1070 | 1085 | ** If undefined, the internal text diff will be used. |
| 1071 | 1086 | ** |
| 1072 | 1087 | ** gdiff-command External command to run when performing a graphical |
| | @@ -1077,10 +1092,11 @@ |
| 1077 | 1092 | "autosync", |
| 1078 | 1093 | "pgp-command", |
| 1079 | 1094 | "editor", |
| 1080 | 1095 | "localauth", |
| 1081 | 1096 | "omitsign", |
| 1097 | + "proxy", |
| 1082 | 1098 | "diff-command", |
| 1083 | 1099 | "gdiff-command", |
| 1084 | 1100 | }; |
| 1085 | 1101 | int i; |
| 1086 | 1102 | int globalFlag = find_option("global","g",0)!=0; |
| 1087 | 1103 | |