]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
docs: fix some examples in man pages
authorDan Fandrich <dan@coneharvesters.com>
Fri, 23 Aug 2024 05:17:43 +0000 (22:17 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Fri, 23 Aug 2024 16:00:08 +0000 (09:00 -0700)
The man-examples job hasn't been running for a few months to verify
that these compile, so some mistakes slipped in.

Ref: #14654

docs/libcurl/curl_multi_poll.md
docs/libcurl/curl_multi_waitfds.md
docs/libcurl/opts/CURLINFO_POSTTRANSFER_TIME_T.md
docs/libcurl/opts/CURLOPT_ECH.md

index 2c2ccee6e7eed8e5a32b0a61b9a2eb7d74be7532..c19661d0eafa071924f35e7d0aafdb439ac4976b 100644 (file)
@@ -92,6 +92,8 @@ events such as the socket being clear to write without blocking.
 # EXAMPLE
 
 ~~~c
+extern void handle_fd(int);
+
 int main(void)
 {
   CURL *easy_handle;
index a6422302724f05b7187b00d472566aac2ed02f16..0a8440eb4076650d6624094e87966dfbdad1b68b 100644 (file)
@@ -57,6 +57,8 @@ subsequent function call.
 # EXAMPLE
 
 ~~~c
+#include <stdlib.h>
+
 int main(void)
 {
   CURLMcode mc;
@@ -98,7 +100,7 @@ int main(void)
     /* Do polling on descriptors in ufds */
 
     free(ufds);
-  } while (!mc);
+  } while(!mc);
 }
 ~~~
 
index 5d81a59a6c24cba9e485e2164ed1192eb3af69e9..9acdbd7fb51e79d7f7f9d9324d1f6b04b2c01f3b 100644 (file)
@@ -50,10 +50,11 @@ int main(void)
     res = curl_easy_perform(curl);
     if(CURLE_OK == res) {
       curl_off_t posttransfer;
-      res = curl_easy_getinfo(curl, CURLINFO_POSTTRANSFER_TIME_T, &posttransfer);
+      res = curl_easy_getinfo(curl, CURLINFO_POSTTRANSFER_TIME_T,
+                              &posttransfer);
       if(CURLE_OK == res) {
-        printf("Request sent after: %" CURL_FORMAT_CURL_OFF_T ".%06ld us", posttransfer / 1000000,
-               (long)(posttransfer % 1000000));
+        printf("Request sent after: %" CURL_FORMAT_CURL_OFF_T ".%06ld us",
+               posttransfer / 1000000, (long)(posttransfer % 1000000));
       }
     }
     /* always cleanup */
index a637b98bebe40d439af55b08a4619e75a7819e59..b2d8eb43a40b819f9697cc6a1549c2a25756c378 100644 (file)
@@ -79,12 +79,17 @@ NULL, meaning ECH is disabled.
 # EXAMPLE
 
 ~~~c
-CURL *curl = curl_easy_init();
-
-const char *config ="ecl:AED+DQA87wAgACB/RuzUCsW3uBbSFI7mzD63TUXpI8sGDTnFTbFCDpa+CAAEAAEAAQANY292ZXIuZGVmby5pZQAA";
-if(curl) {
-  curl_easy_setopt(curl, CURLOPT_ECH, config);
-  curl_easy_perform(curl);
+int main(void)
+{
+  CURL *curl = curl_easy_init();
+
+  const char *config = \
+    "ecl:AED+DQA87wAgACB/RuzUCsW3uBbSFI7mzD63TUXpI8sGDTnFTbFCDpa+" \
+    "CAAEAAEAAQANY292ZXIuZGVmby5pZQAA";
+  if(curl) {
+    curl_easy_setopt(curl, CURLOPT_ECH, config);
+    curl_easy_perform(curl);
+  }
 }
 ~~~
 # %AVAILABILITY%