summaryrefslogtreecommitdiff
path: root/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3
diff options
context:
space:
mode:
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_PROGRESSDATA.3')
-rw-r--r--docs/libcurl/opts/CURLOPT_PROGRESSDATA.329
1 files changed, 27 insertions, 2 deletions
diff --git a/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 b/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3
index bcab72400..bcfcfb9e7 100644
--- a/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3
+++ b/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2021, 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,32 @@ The default value of this parameter is NULL.
.SH PROTOCOLS
All
.SH EXAMPLE
-https://curl.se/libcurl/c/progressfunc.html
+.nf
+ struct progress {
+ char *private;
+ size_t size;
+ };
+
+ static size_t progress_callback(void *clientp,
+ double dltotal,
+ double dlnow,
+ double ultotal,
+ double ulnow)
+ {
+ struct memory *progress = (struct progress *)userp;
+
+ /* use the values */
+
+ return 0; /* all is good */
+ }
+
+ struct progress data;
+
+ /* pass struct to callback */
+ curl_easy_setopt(curl_handle, CURLOPT_PROGRESSDATA, &data);
+
+ curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
+.fi
.SH AVAILABILITY
Always
.SH RETURN VALUE