aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2010-05-16 02:49:08 +0200
committerKamil Dudka <kdudka@redhat.com>2010-05-16 02:52:33 +0200
commit2ffe834bffa893efcd8942736ab14e311a0087b3 (patch)
treef05892e9d30c465ebf990bd1a8e01fc517e156fa /lib
parent027ceb37a1075bb585c8f5917a26f37cdfa352d6 (diff)
ftp wildcard: a new option CURLOPT_FNMATCH_DATA
Diffstat (limited to 'lib')
-rw-r--r--lib/curl_fnmatch.c4
-rw-r--r--lib/curl_fnmatch.h2
-rw-r--r--lib/ftplistparser.c2
-rw-r--r--lib/url.c4
-rw-r--r--lib/urldata.h1
5 files changed, 9 insertions, 4 deletions
diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c
index 9628844ad..91485a52d 100644
--- a/lib/curl_fnmatch.c
+++ b/lib/curl_fnmatch.c
@@ -401,8 +401,10 @@ static int loop(const unsigned char *pattern, const unsigned char *string)
}
}
-int Curl_fnmatch(const char *pattern, const char *string)
+int Curl_fnmatch(void *ptr, const char *pattern, const char *string)
{
+ (void)ptr; /* the argument is specified by the curl_fnmatch_callback
+ prototype, but not used by Curl_fnmatch() */
if(!pattern || !string) {
return CURL_FNMATCH_FAIL;
}
diff --git a/lib/curl_fnmatch.h b/lib/curl_fnmatch.h
index 3ffbc4575..6335d0312 100644
--- a/lib/curl_fnmatch.h
+++ b/lib/curl_fnmatch.h
@@ -39,6 +39,6 @@
* keywords: alnum, digit, xdigit, alpha, print, blank, lower, graph, space
* and upper (use as "[[:alnum:]]")
*/
-int Curl_fnmatch(const char *pattern, const char *string);
+int Curl_fnmatch(void *ptr, const char *pattern, const char *string);
#endif /* HEADER_CURL_FNMATCH_H */
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c
index faf314fe2..ff7045b1e 100644
--- a/lib/ftplistparser.c
+++ b/lib/ftplistparser.c
@@ -330,7 +330,7 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata *conn,
compare = Curl_fnmatch;
/* filter pattern-corresponding filenames */
- if(compare(wc->pattern, finfo->filename) == 0) {
+ if(compare(conn->data->set.fnmatch_data, wc->pattern, finfo->filename) == 0) {
/* discard symlink which is containing multiple " -> " */
if((finfo->filetype == CURLFILETYPE_SYMLINK) &&
(strstr(finfo->strings.target, " -> "))) {
diff --git a/lib/url.c b/lib/url.c
index cc73750e0..31976300c 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2478,7 +2478,9 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
case CURLOPT_CHUNK_DATA:
data->wildcard.customptr = va_arg(param, void *);
break;
-
+ case CURLOPT_FNMATCH_DATA:
+ data->set.fnmatch_data = va_arg(param, void *);
+ break;
default:
/* unknown tag and its companion, just ignore: */
result = CURLE_FAILED_INIT; /* correct this */
diff --git a/lib/urldata.h b/lib/urldata.h
index 2c1b2fc4a..9db06405e 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1424,6 +1424,7 @@ struct UserDefined {
stopped */
curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds
to pattern (e.g. if WILDCARDMATCH is on) */
+ void *fnmatch_data;
};
struct Names {