diff options
Diffstat (limited to 'docs/libcurl/opts/CURLOPT_CHUNK_DATA.3')
-rw-r--r-- | docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 b/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 index e30da8ef6..b9ca3ee5f 100644 --- a/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 +++ b/docs/libcurl/opts/CURLOPT_CHUNK_DATA.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 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 @@ -22,7 +22,7 @@ .\" * .\" ************************************************************************** .\" -.TH CURLOPT_CHUNK_DATA 3 "May 17, 2022" "libcurl 7.86.0" "curl_easy_setopt options" +.TH CURLOPT_CHUNK_DATA 3 "December 04, 2023" "ibcurl 8.5.0" libcurl .SH NAME CURLOPT_CHUNK_DATA \- pointer passed to the FTP chunk callbacks @@ -33,7 +33,7 @@ CURLOPT_CHUNK_DATA \- pointer passed to the FTP chunk callbacks CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_DATA, void *pointer); .fi .SH DESCRIPTION -Pass a \fIpointer\fP that will be untouched by libcurl and passed as the ptr +Pass a \fIpointer\fP that is untouched by libcurl and passed as the ptr argument to the \fICURLOPT_CHUNK_BGN_FUNCTION(3)\fP and \fICURLOPT_CHUNK_END_FUNCTION(3)\fP. .SH DEFAULT @@ -42,10 +42,17 @@ NULL FTP .SH EXAMPLE .nf +#include <stdio.h> + +struct callback_data { + FILE *output; +}; + static long file_is_coming(struct curl_fileinfo *finfo, - struct callback_data *data, + void *ptr, int remains) { + struct callback_data *data = ptr; printf("%3d %40s %10luB ", remains, finfo->filename, (unsigned long)finfo->size); @@ -82,6 +89,8 @@ int main() /* data for callback */ struct callback_data callback_info; + CURL *curl = curl_easy_init(); + /* callback is called before download of concrete file started */ curl_easy_setopt(curl, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming); curl_easy_setopt(curl, CURLOPT_CHUNK_DATA, &callback_info); @@ -92,4 +101,5 @@ Added in 7.21.0 .SH RETURN VALUE Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. .SH "SEE ALSO" -.BR CURLOPT_CHUNK_BGN_FUNCTION "(3), " CURLOPT_WILDCARDMATCH "(3), " +.BR CURLOPT_CHUNK_BGN_FUNCTION (3), +.BR CURLOPT_WILDCARDMATCH (3) |