CURLOPT_FNMATCH_DATA(3)
π CURLOPT_FNMATCH_DATA(3) β bestie edition β¨
okay so this page lives in the Library Functions Manual and it's literally all about CURLOPT_FNMATCH_DATA(3), no cap. it's short, it's sweet, it's giving "small but crucial" π
πΈ NAME πΈ
CURLOPT_FNMATCH_DATA β the pointer you pass along to your fnmatch callback. that's it. that's the whole vibe π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FNMATCH_DATA,
void *pointer);
π¦ DESCRIPTION π¦
so here's the tea β β you hand libcurl a pointer, and libcurl is literally not going to touch it. like, zero touching. not even a little peek. instead it gets passed straight through as the ptr argument to whatever function you set with CURLOPT_FNMATCH_FUNCTION(3). π«Ά
it's giving "you carry the bag, we do the wildcard matching" and honestly? iconic.
π DEFAULT π
NULL
(yeah. nothing. empty. the void. very main-character-of-emptiness of it π)
π PROTOCOLS π
this functionality affects ftp only. ftp girlies, this one's for you π§
β EXAMPLE β
here's the whole thing, verbatim, because we respect the source:
extern int string_match(const char *s1, const char *s2);
struct local_stuff {
void *custom;
};
static int my_fnmatch(void *clientp,
const char *pattern, const char *string)
{
struct local_stuff *my = clientp;
printf("my ptr: %p\n", my->custom);
if(string_match(pattern, string))
return CURL_FNMATCHFUNC_MATCH;
else
return CURL_FNMATCHFUNC_NOMATCH;
}
int main(void)
{
struct local_stuff local_data;
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "ftp://ftp.example.com/file*");
curl_easy_setopt(curl, CURLOPT_WILDCARDMATCH, 1L);
curl_easy_setopt(curl, CURLOPT_FNMATCH_FUNCTION, my_fnmatch);
curl_easy_setopt(curl, CURLOPT_FNMATCH_DATA, &local_data);
curl_easy_perform(curl);
}
}
see how &local_data slides right into CURLOPT_FNMATCH_DATA and then shows up as clientp in my_fnmatch? it's giving "the circle of life" π¦β¨
π AVAILABILITY π
added in curl 7.21.0. vintage, but still slaying π
π₯ RETURN VALUE π₯
curl_easy_setopt(3) returns a CURLcode indicating success or error. very demure, very straightforward.
CURLE_OK(0) means everything was OK β slay β- non-zero means an error occurred π β see
libcurl-errors(3)for the full drama
π SEE ALSO π
lowkey go read both of these next, they're the other two-thirds of the wildcard-matching trifecta π«Ά
and that's the whole page bestie, hope it ate π this one comes from libcurl, dated 2026-10-12, and it was originally titled CURLOPT_FNMATCH_DATA(3) in case the vibe check required receipts. mwah ππ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms