cURL
Haxx ad
libcurl

Shopping cart software, Online file storage, Online photo storage, Hosted shopping cart, Contact management software, Email marketing software, Project management software, Issue tracking software, Online notepad, Web publishing software

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Archives

RE: response to quoted pwd command in libcurl

From: Xu, Qiang (FXSGSC) <Qiang.Xu_at_fujixerox.com>
Date: Thu, 12 Nov 2009 11:42:50 +0800

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] 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.

I've written a small program to do the test. Here is the code:
===================================================
#include <stdio.h>
#include <curl/curl.h>
#include <time.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd = curl_easy_init();
  FILE *fDownload = NULL;
  FILE *fHeader = NULL;
  struct curl_slist *headers = NULL;

  if ((fDownload = fopen("./downloadFile", "w")) == NULL)
  {
          printf("can't open output file");
          return -1;
  }

  if ((fHeader = fopen("./headerFile", "w")) == NULL)
  {
          printf("can't open output file");
          return -1;
  }

  headers = curl_slist_append(headers, "pwd");
  curl_easy_setopt(hnd, CURLOPT_QUOTE, headers);
  curl_easy_setopt(hnd, CURLOPT_WRITEHEADER, fHeader);
  curl_easy_setopt(hnd, CURLOPT_WRITEDATA, fDownload);
  curl_easy_setopt(hnd, CURLOPT_HEADER, 1);

  curl_easy_setopt(hnd, CURLOPT_URL, "sftp://13.198.98.190/~/scan/");
  curl_easy_setopt(hnd, CURLOPT_USERPWD, "qxu:fair123");
  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1);

  ret = curl_easy_perform(hnd);

  curl_slist_free_all(headers);
  curl_easy_cleanup(hnd);
  return (int)ret;
}
===================================================
To my dismay, the feedback to the quoted command "pwd" is not written into "./headerFile", while the directory's content is listed in "./downloadFile". What shall I do to make the feedback go into the output file?

Looking forward to help,
Xu Qiang
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-12

These mail archives are generated by hypermail.

donate! Page updated November 16, 2009.
web site info

File upload with ASP.NET