mirror of
https://github.com/curl/curl.git
synced 2026-08-25 02:23:31 +03:00
docs: rename CURLcode variables to 'result'
This commit is contained in:
parent
d21f4372ff
commit
09f01f28ec
381 changed files with 1705 additions and 1695 deletions
|
|
@ -69,7 +69,7 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
CURLcode result;
|
||||
int prtall = 0, prtsep = 0, prttime = 0;
|
||||
const char *url = URL_1M;
|
||||
char *appname = argv[0];
|
||||
|
|
@ -161,9 +161,9 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
/* init libcurl */
|
||||
res = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if(res)
|
||||
return (int)res;
|
||||
result = curl_global_init(CURL_GLOBAL_ALL);
|
||||
if(result)
|
||||
return (int)result;
|
||||
|
||||
/* init the curl session */
|
||||
curl = curl_easy_init();
|
||||
|
|
@ -181,43 +181,43 @@ int main(int argc, char *argv[])
|
|||
"libcurl-speedchecker/" CHKSPEED_VERSION);
|
||||
|
||||
/* get it! */
|
||||
res = curl_easy_perform(curl);
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == res) {
|
||||
if(CURLE_OK == result) {
|
||||
curl_off_t val;
|
||||
|
||||
/* check for bytes downloaded */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
result = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
printf("Data downloaded: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", val);
|
||||
|
||||
/* check for total download time */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
result = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
printf("Total download time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
val % 1000000);
|
||||
|
||||
/* check for average download speed */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
result = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
printf("Average download speed: "
|
||||
"%" CURL_FORMAT_CURL_OFF_T " kbyte/sec.\n",
|
||||
val / 1024);
|
||||
|
||||
if(prtall) {
|
||||
/* check for name resolution time */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
result = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
printf("Name lookup time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
val % 1000000);
|
||||
|
||||
/* check for connect time */
|
||||
res = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &val);
|
||||
if((CURLE_OK == res) && (val > 0))
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
printf("Connect time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
|
|
@ -226,7 +226,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else {
|
||||
fprintf(stderr, "Error while fetching '%s' : %s\n",
|
||||
url, curl_easy_strerror(res));
|
||||
url, curl_easy_strerror(result));
|
||||
}
|
||||
|
||||
/* cleanup curl stuff */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue