mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:53:32 +03:00
ftp wildcard: a new option CURLOPT_FNMATCH_DATA
This commit is contained in:
parent
027ceb37a1
commit
2ffe834bff
11 changed files with 27 additions and 10 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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, " -> "))) {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue