From: Bruno Haible Date: Mon, 19 Aug 2002 10:58:32 +0000 (+0000) Subject: Try curl. X-Git-Tag: v0.12~1289 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e89f1591141eeef32ad0cc12704ee99aa01c7986;p=thirdparty%2Fgettext.git Try curl. --- diff --git a/src/ChangeLog b/src/ChangeLog index 91d3dccb2..325e22160 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2002-08-17 Bruno Haible + + * urlget.c (fetch): Also try invoking the 'curl' program. + +2002-08-06 Bruno Haible + + * gettext-0.11.5 released. + 2002-08-02 Bruno Haible * read-mo.c (get_sysdep_string): Make the error message easier to diff --git a/src/urlget.c b/src/urlget.c index 51d3d5c7f..4776ccdcf 100644 --- a/src/urlget.c +++ b/src/urlget.c @@ -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); }