]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool: rename curl handle and result variable in `--libcurl`-generated code
authorViktor Szakats <commit@vsz.me>
Sun, 25 Jan 2026 17:14:23 +0000 (18:14 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 26 Jan 2026 12:21:46 +0000 (13:21 +0100)
To match documentation, examples and curl source code:
- `hnd` -> `curl`
- `ret` -> `result`

Closes #20437

13 files changed:
src/tool_easysrc.c
src/tool_setopt.c
tests/data/data1400.c
tests/data/data1401.c
tests/data/data1402.c
tests/data/data1403.c
tests/data/data1404.c
tests/data/data1405.c
tests/data/data1406.c
tests/data/data1407.c
tests/data/data1420.c
tests/data/data1465.c
tests/data/data1481.c

index 593ceb79573477961686adbf500e5835c86a134b..5b3c6cb45b6f108588fada1d7aedb87515a54028 100644 (file)
@@ -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;
 }
index d9243ddf267cd5e5105848c6dc7f705c826d0936..c81a9999796f5c1a24a0a516d7a7d50f16bfcd2f 100644 (file)
@@ -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);
     }
index 8aeb3c8fc88b6ed67183c5c8eae3a4869f648a97..c42b51577e197f24dbe727c252132756699f96ba 100644 (file)
@@ -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 ****/
index dfea0bb673e7c59b53882d07978eea975711228d..1a87aa016477f67d2eda89c4a282330f5d155d56 100644 (file)
@@ -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 ****/
index 917b4aa82290429dd42d1cc9d0e3d186682af073..682345485d38acf210067345494dae89078ff09b 100644 (file)
@@ -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 ****/
index 38226573cde4bd449ccaaa7630d9cac659fa1fd2..6d1522be0f9c0e4509218354e2555cedead7d286 100644 (file)
@@ -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 ****/
index 24b68adb064d4197456ae79cecef161f7ddd57c8..df9364d1040449b0bf958c8631905016ea42f13d 100644 (file)
@@ -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 ****/
index e80b77eddad2ec1a4767624bd5edfa45af03caeb..ec7a4a39c9a3ac4111403779cd37d53bbd666bd1 100644 (file)
@@ -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 ****/
index b71dffa88f5a0d7ae87035444a68f375dce63839..30aff8d58875fee5d86315d426195cc4771ad7fa 100644 (file)
@@ -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 ****/
index f1d2b30f0f0b89e83e3a71938998a1ba09956413..4f34db365527ff220c287b669bbc7cc478eb8904 100644 (file)
@@ -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 ****/
index 8405d8ba4c949df98e5b066ef00c5ef8cc50f078..5e70aafd6e0ec0eb2778e09b1405ee65accd2da2 100644 (file)
@@ -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 ****/
index 09e13f28d564ab9a9c8bb46357e9b59306a52163..dea3b61988c0c878151b2b1d1f81d2f9863ecb26 100644 (file)
@@ -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 ****/
index b8741c0d95bc1be3584aaa52b98aa5c00fb0e47b..e7d468e6985ced0df5482f2541d178c117010c7c 100644 (file)
@@ -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 ****/