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