1CURLOPT_FNMATCH_FUNCTION(3)curl_easy_setopt optionsCURLOPT_FNMATCH_FUNCTION(3)
2
3
4
6 CURLOPT_FNMATCH_FUNCTION - wildcard match callback
7
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
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, CURL_FN‐
25 MATCHFUNC_NOMATCH if not or CURL_FNMATCHFUNC_FAIL if an error occurred.
26
28 NULL == an internal function for wildcard matching.
29
31 FTP
32
34 static int my_fnmatch(void *clientp,
35 const char *pattern, const char *string)
36 {
37 struct local_stuff *data = (struct local_stuff *)clientp;
38 if(string_match(pattern, string))
39 return CURL_FNMATCHFUNC_MATCH;
40 else
41 return CURL_FNMATCHFUNC_NOMATCH;
42 }
43
44 {
45 struct local_stuff local_data;
46 curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/file*");
47 curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
48 curl_easy_setopt(curl, CURLOPT_FNMATCH_FUNCTION, my_fnmatch);
49 curl_easy_setopt(curl, CURLOPT_FNMATCH_DATA, &local_data);
50 }
51
53 Added in 7.21.0
54
56 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
57 if not.
58
60 CURLOPT_FNMATCH_DATA(3), CURLOPT_DEBUGFUNCTION(3),
61
62
63
64libcurl 8.0.1 January 02, 2023 CURLOPT_FNMATCH_FUNCTION(3)