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
12Added-in: 7.15.4
13---
14
15# NAME
16
17CURLINFO_FTP_ENTRY_PATH - get entry path in FTP server
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FTP_ENTRY_PATH, char **path);
25~~~
26
27# DESCRIPTION
28
29Pass a pointer to a char pointer to receive a pointer to a string holding the
30path of the entry path. That is the initial path libcurl ended up in when
31logging on to the remote FTP server. This stores a NULL as pointer if
32something is wrong.
33
34The **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
36CURL handle.
37
38# %PROTOCOLS%
39
40# EXAMPLE
41
42~~~c
43int 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
67Works for SFTP since 7.21.4
68
69# %AVAILABILITY%
70
71# RETURN VALUE
72
73Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
74