CURLOPT_TELNETOPTIONS(3)

πŸ’… CURLOPT_TELNETOPTIONS(3) β€” set of telnet options

Okay bestie, so you're poking at libcurl's manual, and this little icon is all about telling telnet what's up πŸ¦‹


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TELNETOPTIONS,
                          struct curl_slist *cmds);

🌸 DESCRIPTION 🌸

So what you do is hand over a pointer to a curl_slist stuffed with variables that get passed to the telnet negotiations. The variables gotta be in the format <option=value> β€” that's the whole vibe, no cap.

libcurl supports these options: TTYPE, XDISPLOC and NEW_ENV. For the details, go read the TELNET standard, iykyk πŸ“–

If you use this option multiple times, the last set list overrides the previous ones β€” it's giving main character energy, last one wins πŸ’…

Set it to NULL to disable its use again.

⚠️ Lowkey important: libcurl does not copy the list. You have to keep it around until after the transfer has completed. Don't let it get freed on you, bestie 😭

πŸŽ€ DEFAULT πŸŽ€

NULL


πŸ¦‹ PROTOCOLS πŸ¦‹

This functionality affects telnet only. Periodt.


⭐ EXAMPLE ⭐

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    struct curl_slist *options;
    options = curl_slist_append(NULL, "TTTYPE=vt100");
    options = curl_slist_append(options, "USER=foobar");
    curl_easy_setopt(curl, CURLOPT_URL, "telnet://example.com/");
    curl_easy_setopt(curl, CURLOPT_TELNETOPTIONS, options);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    curl_slist_free_all(options);
  }
}

🌈 AVAILABILITY 🌈

Added in curl 7.7 β€” vintage, honestly πŸ‘‘


πŸ’– RETURN VALUE πŸ’–

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK 🫢 β€” a non-zero value means an error occurred, so go check libcurl-errors(3), bestie.


πŸ‘€ SEE ALSO πŸ‘€


Okay that's the whole page, mwah πŸ’‹ This lil' gem comes to you from the libcurl manual, dated 2026-10-12 β€” go forth and negotiate your telnet options, icon ✨

πŸ“¦ where this page comes from