CURLOPT_CHUNK_END_FUNCTION.3 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_CHUNK_END_FUNCTION 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_CHUNK_END_FUNCTION \- callback after a transfer with FTP wildcard match
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. long chunk_end_callback(void *ptr);
  32. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CHUNK_END_FUNCTION,
  33. chunk_end_callback);
  34. .SH DESCRIPTION
  35. Pass a pointer to your callback function, which should match the prototype
  36. shown above.
  37. This function gets called by libcurl as soon as a part of the stream has been
  38. transferred (or skipped).
  39. Return \fICURL_CHUNK_END_FUNC_OK\fP if everything is fine or
  40. \fBCURL_CHUNK_END_FUNC_FAIL\fP to tell the lib to stop if some error occurred.
  41. .SH DEFAULT
  42. NULL
  43. .SH PROTOCOLS
  44. FTP
  45. .SH EXAMPLE
  46. .nf
  47. static long file_is_downloaded(struct callback_data *data)
  48. {
  49. if(data->output) {
  50. fclose(data->output);
  51. data->output = 0x0;
  52. }
  53. return CURL_CHUNK_END_FUNC_OK;
  54. }
  55. int main()
  56. {
  57. /* data for callback */
  58. struct callback_data callback_info;
  59. curl_easy_setopt(curl, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded);
  60. curl_easy_setopt(curl, CURLOPT_CHUNK_DATA, &callback_info);
  61. }
  62. .fi
  63. .SH AVAILABILITY
  64. Added in 7.21.0
  65. .SH RETURN VALUE
  66. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  67. .SH "SEE ALSO"
  68. .BR CURLOPT_WILDCARDMATCH "(3), " CURLOPT_CHUNK_BGN_FUNCTION "(3), "