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