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