GNURLINFO_...ENTRY_PATH(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

okay bestie, this page is GNURLINFO_...ENTRY_PATH(3) from the curl_easy_getinfo options manual β€” yes, the long title is right there, folded in with love πŸ’–. The actual thing it documents is CURLINFO_FTP_ENTRY_PATH, and it's all about grabbing your FTP server entry path. Let's go.

πŸŽ€ NAME πŸŽ€

CURLINFO_FTP_ENTRY_PATH β€” get entry path in FTP server. periodt.

✨ SYNOPSIS ✨

Include this header like the icon you are:

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FTP_ENTRY_PATH, char
**path);

πŸ’… DESCRIPTION πŸ’…

Pass a pointer to a char pointer to receive a pointer to a string holding the path of the entry path. That is the initial path libcurl ended up in when logging on to the remote FTP server. If something goes wrong, it stores a NULL as the pointer.

The path pointer will be NULL or pointing to private memory you MUST NOT free β€” it gets freed when you call curl_easy_cleanup(3) on the corresponding CURL handle. Do not touch that memory, bestie, seriously πŸ’€.

🌈 PROTOCOLS 🌈

FTP(S) and SFTP. no cap.

πŸ“ EXAMPLE πŸ“

Here's the whole little vibe check in C:

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");

  res = curl_easy_perform(curl);

  if(!res) {
    /* extract the entry path */
    char *ep = NULL;
    res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep);
    if(!res && ep) {
      printf("Entry path was: %s\n", ep);
    }
  }
  curl_easy_cleanup(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.15.4. Works for SFTP since 7.21.4 β€” those numbers are literally the timeline, bestie.

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. That's the whole mood.

πŸ¦‹ SEE ALSO πŸ¦‹

Go peek at curl_easy_getinfo(3), curl_easy_setopt(3), β€” yep, the original has that trailing comma too, keeping it exact πŸ’….


mwah 🫢 this page was brought to you by libcurl 7.44.0, dated 12 Sep 2015 β€” iconic footer behavior, no cap.

πŸ“¦ where this page comes from