GNURLOPT_FNMATCH_DATA(3)
π¦ GNURLOPT_FNMATCH_DATA(3) π¦
okay bestie, this page comes from the curl_easy_setopt options manual, and it's all about a custom pointer that libcurl promises not to touch. yes, a pointer with main character energy. π
β¨ NAME β¨
CURLOPT_FNMATCH_DATA β a custom pointer to the fnmatch callback. that's the whole name, and it ate.
πΈ SYNOPSIS πΈ
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FNMATCH_DATA,
void *pointer);
π DESCRIPTION π
so you pass a pointer, and libcurl will leave it completely untouched β not even a little poke β then it passes that same pointer as the ptr argument to CURLOPT_FNMATCH_FUNCTION(3). that's the gig, bestie. it's giving "custom data, but make it fnmatch." β¨
π DEFAULT π
NULL β the default is just nothing there. iconic empty-hands behavior, honestly.
π¦ PROTOCOLS π¦
FTP β this one is FTP-only, periodt.
π₯ EXAMPLE π₯
here's the whole setup, with the callback and the curl_easy_setopt calls doing their thing:
static int my_fnmatch(void *clientp,
const char *pattern, const char *string)
{
struct local_stuff *data = (struct local_stuff *)clientp;
if(string_match(pattern, string))
return CURL_FNMATCHFUNC_MATCH;
else
return CURL_FNMATCHFUNC_NOMATCH;
}
{
struct local_stuff local_data;
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);
}
β AVAILABILITY β
Added in 7.21.0 β yes, she's been around, and she's still serving. π
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if it is not. no cap, that's the whole return-value tea. slay.
π SEE ALSO π
okay that's the page, bestie. signed off with libcurl 7.37.0, dated 19 Jun 2014 β mwah, bye! ππ
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms