* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* 01-29-97 11:32PM <DIR> prog
*/
-#include "setup.h"
+#include "curl_setup.h"
-#include "ftplistparser.h"
-#include "curl_fnmatch.h"
+#ifndef CURL_DISABLE_FTP
+
+#include <curl/curl.h>
#include "urldata.h"
-#include "ftp.h"
#include "fileinfo.h"
#include "llist.h"
#include "strtoofft.h"
#include "rawstr.h"
#include "ftp.h"
+#include "ftplistparser.h"
+#include "curl_fnmatch.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
return CURLE_OK;
}
-/* Curl_ftp_parselist is a write callback function */
-
size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
void *connptr)
{
unsigned long i = 0;
CURLcode rc;
- if(bufflen >= CURL_WRITEFUNC_PAUSE)
- /* CURL_WRITEFUNC_PAUSE limits input size */
- return CURL_WRITEFUNC_OUT_OF_MEMORY;
-
if(parser->error) { /* error in previous call */
/* scenario:
* 1. call => OK..
* 3. (last) call => is skipped RIGHT HERE and the error is hadled later
* in wc_statemach()
*/
- if(parser->error == CURLE_OUT_OF_MEMORY)
- return CURL_WRITEFUNC_OUT_OF_MEMORY;
-
return bufflen;
}
parser->file_data = Curl_fileinfo_alloc();
if(!parser->file_data) {
parser->error = CURLE_OUT_OF_MEMORY;
- return CURL_WRITEFUNC_OUT_OF_MEMORY;
+ return bufflen;
}
parser->file_data->b_data = malloc(FTP_BUFFER_ALLOCSIZE);
if(!parser->file_data->b_data) {
PL_ERROR(conn, CURLE_OUT_OF_MEMORY);
- return CURL_WRITEFUNC_OUT_OF_MEMORY;
+ return bufflen;
}
parser->file_data->b_size = FTP_BUFFER_ALLOCSIZE;
parser->item_offset = 0;
parser->file_data = NULL;
parser->error = CURLE_OUT_OF_MEMORY;
PL_ERROR(conn, CURLE_OUT_OF_MEMORY);
- return CURL_WRITEFUNC_OUT_OF_MEMORY;
+ return bufflen;
}
}
finfo->b_data[parser->item_length - 1] = 0;
if(strncmp("total ", finfo->b_data, 6) == 0) {
char *endptr = finfo->b_data+6;
- /* here we can deal with directory size */
+ /* here we can deal with directory size, pass the leading white
+ spaces and then the digits */
while(ISSPACE(*endptr))
endptr++;
+ while(ISDIGIT(*endptr))
+ endptr++;
if(*endptr != 0) {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;
return bufflen;
}
+
+#endif /* CURL_DISABLE_FTP */