1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_FTP_ENTRY_PATH 5Section: 3 6Source: libcurl 7See-also: 8 - curl_easy_getinfo (3) 9 - curl_easy_setopt (3) 10--- 11 12# NAME 13 14CURLINFO_FTP_ENTRY_PATH - get entry path in FTP server 15 16# SYNOPSIS 17 18~~~c 19#include <curl/curl.h> 20 21CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FTP_ENTRY_PATH, char **path); 22~~~ 23 24# DESCRIPTION 25 26Pass a pointer to a char pointer to receive a pointer to a string holding the 27path of the entry path. That is the initial path libcurl ended up in when 28logging on to the remote FTP server. This stores a NULL as pointer if 29something is wrong. 30 31The **path** pointer is NULL or points to private memory. You MUST NOT free 32- it gets freed when you call curl_easy_cleanup(3) on the corresponding 33CURL handle. 34 35# PROTOCOLS 36 37FTP(S) and SFTP 38 39# EXAMPLE 40 41~~~c 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com"); 48 49 res = curl_easy_perform(curl); 50 51 if(!res) { 52 /* extract the entry path */ 53 char *ep = NULL; 54 res = curl_easy_getinfo(curl, CURLINFO_FTP_ENTRY_PATH, &ep); 55 if(!res && ep) { 56 printf("Entry path was: %s\n", ep); 57 } 58 } 59 curl_easy_cleanup(curl); 60 } 61} 62~~~ 63 64# AVAILABILITY 65 66Added in 7.15.4. Works for SFTP since 7.21.4 67 68# RETURN VALUE 69 70Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 71