GNURLOPT_FNMATCH_DATA(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ¦‹ 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