> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > Daniel Stenberg > Sent: Wednesday, November 11, 2009 3:10 AM > To: libcurl development > Subject: Re: response to quoted pwd command in libcurl > > On Tue, 10 Nov 2009, Xu, Qiang (FXSGSC) wrote: > > > The command seems to be successful, but I can only see the > > destination directory's content listing. How can I retrieve the > > result of the quoted command "pwd", both by curl command > > and by libcurl? > > It is sent as a header, so use the header callback for that.
>From http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTQUOTE and >http://curl.haxx.se/libcurl/c/libcurl-tutorial.html, I guess the code should >be somewhat wrtten like the following: ======================================================== CURL *handle = NULL; struct curl_slist *headers; ... handle = curl_easy_init(); ... curl_easy_setopt(CURLOPT_URL, "sftp://13.198.98.190/"); ... headers = curl_slist_append(headers, "pwd"); curl_easy_setopt(handle, CURLOPT_QUOTE, headers); curl_easy_setopt(handle, CURLOPT_HEADER, 1); /* A parameter set to 1 tells the library to include the header in the body output */ ... curl_easy_perform(handle); ... curl_slist_free_all(headers); curl_easy_cleanup(handle); ======================================================== Does the above code look good? If there is anything wrong in it, pls point it out to me. By the way, what is the command-line option to use to have the same effect as "curl_easy_setopt(handle, CURLOPT_HEADER, 1)"? Thanks, Xu Qiang ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
