Commit 2b7bde4d authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

docs/opts: 24 more man pages now have examples

parent 58a6265a
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
.\" *                            | (__| |_| |  _ <| |___
.\" *                             \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -41,7 +41,24 @@ corresponding CURL handle.
.SH PROTOCOLS
All
.SH EXAMPLE
TODO
.nf
{
  char *ip;

  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");

  /* Perform the request, res will get the return code */
  res = curl_easy_perform(curl);
  /* Check for errors */
  if((res == CURLE_OK) &&
     !curl_easy_getinfo(curl, CURLINFO_LOCAL_IP, &ip) && ip) {
    printf("Local IP: %s\\n", ip);
  }

  /* always cleanup */
  curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
Added in 7.21.0
.SH RETURN VALUE
+16 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
.\" *                            | (__| |_| |  _ <| |___
.\" *                             \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -33,7 +33,21 @@ connection done with this \fBcurl\fP handle.
.SH PROTOCOLS
All
.SH EXAMPLE
TODO
.nf
CURL *curl = curl_easy_init();
if(curl) {
  CURLcode res;
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  res = curl_easy_perform(curl);
  if(res == CURLE_OK) {
    long port;
    res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_PORT, &port);
    if(!res)
      printf("Connected to remote port: %ld\n", port);
  }
  curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
Added in 7.21.0
.SH RETURN VALUE
+17 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
.\" *                            | (__| |_| |  _ <| |___
.\" *                             \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -35,7 +35,22 @@ pointer, although effectively being a 'void *'.
.SH PROTOCOLS
All
.SH EXAMPLE
TODO
.nf
CURL *curl = curl_easy_init();
if(curl) {
  void *pointer = 0x2345454;
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");

  /* set the private pointer */
  curl_easy_setopt(curl, CURLOPT_PRIVATE, pointer);
  ret = curl_easy_perform(curl);

  /* extract the private pointer again */
  ret = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &pointer);

  curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
Added in 7.10.3
.SH RETURN VALUE
+15 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
.\" *                            | (__| |_| |  _ <| |___
.\" *                             \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -33,7 +33,20 @@ actually followed.
.SH PROTOCOLS
HTTP(S)
.SH EXAMPLE
TODO
.nf
CURL *curl = curl_easy_init();
if(curl) {
  CURLcode res;
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  res = curl_easy_perform(curl);
  if(res == CURLE_OK) {
    long redirects;
    curl_easy_getinfo(curl, CURLINFO_REDIRECT_COUNT, &redirects);
  }
  curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
Added in 7.9.7
.SH RETURN VALUE
+16 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
.\" *                            | (__| |_| |  _ <| |___
.\" *                             \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -34,7 +34,21 @@ than one request if \fICURLOPT_FOLLOWLOCATION(3)\fP is enabled.
.SH PROTOCOLS
All
.SH EXAMPLE
TODO
.nf
CURL *curl = curl_easy_init();
if(curl) {
  CURLcode res;
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  res = curl_easy_perform(curl);
  if(res == CURLE_OK) {
    long req;
    res = curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &req);
    if(!res)
      printf("Request size: %ld bytes\n", req);
  }
  curl_easy_cleanup(curl);
}
.fi
.SH AVAILABILITY
Added in 7.4.1
.SH RETURN VALUE
Loading