1 /*****************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * $Id: lib539.c,v 1.1.1.1 2008-09-23 16:32:06 hoffman Exp $
18 struct curl_slist
*slist
;
20 if (curl_global_init(CURL_GLOBAL_ALL
) != CURLE_OK
) {
21 fprintf(stderr
, "curl_global_init() failed\n");
22 return TEST_ERR_MAJOR_BAD
;
25 if ((curl
= curl_easy_init()) == NULL
) {
26 fprintf(stderr
, "curl_easy_init() failed\n");
27 curl_global_cleanup();
28 return TEST_ERR_MAJOR_BAD
;
32 * Begin with cURL set to use a single CWD to the URL's directory.
34 curl_easy_setopt(curl
, CURLOPT_URL
, URL
);
35 curl_easy_setopt(curl
, CURLOPT_VERBOSE
, 1L);
36 curl_easy_setopt(curl
, CURLOPT_FTP_FILEMETHOD
, CURLFTPMETHOD_SINGLECWD
);
38 res
= curl_easy_perform(curl
);
41 * Change the FTP_FILEMETHOD option to use full paths rather than a CWD
42 * command. Alter the URL's path a bit, appending a "./". Use an innocuous
43 * QUOTE command, after which cURL will CWD to ftp_conn->entrypath and then
44 * (on the next call to ftp_statemach_act) find a non-zero ftpconn->dirdepth
45 * even though no directories are stored in the ftpconn->dirs array (after a
48 newURL
= strcat (strcpy ((char*)malloc (strlen (URL
) + 3),
51 slist
= curl_slist_append (NULL
, "SYST");
53 curl_easy_setopt(curl
, CURLOPT_URL
, newURL
);
54 curl_easy_setopt(curl
, CURLOPT_FTP_FILEMETHOD
, CURLFTPMETHOD_NOCWD
);
55 curl_easy_setopt(curl
, CURLOPT_QUOTE
, slist
);
57 res
= curl_easy_perform(curl
);
59 curl_slist_free_all(slist
);
61 curl_easy_cleanup(curl
);
62 curl_global_cleanup();