curl_easy_option_next(3)
π curl_easy_option_next β like, the actual page
okay so real quick: this is from the Library Functions Manual, bestie. Buckle up, we're iterating π¦
β¨ NAME β¨
curl_easy_option_next β iterate over easy setopt options. yes, that's the whole name section, she's short and iconic π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
const struct curl_easyoption *
curl_easy_option_next(const struct curl_easyoption *prev);
β¨ DESCRIPTION β¨
so this function hands you back a pointer to either the first or the next curl_easyoption struct, which is genuinely giving you the ability to iterate over all the options known to curl_easy_setopt(3) in this particular instance of libcurl. obsessed. π₯
pass a NULL argument as prev and you get the first option returned β pass in the current option and you get the next one back. and if there's literally no more option to return? curl_easy_option_next(3) returns NULL. that's it, that's the vibe check π
the options this function returns are the ones known to this libcurl, plus the info about what argument type they want. very helpful, no cap π«Ά
and if the CURLOT_FLAG_ALIAS bit is set in the flags field, that means the name is provided for backwards compatibility as an alias. iykyk β
β¨ struct β¨
okay this part is code, so i'm not touching a single character of it β copy it exactly, bestie, fr fr:
typedef enum {
CURLOT_LONG, /* long (a range of values) */
CURLOT_VALUES, /* (a defined set or bitmask) */
CURLOT_OFF_T, /* curl_off_t (a range of values) */
CURLOT_OBJECT, /* pointer (void *) */
CURLOT_STRING, /* (char * to null-terminated buffer) */
CURLOT_SLIST, /* (struct curl_slist *) */
CURLOT_CBPTR, /* (void * passed as-is to a callback) */
CURLOT_BLOB, /* blob (struct curl_blob *) */
CURLOT_FUNCTION /* function pointer */
} curl_easytype;
/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size
to use for curl_easy_setopt() for the given id */
struct curl_easyoption {
const char *name;
CURLoption id;
curl_easytype type;
unsigned int flags;
};
β¨ PROTOCOLS β¨
this functionality affects all supported protocols. all of them. every single one π
β¨ EXAMPLE β¨
here's the moment you've been waiting for, a whole little main that iterates over all available options ππ
int main(void)
{
/* iterate over all available options */
const struct curl_easyoption *opt;
opt = curl_easy_option_next(NULL);
while(opt) {
printf("Name: %s\n", opt->name);
opt = curl_easy_option_next(opt);
}
}
β¨ AVAILABILITY β¨
added in curl 7.73.0. she's not vintage, she's not brand new β she's just right πΈ
β¨ RETURN VALUE β¨
a pointer to the curl_easyoption struct for the next option β or NULL if there are no more options. that's the whole deal π
β¨ SEE ALSO β¨
bestie note: everything above is exactly what the page says, i just gave it main character energy. nothing invented, nothing skipped π
k bye, this page was brought to you by libcurl, dated 2026-10-12 β slay, go iterate some options πβ¨
π¦ 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