CURLOPT_PROGRESSDATA.3 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_PROGRESSDATA 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_PROGRESSDATA \- pointer passed to the progress callback
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROGRESSDATA, void *pointer);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a \fIpointer\fP that will be untouched by libcurl and passed as the first
  35. argument in the progress callback set with \fICURLOPT_PROGRESSFUNCTION(3)\fP.
  36. .SH DEFAULT
  37. The default value of this parameter is NULL.
  38. .SH PROTOCOLS
  39. All
  40. .SH EXAMPLE
  41. .nf
  42. struct progress {
  43. char *private;
  44. size_t size;
  45. };
  46. static size_t progress_callback(void *clientp,
  47. double dltotal,
  48. double dlnow,
  49. double ultotal,
  50. double ulnow)
  51. {
  52. struct memory *progress = (struct progress *)clientp;
  53. /* use the values */
  54. return 0; /* all is good */
  55. }
  56. struct progress data;
  57. /* pass struct to callback */
  58. curl_easy_setopt(curl_handle, CURLOPT_PROGRESSDATA, &data);
  59. curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
  60. .fi
  61. .SH AVAILABILITY
  62. Always
  63. .SH RETURN VALUE
  64. Returns CURLE_OK
  65. .SH "SEE ALSO"
  66. .BR CURLOPT_PROGRESSFUNCTION "(3), " CURLOPT_XFERINFOFUNCTION "(3), "