CURLOPT_NETRC_FILE.3 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. .\" generated by cd2nroff 0.1 from CURLOPT_NETRC_FILE.md
  2. .TH CURLOPT_NETRC_FILE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_NETRC_FILE \- filename to read .netrc info from
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC_FILE, char *file);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a char pointer as parameter, pointing to a null\-terminated string
  12. containing the full path name to the \fIfile\fP you want libcurl to use as .netrc
  13. file. If this option is omitted, and \fICURLOPT_NETRC(3)\fP is set, libcurl checks
  14. for a .netrc file in the current user\(aqs home directory.
  15. The application does not have to keep the string around after setting this
  16. option.
  17. .SH DEFAULT
  18. NULL
  19. .SH PROTOCOLS
  20. This functionality affects all supported protocols
  21. .SH EXAMPLE
  22. .nf
  23. int main(void)
  24. {
  25. CURL *curl = curl_easy_init();
  26. if(curl) {
  27. CURLcode ret;
  28. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
  29. curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
  30. curl_easy_setopt(curl, CURLOPT_NETRC_FILE, "/tmp/magic-netrc");
  31. ret = curl_easy_perform(curl);
  32. }
  33. }
  34. .fi
  35. .SH AVAILABILITY
  36. Added in curl 7.11.0
  37. .SH RETURN VALUE
  38. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  39. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  40. .SH SEE ALSO
  41. .BR CURLOPT_NETRC (3),
  42. .BR CURLOPT_PASSWORD (3),
  43. .BR CURLOPT_USERNAME (3)