Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account


Bylon2 opened this issue Dec 18, 2019 · 2 comments


Bylon2 opened this issue Dec 18, 2019 · 2 comments


Copy link

Bylon2 commented Dec 18, 2019

I did this

Copie/Paste the example...

I expected the following

I expect the example to work... it does not!

In fact there is a typo (same one in POSTQUOTE and QUOTE)

struct curl_slist *h = NULL;
h = curl_slist_append(h, "SYST");
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "");
  /* pass in the FTP commands to run */
  curl_easy_setopt(curl, CURLOPT_PREQUOTE, headerlist);
  ret = curl_easy_perform(curl);

$ gcc -Wall -std=c11 example.c -o example $(curl-config --cflags --libs)
example.c: In function ‘main’:

In file included from /usr/include/curl/curl.h:2402:0,
                 from example.c:3:
example.c:39:49: error: ‘headerlist’ undeclared (first use in this function)
  res = curl_easy_setopt(curl, CURLOPT_PREQUOTE, headerlist);

The curl_easy_setopt call should be instead:
curl_easy_setopt(curl, CURLOPT_PREQUOTE, h);

Alternatively, the example could start with:

struct curl_slist *headerlist = NULL;
headerlist = curl_slist_append(headerlist, "SYST");

... which is probably a better option because 'headerlist' is a more self descriptive variable than 'h':

Copy link

jay commented Dec 18, 2019

Thanks. I renamed it to cmdlist since it's not a headerlist.

Copy link

Bylon2 commented Dec 18, 2019

Excellent, thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Mar 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

No branches or pull requests

2 participants