From: Viktor Szakats Date: Sun, 25 Jan 2026 17:14:23 +0000 (+0100) Subject: tool: rename curl handle and result variable in `--libcurl`-generated code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f8c9812b120a6802d57329f4c90dac91101ea14;p=thirdparty%2Fcurl.git tool: rename curl handle and result variable in `--libcurl`-generated code To match documentation, examples and curl source code: - `hnd` -> `curl` - `ret` -> `result` Closes #20437 --- diff --git a/src/tool_easysrc.c b/src/tool_easysrc.c index 593ceb7957..5b3c6cb45b 100644 --- a/src/tool_easysrc.c +++ b/src/tool_easysrc.c @@ -50,8 +50,8 @@ static const char * const srchead[] = { "", "int main(int argc, char *argv[])", "{", - " CURLcode ret;", - " CURL *hnd;", + " CURLcode result;", + " CURL *curl;", NULL }; /* easysrc_decl declarations come here */ @@ -66,7 +66,7 @@ static const char * const srchard[] = { }; static const char *const srcend[] = { "", - " return (int)ret;", + " return (int)result;", "}", "/**** End of sample code ****/", NULL @@ -121,7 +121,7 @@ CURLcode easysrc_addf(struct slist_wc **plist, const char *fmt, ...) CURLcode easysrc_init(void) { - return easysrc_add(&easysrc_code, "hnd = curl_easy_init();"); + return easysrc_add(&easysrc_code, "curl = curl_easy_init();"); } CURLcode easysrc_perform(void) @@ -152,7 +152,7 @@ CURLcode easysrc_perform(void) if(!result) result = easysrc_add(&easysrc_code, ""); if(!result) - result = easysrc_add(&easysrc_code, "ret = curl_easy_perform(hnd);"); + result = easysrc_add(&easysrc_code, "result = curl_easy_perform(curl);"); if(!result) result = easysrc_add(&easysrc_code, ""); @@ -161,9 +161,9 @@ CURLcode easysrc_perform(void) CURLcode easysrc_cleanup(void) { - CURLcode result = easysrc_add(&easysrc_code, "curl_easy_cleanup(hnd);"); + CURLcode result = easysrc_add(&easysrc_code, "curl_easy_cleanup(curl);"); if(!result) - result = easysrc_add(&easysrc_code, "hnd = NULL;"); + result = easysrc_add(&easysrc_code, "curl = NULL;"); return result; } diff --git a/src/tool_setopt.c b/src/tool_setopt.c index d9243ddf26..c81a999979 100644 --- a/src/tool_setopt.c +++ b/src/tool_setopt.c @@ -253,12 +253,12 @@ CURLcode tool_setopt_enum(CURL *curl, const char *name, CURLoption tag, /* If no definition was found, output an explicit value. * This could happen if new values are defined and used * but the NameValue list is not updated. */ - result = easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, %ldL);", + result = easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, %ldL);", name, lval); } else result = - easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, (long)%s);", + easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, (long)%s);", name, nv->name); } @@ -296,19 +296,19 @@ CURLcode tool_setopt_SSLVERSION(CURL *curl, const char *name, CURLoption tag, /* If no definition was found, output an explicit value. * This could happen if new values are defined and used * but the NameValue list is not updated. */ - result = easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, %ldL);", + result = easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, %ldL);", name, lval); } else { if(nv2->name && *nv2->name) /* if max is set */ result = easysrc_addf(&easysrc_code, - "curl_easy_setopt(hnd, %s, (long)(%s | %s));", + "curl_easy_setopt(curl, %s, (long)(%s | %s));", name, nv->name, nv2->name); else /* without a max */ result = easysrc_addf(&easysrc_code, - "curl_easy_setopt(hnd, %s, (long)%s);", + "curl_easy_setopt(curl, %s, (long)%s);", name, nv->name); } } @@ -336,7 +336,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, const char *name, CURLoption tag, unsigned long rest = (unsigned long)lval; const struct NameValueUnsigned *nv = NULL; curl_msnprintf(preamble, sizeof(preamble), - "curl_easy_setopt(hnd, %s, ", name); + "curl_easy_setopt(curl, %s, ", name); for(nv = nvlist; nv->name; nv++) { if((nv->value & ~rest) == 0) { /* all value flags contained in rest */ @@ -533,7 +533,7 @@ static CURLcode libcurl_generate_mime(CURL *curl, if(!result) result = easysrc_addf(&easysrc_data, "mime%d = NULL;", *mimeno); if(!result) - result = easysrc_addf(&easysrc_code, "mime%d = curl_mime_init(hnd);", + result = easysrc_addf(&easysrc_code, "mime%d = curl_mime_init(curl);", *mimeno); if(!result) result = easysrc_addf(&easysrc_clean, "curl_mime_free(mime%d);", *mimeno); @@ -563,7 +563,7 @@ CURLcode tool_setopt_mimepost(CURL *curl, struct OperationConfig *config, if(!result) result = - easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, mime%d);", + easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, mime%d);", name, mimeno); } @@ -584,7 +584,7 @@ CURLcode tool_setopt_slist(CURL *curl, const char *name, CURLoption tag, result = libcurl_generate_slist(list, &i); if(!result) result = - easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, slist%d);", + easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, slist%d);", name, i); } @@ -610,7 +610,7 @@ CURLcode tool_setopt_long(CURL *curl, const char *name, CURLoption tag, result = curl_easy_setopt(curl, tag, lval); if((lval != defval) && global->libcurl && !result) { /* we only use this for real if --libcurl was used */ - result = easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, %ldL);", + result = easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, %ldL);", name, lval); } return result; @@ -627,7 +627,7 @@ CURLcode tool_setopt_offt(CURL *curl, const char *name, CURLoption tag, if(global->libcurl && !result && lval) { /* we only use this for real if --libcurl was used */ result = - easysrc_addf(&easysrc_code, "curl_easy_setopt(hnd, %s, (curl_off_t)%" + easysrc_addf(&easysrc_code, "curl_easy_setopt(curl, %s, (curl_off_t)%" CURL_FORMAT_CURL_OFF_T ");", name, lval); } @@ -690,7 +690,7 @@ CURLcode tool_setopt_str(CURL *curl, struct OperationConfig *config, escaped = c_escape(str, len); if(escaped) { result = easysrc_addf(&easysrc_code, - "curl_easy_setopt(hnd, %s, \"%s\");", + "curl_easy_setopt(curl, %s, \"%s\");", name, escaped); curlx_free(escaped); } diff --git a/tests/data/data1400.c b/tests/data/data1400.c index 8aeb3c8fc8..c42b51577e 100644 --- a/tests/data/data1400.c +++ b/tests/data/data1400.c @@ -6,16 +6,16 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -36,11 +36,11 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1401.c b/tests/data/data1401.c index dfea0bb673..1a87aa0164 100644 --- a/tests/data/data1401.c +++ b/tests/data/data1401.c @@ -6,26 +6,26 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; struct curl_slist *slist1; slist1 = NULL; slist1 = curl_slist_append(slist1, "X-Files: Mulder"); slist1 = curl_slist_append(slist1, "X-Men: cyclops, iceman"); - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); - curl_easy_setopt(hnd, CURLOPT_USERPWD, "fake:user"); - curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC); - curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, slist1); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "MyUA"); - curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_COOKIE, "chocolate=chip"); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); - curl_easy_setopt(hnd, CURLOPT_PROTOCOLS_STR, "file,ftp,http"); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); + curl_easy_setopt(curl, CURLOPT_USERPWD, "fake:user"); + curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC); + curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist1); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "MyUA"); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(curl, CURLOPT_COOKIE, "chocolate=chip"); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); + curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "file,ftp,http"); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -46,13 +46,13 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; curl_slist_free_all(slist1); slist1 = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1402.c b/tests/data/data1402.c index 917b4aa822..682345485d 100644 --- a/tests/data/data1402.c +++ b/tests/data/data1402.c @@ -6,18 +6,18 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; - - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); - curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "foo=bar&baz=quux"); - curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)16); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + CURLcode result; + CURL *curl; + + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "foo=bar&baz=quux"); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)16); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -38,11 +38,11 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1403.c b/tests/data/data1403.c index 38226573cd..6d1522be0f 100644 --- a/tests/data/data1403.c +++ b/tests/data/data1403.c @@ -6,16 +6,16 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER\?foo=bar&baz=quux"); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER\?foo=bar&baz=quux"); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -36,11 +36,11 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1404.c b/tests/data/data1404.c index 24b68adb06..df9364d104 100644 --- a/tests/data/data1404.c +++ b/tests/data/data1404.c @@ -6,8 +6,8 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; curl_mime *mime1; curl_mimepart *part1; curl_mime *mime2; @@ -20,16 +20,16 @@ int main(int argc, char *argv[]) slist1 = curl_slist_append(slist1, "X-testheader-1: header 1"); slist1 = curl_slist_append(slist1, "X-testheader-2: header 2"); - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); - mime1 = curl_mime_init(hnd); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); + mime1 = curl_mime_init(curl); part1 = curl_mime_addpart(mime1); curl_mime_data(part1, "value", CURL_ZERO_TERMINATED); curl_mime_name(part1, "name"); part1 = curl_mime_addpart(mime1); - mime2 = curl_mime_init(hnd); + mime2 = curl_mime_init(curl); part2 = curl_mime_addpart(mime2); curl_mime_filedata(part2, "%LOGDIR/test%TESTNUMBER.txt"); part2 = curl_mime_addpart(mime2); @@ -43,10 +43,10 @@ int main(int argc, char *argv[]) curl_mime_subparts(part1, mime2); mime2 = NULL; curl_mime_name(part1, "file"); - curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime1); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime1); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -67,10 +67,10 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; curl_mime_free(mime1); mime1 = NULL; curl_mime_free(mime2); @@ -78,6 +78,6 @@ int main(int argc, char *argv[]) curl_slist_free_all(slist1); slist1 = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1405.c b/tests/data/data1405.c index e80b77edda..ec7a4a39c9 100644 --- a/tests/data/data1405.c +++ b/tests/data/data1405.c @@ -6,8 +6,8 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; struct curl_slist *slist1; struct curl_slist *slist2; struct curl_slist *slist3; @@ -21,15 +21,15 @@ int main(int argc, char *argv[]) slist3 = curl_slist_append(slist3, "NOOP 2"); slist3 = curl_slist_append(slist3, "*FAIL HARD"); - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "ftp://%HOSTIP:%FTPPORT/%TESTNUMBER"); - curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L); - curl_easy_setopt(hnd, CURLOPT_QUOTE, slist1); - curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, slist2); - curl_easy_setopt(hnd, CURLOPT_PREQUOTE, slist3); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "ftp://%HOSTIP:%FTPPORT/%TESTNUMBER"); + curl_easy_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, 1L); + curl_easy_setopt(curl, CURLOPT_QUOTE, slist1); + curl_easy_setopt(curl, CURLOPT_POSTQUOTE, slist2); + curl_easy_setopt(curl, CURLOPT_PREQUOTE, slist3); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -50,10 +50,10 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; curl_slist_free_all(slist1); slist1 = NULL; curl_slist_free_all(slist2); @@ -61,6 +61,6 @@ int main(int argc, char *argv[]) curl_slist_free_all(slist3); slist3 = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1406.c b/tests/data/data1406.c index b71dffa88f..30aff8d588 100644 --- a/tests/data/data1406.c +++ b/tests/data/data1406.c @@ -6,24 +6,24 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; struct curl_slist *slist1; slist1 = NULL; slist1 = curl_slist_append(slist1, "recipient.one@example.com"); slist1 = curl_slist_append(slist1, "recipient.two@example.com"); - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER"); - curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); - curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com"); - curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1); - curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER"); + curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); + curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "sender@example.com"); + curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, slist1); + curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -44,13 +44,13 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; curl_slist_free_all(slist1); slist1 = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1407.c b/tests/data/data1407.c index f1d2b30f0f..4f34db3655 100644 --- a/tests/data/data1407.c +++ b/tests/data/data1407.c @@ -6,16 +6,16 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "pop3://%HOSTIP:%POP3PORT/%TESTNUMBER"); - curl_easy_setopt(hnd, CURLOPT_DIRLISTONLY, 1L); - curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret"); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "pop3://%HOSTIP:%POP3PORT/%TESTNUMBER"); + curl_easy_setopt(curl, CURLOPT_DIRLISTONLY, 1L); + curl_easy_setopt(curl, CURLOPT_USERPWD, "user:secret"); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -36,11 +36,11 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1420.c b/tests/data/data1420.c index 8405d8ba4c..5e70aafd6e 100644 --- a/tests/data/data1420.c +++ b/tests/data/data1420.c @@ -6,16 +6,16 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; + CURLcode result; + CURL *curl; - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1"); - curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret"); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1"); + curl_easy_setopt(curl, CURLOPT_USERPWD, "user:secret"); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -36,11 +36,11 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1465.c b/tests/data/data1465.c index 09e13f28d5..dea3b61988 100644 --- a/tests/data/data1465.c +++ b/tests/data/data1465.c @@ -6,18 +6,18 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; - - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); - curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "ab\201cd\000e\\\"\?\r\n\t\001fghi\x1ajklm\xfd"); - curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)24); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + CURLcode result; + CURL *curl; + + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER"); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "ab\201cd\000e\\\"\?\r\n\t\001fghi\x1ajklm\xfd"); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)24); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -38,11 +38,11 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/ diff --git a/tests/data/data1481.c b/tests/data/data1481.c index b8741c0d95..e7d468e698 100644 --- a/tests/data/data1481.c +++ b/tests/data/data1481.c @@ -6,19 +6,19 @@ int main(int argc, char *argv[]) { - CURLcode ret; - CURL *hnd; - - hnd = curl_easy_init(); - curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); - curl_easy_setopt(hnd, CURLOPT_URL, "http://moo/"); - curl_easy_setopt(hnd, CURLOPT_PROXY, "http://%HOSTIP:%HTTPPORT"); - curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/%VERSION"); - curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); - curl_easy_setopt(hnd, CURLOPT_SSLVERSION, (long)(CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_3)); - curl_easy_setopt(hnd, CURLOPT_PROXY_SSLVERSION, (long)CURL_SSLVERSION_TLSv1); - curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + CURLcode result; + CURL *curl; + + curl = curl_easy_init(); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(curl, CURLOPT_URL, "http://moo/"); + curl_easy_setopt(curl, CURLOPT_PROXY, "http://%HOSTIP:%HTTPPORT"); + curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/%VERSION"); + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(curl, CURLOPT_SSLVERSION, (long)(CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_TLSv1_3)); + curl_easy_setopt(curl, CURLOPT_PROXY_SSLVERSION, (long)CURL_SSLVERSION_TLSv1); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); /* Here is a list of options the curl code used that cannot get generated as source easily. You may choose to either not use them or implement @@ -39,11 +39,11 @@ int main(int argc, char *argv[]) */ - ret = curl_easy_perform(hnd); + result = curl_easy_perform(curl); - curl_easy_cleanup(hnd); - hnd = NULL; + curl_easy_cleanup(curl); + curl = NULL; - return (int)ret; + return (int)result; } /**** End of sample code ****/