~~~c
#include <curl/curl.h>
-typedef enum {
- CURLFTP_CREATE_DIR_NONE,
- CURLFTP_CREATE_DIR,
- CURLFTP_CREATE_DIR_RETRY
-} curl_ftpcreatedir;
+#define CURLFTP_CREATE_DIR_NONE 0L
+#define CURLFTP_CREATE_DIR 1L
+#define CURLFTP_CREATE_DIR_RETRY 2L
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_CREATE_MISSING_DIRS,
long create);
#endif /* !CURL_NO_OLDIES */
/* parameter for the CURLOPT_FTP_SSL_CCC option */
+#define CURLFTPSSL_CCC_NONE 0L /* do not send CCC */
+#define CURLFTPSSL_CCC_PASSIVE 1L /* Let the server initiate the shutdown */
+#define CURLFTPSSL_CCC_ACTIVE 2L /* Initiate the shutdown */
+
typedef enum {
- CURLFTPSSL_CCC_NONE, /* do not send CCC */
- CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
- CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
- CURLFTPSSL_CCC_LAST /* not an option, never use */
+ CURLFTPSSL_CCC_LAST = 3 /* not an option, never use */
} curl_ftpccc;
/* parameter for the CURLOPT_FTPSSLAUTH option */
+#define CURLFTPAUTH_DEFAULT 0L /* let libcurl decide */
+#define CURLFTPAUTH_SSL 1L /* use "AUTH SSL" */
+#define CURLFTPAUTH_TLS 2L /* use "AUTH TLS" */
+
typedef enum {
- CURLFTPAUTH_DEFAULT, /* let libcurl decide */
- CURLFTPAUTH_SSL, /* use "AUTH SSL" */
- CURLFTPAUTH_TLS, /* use "AUTH TLS" */
- CURLFTPAUTH_LAST /* not an option, never use */
+ CURLFTPAUTH_LAST = 3 /* not an option, never use */
} curl_ftpauth;
/* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
+#define CURLFTP_CREATE_DIR_NONE 0L /* do NOT create missing dirs! */
+#define CURLFTP_CREATE_DIR 1L /* (FTP/SFTP) if CWD fails, try MKD and
+ then CWD again if MKD succeeded, for
+ SFTP this does similar magic */
+#define CURLFTP_CREATE_DIR_RETRY 2L /* (FTP only) if CWD fails, try MKD and
+ then CWD again even if MKD failed! */
+
typedef enum {
- CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
- CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
- again if MKD succeeded, for SFTP this does
- similar magic */
- CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
- again even if MKD failed! */
- CURLFTP_CREATE_DIR_LAST /* not an option, never use */
+ CURLFTP_CREATE_DIR_LAST = 3 /* not an option, never use */
} curl_ftpcreatedir;
/* parameter for the CURLOPT_FTP_FILEMETHOD option */
+#define CURLFTPMETHOD_DEFAULT 0L /* let libcurl pick */
+#define CURLFTPMETHOD_MULTICWD 1L /* single CWD operation for each path
+ part */
+#define CURLFTPMETHOD_NOCWD 2L /* no CWD at all */
+#define CURLFTPMETHOD_SINGLECWD 3L /* one CWD to full dir, then work on file */
+
typedef enum {
- CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
- CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
- CURLFTPMETHOD_NOCWD, /* no CWD at all */
- CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
- CURLFTPMETHOD_LAST /* not an option, never use */
+ CURLFTPMETHOD_LAST = 4 /* not an option, never use */
} curl_ftpmethod;
/* bitmask defines for CURLOPT_HEADEROPT */
requested. Try an FTPS connection now */
ftpc->count3 = 0;
- switch(data->set.ftpsslauth) {
+ switch((long)data->set.ftpsslauth) {
case CURLFTPAUTH_DEFAULT:
case CURLFTPAUTH_SSL:
ftpc->count2 = 1; /* add one to get next */
* server, but we do not send one. Let's hope other servers do
* the same... */
result = Curl_ssl_cfilter_remove(data, FIRSTSOCKET,
- (data->set.ftp_ccc == CURLFTPSSL_CCC_ACTIVE));
+ (data->set.ftp_ccc == (unsigned char)CURLFTPSSL_CCC_ACTIVE));
if(result)
failf(data, "Failed to clear the command channel (CCC)");
*/
if((arg < CURLFTPAUTH_DEFAULT) || (arg >= CURLFTPAUTH_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
- data->set.ftpsslauth = (unsigned char)(curl_ftpauth)arg;
+ data->set.ftpsslauth = (unsigned char)arg;
break;
case CURLOPT_ACCEPTTIMEOUT_MS:
/*
/* new in curl 7.16.1 */
if(config->ftp_ssl_ccc)
- my_setopt_enum(curl, CURLOPT_FTP_SSL_CCC, (long)config->ftp_ssl_ccc_mode);
+ my_setopt_enum(curl, CURLOPT_FTP_SSL_CCC, config->ftp_ssl_ccc_mode);
my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
unsigned long timecond;
HttpReq httpreq;
long proxyver; /* set to CURLPROXY_HTTP* define */
- int ftp_ssl_ccc_mode;
- int ftp_filemethod;
+ long ftp_ssl_ccc_mode;
+ long ftp_filemethod;
enum {
CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl,
by using the default behavior for -o, -O, and -J.
return PARAM_OK;
}
-int ftpfilemethod(struct OperationConfig *config, const char *str)
+long ftpfilemethod(struct OperationConfig *config, const char *str)
{
if(curl_strequal("singlecwd", str))
return CURLFTPMETHOD_SINGLECWD;
return CURLFTPMETHOD_MULTICWD;
}
-int ftpcccmethod(struct OperationConfig *config, const char *str)
+long ftpcccmethod(struct OperationConfig *config, const char *str)
{
if(curl_strequal("passive", str))
return CURLFTPSSL_CCC_PASSIVE;
ParameterError add2list(struct curl_slist **list, const char *ptr);
-int ftpfilemethod(struct OperationConfig *config, const char *str);
+long ftpfilemethod(struct OperationConfig *config, const char *str);
-int ftpcccmethod(struct OperationConfig *config, const char *str);
+long ftpcccmethod(struct OperationConfig *config, const char *str);
long delegation(struct OperationConfig *config, const char *str);
*/
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res == CURLE_OK) {
}
test_setopt(curl, CURLOPT_URL, libtest_arg2);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
test_setopt(curl, CURLOPT_URL, newURL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = curl_maprintf("%s/folderB/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
curl_free(newURL);
newURL = curl_maprintf("%s/folderA/661", URL);
test_setopt(curl, CURLOPT_URL, newURL);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
res = curl_easy_perform(curl);
if(res != CURLE_REMOTE_FILE_NOT_FOUND)
goto test_cleanup;
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_SINGLECWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);
if(res)
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_NOBODY, 1L);
- test_setopt(curl, CURLOPT_FTP_FILEMETHOD, (long) CURLFTPMETHOD_NOCWD);
+ test_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
test_setopt(curl, CURLOPT_QUOTE, slist);
res = curl_easy_perform(curl);