1CURLOPT_FNMATCH_FUNCTION(3)curl_easy_setopt optionsCURLOPT_FNMATCH_FUNCTION(3)
2
3
4

NAME

6       CURLOPT_FNMATCH_FUNCTION - wildcard matching function callback
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       int fnmatch_callback(void *ptr,
12                            const char *pattern,
13                            const char *string);
14
15       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FNMATCH_FUNCTION,
16                                 fnmatch_callback);
17

DESCRIPTION

19       Pass a pointer to your callback function, which should match the proto‐
20       type shown above.
21
22       This callback is used for wildcard matching.
23
24       Return  CURL_FNMATCHFUNC_MATCH   if   pattern   matches   the   string,
25       CURL_FNMATCHFUNC_NOMATCH  if  not  or CURL_FNMATCHFUNC_FAIL if an error
26       occurred.
27

DEFAULT

29       NULL == an internal function for wildcard matching.
30

PROTOCOLS

32       FTP
33

EXAMPLE

35       static int my_fnmatch(void *clientp,
36                             const char *pattern, const char *string)
37       {
38         struct local_stuff *data = (struct local_stuff *)clientp;
39         if(string_match(pattern, string))
40           return CURL_FNMATCHFUNC_MATCH;
41         else
42           return CURL_FNMATCHFUNC_NOMATCH;
43       }
44
45       {
46         struct local_stuff local_data;
47         curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/file*");
48         curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
49         curl_easy_setopt(curl, CURLOPT_FNMATCH_FUNCTION, my_fnmatch);
50         curl_easy_setopt(curl, CURLOPT_FNMATCH_DATA, &local_data);
51       }
52

AVAILABILITY

54       Added in 7.21.0
55

RETURN VALUE

57       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
58       if not.
59

SEE ALSO

61       CURLOPT_FNMATCH_DATA(3), CURLOPT_DEBUGFUNCTION(3),
62
63
64
65libcurl 7.61.1                   May 31, 2017      CURLOPT_FNMATCH_FUNCTION(3)
Impressum