1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_NETRC_FILE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_NETRC (3) 9 - CURLOPT_PASSWORD (3) 10 - CURLOPT_USERNAME (3) 11--- 12 13# NAME 14 15CURLOPT_NETRC_FILE - filename to read .netrc info from 16 17# SYNOPSIS 18 19~~~c 20#include <curl/curl.h> 21 22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC_FILE, char *file); 23~~~ 24 25# DESCRIPTION 26 27Pass a char pointer as parameter, pointing to a null-terminated string 28containing the full path name to the *file* you want libcurl to use as .netrc 29file. If this option is omitted, and CURLOPT_NETRC(3) is set, libcurl checks 30for a .netrc file in the current user's home directory. 31 32The application does not have to keep the string around after setting this 33option. 34 35# DEFAULT 36 37NULL 38 39# PROTOCOLS 40 41All 42 43# EXAMPLE 44 45~~~c 46int main(void) 47{ 48 CURL *curl = curl_easy_init(); 49 if(curl) { 50 CURLcode ret; 51 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/"); 52 curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL); 53 curl_easy_setopt(curl, CURLOPT_NETRC_FILE, "/tmp/magic-netrc"); 54 ret = curl_easy_perform(curl); 55 } 56} 57~~~ 58 59# AVAILABILITY 60 61Added in 7.10.9 62 63# RETURN VALUE 64 65Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or 66CURLE_OUT_OF_MEMORY if there was insufficient heap space. 67