diff options
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_PROGRESSDATA.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 b/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 index 1ff69e22d..f0892db92 100644 --- a/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 +++ b/docs/libcurl/opts/CURLOPT_PROGRESSDATA.3 @@ -5,11 +5,11 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * 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 -.\" * are also available at https://curl.haxx.se/docs/copyright.html. +.\" * are also available at https://curl.se/docs/copyright.html. .\" * .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell .\" * copies of the Software, and permit persons to whom the Software is @@ -20,10 +20,10 @@ .\" * .\" ************************************************************************** .\" -.TH CURLOPT_PROGRESSDATA 3 "March 23, 2020" "libcurl 7.73.0" "curl_easy_setopt options" +.TH CURLOPT_PROGRESSDATA 3 "November 08, 2021" "libcurl 7.80.0" "curl_easy_setopt options" .SH NAME -CURLOPT_PROGRESSDATA \- custom pointer passed to the progress callback +CURLOPT_PROGRESSDATA \- pointer passed to the progress callback .SH SYNOPSIS #include <curl/curl.h> @@ -36,7 +36,32 @@ The default value of this parameter is NULL. .SH PROTOCOLS All .SH EXAMPLE -https://curl.haxx.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 |