GNURLOPT_NETRC_FILE(3)
π GNURLOPT_NETRC_FILE(3) Β· curl_easy_setopt options π
okay bestie, welcome to the GNURLOPT_NETRC_FILE page β it's part of the curl_easy_setopt options manual, and it's literally all about telling libcurl which .netrc file to read from. π
β¨ NAME β¨
CURLOPT_NETRC_FILEβ file name to read.netrcinfo from. yep, that's the whole vibe: you're picking the file name. π
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NETRC_FILE, char *file);
π¦ DESCRIPTION π¦
Pass a char * as the parameter, pointing at a null-terminated string containing the full path name to the file you want libcurl to use as its .netrc file. Like, the whole path, bestie. β¨
If this option is omitted, and CURLOPT_NETRC(3) is set, libcurl will attempt to find a .netrc file in the current user's home directory. cute little fallback behavior, no cap. π«Ά
The application does not have to keep the string around after setting this option. so you can let that string go, it's not clingy. π
π DEFAULT π
NULL
π PROTOCOLS π
All β every protocol, periodt. π
π₯ EXAMPLE π₯
CURL *curl = curl_easy_init();
if(curl) {
CURLcode ret;
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/");
curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
curl_easy_setopt(curl, CURLOPT_NETRC_FILE, "/tmp/magic-netrc");
ret = curl_easy_perform(curl);
}
β AVAILABILITY β
Added in 7.10.9 β she's been around since back then. π
π RETURN VALUE π
Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space. no cap, those are the three outcomes. π
π SEE ALSO π
okay that's the whole page, bestie! π§ this was libcurl 7.37.0, dated 19 Jun 2014 β shoutout to the GNURLOPT_NETRC_FILE(3) manual page, mwah π
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms