Diff
Not logged in

Differences From:

File src/db.c part of check-in [5cc845cfeb] - Rename the 'clearsign' setting to 'pgp-command'. Remove the 'safemerge' setting - safemerge is on by default and cannot be disabled. by drh on 2008-02-08 21:42:46. [view]

To:

File src/db.c part of check-in [676fdd088a] - Enable proxy support using the "fossil setting proxy" command. This check-in is made using a proxy. by drh on 2008-05-01 22:49:57. [view]

@@ -896,8 +896,28 @@
   }
 }
 
 /*
+** Return true if the string zVal represents "true" (or "false").
+*/
+int is_truth(const char *zVal){
+  static const char *azOn[] = { "on", "yes", "true", "1" };
+  int i;
+  for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
+    if( strcmp(zVal,azOn[i])==0 ) return 1;
+  }
+  return 0;
+}
+int is_false(const char *zVal){
+  static const char *azOff[] = { "off", "no", "false", "0" };
+  int i;
+  for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
+    if( strcmp(zVal,azOff[i])==0 ) return 1;
+  }
+  return 0;
+}
+
+/*
 ** Get and set values from the CONFIG, GLOBAL_CONFIG and VVAR table in the
 ** repository and local databases.
 */
 char *db_get(const char *zName, char *zDefault){
@@ -957,18 +977,11 @@
   }
   db_end_transaction(0);
 }
 int db_get_boolean(const char *zName, int dflt){
-  static const char *azOn[] = { "on", "yes", "true", "1" };
-  static const char *azOff[] = { "off", "no", "false", "0" };
-  int i;
   char *zVal = db_get(zName, dflt ? "on" : "off");
-  for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
-    if( strcmp(zVal,azOn[i])==0 ) return 1;
-  }
-  for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
-    if( strcmp(zVal,azOff[i])==0 ) return 0;
-  }
+  if( is_truth(zVal) ) return 1;
+  if( is_false(zVal) ) return 0;
   return dflt;
 }
 char *db_lget(const char *zName, char *zDefault){
   return db_text((char*)zDefault,
@@ -1065,8 +1078,10 @@
 **
 **    omitsign         When enabled, fossil will not attempt to sign any
 **                     commit with gpg. All commits will be unsigned.
 **
+**    proxy            URL of the HTTP proxy to use
+**
 **    diff-command     External command to run when performing a diff.
 **                     If undefined, the internal text diff will be used.
 **
 **    gdiff-command    External command to run when performing a graphical
@@ -1078,8 +1093,9 @@
     "pgp-command",
     "editor",
     "localauth",
     "omitsign",
+    "proxy",
     "diff-command",
     "gdiff-command",
   };
   int i;