]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Try curl.
authorBruno Haible <bruno@clisp.org>
Mon, 19 Aug 2002 10:58:32 +0000 (10:58 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:08:44 +0000 (12:08 +0200)
src/ChangeLog
src/urlget.c

index 91d3dccb25f8c83d6b7b0194b2ce07aa7906ec17..325e22160699686b6ea28baba5a5db0fb16cec1c 100644 (file)
@@ -1,3 +1,11 @@
+2002-08-17  Bruno Haible  <bruno@clisp.org>
+
+       * urlget.c (fetch): Also try invoking the 'curl' program.
+
+2002-08-06  Bruno Haible  <bruno@clisp.org>
+
+       * gettext-0.11.5 released.
+
 2002-08-02  Bruno Haible  <bruno@clisp.org>
 
        * read-mo.c (get_sysdep_string): Make the error message easier to
index 51d3d5c7f3983dbd89671279b1ee792d242ad402..4776ccdcf0d9de6b62e8ba96e0fd22244cdf0b34 100644 (file)
@@ -360,6 +360,45 @@ fetch (url, file)
       }
   }
 
+  /* Fourth try: using "curl --silent url".  */
+  {
+    static bool curl_tested;
+    static bool curl_present;
+
+    if (!curl_tested)
+      {
+       /* Test for presence of curl: "curl --version > /dev/null"  */
+       char *argv[3];
+       int exitstatus;
+
+       argv[0] = "curl";
+       argv[1] = "--version";
+       argv[2] = NULL;
+       exitstatus = execute ("curl", "curl", argv, false, true, true, false);
+       curl_present = (exitstatus == 0 || exitstatus == 2);
+       curl_tested = true;
+      }
+
+    if (curl_present)
+      {
+       char *argv[4];
+       int exitstatus;
+
+       argv[0] = "curl";
+       argv[1] = "--silent";
+       argv[2] = (char *) url;
+       argv[3] = NULL;
+       exitstatus = execute ("curl", "curl", argv, false, false, false, false);
+       if (exitstatus != 127)
+         {
+           if (exitstatus != 0)
+             /* Use the file as fallback.  */
+             cat_file (file);
+           return;
+         }
+      }
+  }
+
   /* Use the file as fallback.  */
   cat_file (file);
 }