> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Xu, 
> Qiang (FXSGSC)
> Sent: Wednesday, November 11, 2009 5:00 PM
> To: libcurl development
> Subject: RE: response to quoted pwd command in libcurl
> 
> By the way, what is the command-line option to use to have 
> the same effect as "curl_easy_setopt(handle, CURLOPT_HEADER, 1)"?

>From man page, I found to achieve the purpose, the option to use is 
>"-i/--include". However, this still doesn't add the command feedback into the 
>output body:
=============================================================
q...@durian(pts/1):~/opensrc/curl-7.19.6/src[128]$ ./curl -u qxu:fair123 
sftp://13.198.98.190/~/scan/ -i --quote "pwd" --libcurl sftp_pwd_test.c
drwxrwxr-x    3 qxu      XOG_cc       9216 Nov  6 18:30 .
drwxrwxr-x   20 qxu      XOG_cc       3072 Nov 11 18:37 ..
drwxrwxr-x    2 qxu      XOG_cc       7168 Nov  5 16:14 sxc
-rwxr-xr-x    1 qxu      XOG_cc        560 Nov  5 16:13 ren3.pl
-rwxr-xr-x    1 qxu      XOG_cc        131 Nov  2 11:56 ren1.sh
-rw-r--r--    1 qxu      XOG_cc       2106 Nov  6 18:29 test.txt
-rwxr-xr-x    1 qxu      XOG_cc         88 Nov  5 16:15 ren2.sh
-rw-r--r--    1 qxu      XOG_cc       2106 Nov  6 18:30 test1.txt
=============================================================
To get the response to the command "pwd", what shall I do?

Looking forward to help,
Xu Qiang
/********* Sample code generated by the curl command line tool **********
 * Lines with [REMARK] below might need to be modified to make this code 
 * usable. Add error code checking where appropriate.
 * Compile this with a suitable header include path. Then link with 
 * libcurl.
 * If you use any *_LARGE options, make sure your compiler figure
 * out the correct size for the curl_off_t variable.
 * Read the details for all curl_easy_setopt() options online on:
 * http://curlm.haxx.se/libcurl/c/curl_easy_setopt.html
 ************************************************************************/
#define _FILE_OFFSET_BITS 64 /* for pre libcurl 7.19.0 curl_off_t magic */
#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd = curl_easy_init();
  /* curl_easy_setopt(hnd, CURLOPT_WRITEDATA, 0xbf915898); [REMARK] */
  /* curl_easy_setopt(hnd, CURLOPT_WRITEFUNCTION, 0x80501b0); [REMARK] */
  /* curl_easy_setopt(hnd, CURLOPT_READDATA, 0xbf9158d8); [REMARK] */
  /* curl_easy_setopt(hnd, CURLOPT_READFUNCTION, 0x8050140); [REMARK] */
  /* curl_easy_setopt(hnd, CURLOPT_SEEKDATA, 0xbf9158d8); [REMARK] */
  /* curl_easy_setopt(hnd, CURLOPT_SEEKFUNCTION, 0x8050100); [REMARK] */
  curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)-1);
  curl_easy_setopt(hnd, CURLOPT_URL, "sftp://13.198.98.190/~/scan/";);
  curl_easy_setopt(hnd, CURLOPT_PROXY, NULL);
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1);
  curl_easy_setopt(hnd, CURLOPT_HEADER, 1);
  curl_easy_setopt(hnd, CURLOPT_FAILONERROR, 0);
  curl_easy_setopt(hnd, CURLOPT_UPLOAD, 0);
  curl_easy_setopt(hnd, CURLOPT_DIRLISTONLY, 0);
  curl_easy_setopt(hnd, CURLOPT_APPEND, 0);
  curl_easy_setopt(hnd, CURLOPT_NETRC, 0);
  curl_easy_setopt(hnd, CURLOPT_FOLLOWLOCATION, 0);
  curl_easy_setopt(hnd, CURLOPT_UNRESTRICTED_AUTH, 0);
  curl_easy_setopt(hnd, CURLOPT_TRANSFERTEXT, 0);
  curl_easy_setopt(hnd, CURLOPT_USERPWD, "qxu:fair123");
  curl_easy_setopt(hnd, CURLOPT_PROXYUSERPWD, NULL);
  curl_easy_setopt(hnd, CURLOPT_NOPROXY, NULL);
  curl_easy_setopt(hnd, CURLOPT_RANGE, NULL);
  /* curl_easy_setopt(hnd, CURLOPT_ERRORBUFFER, 0xbf91571c); [REMARK] */
  curl_easy_setopt(hnd, CURLOPT_TIMEOUT, 0);
  curl_easy_setopt(hnd, CURLOPT_REFERER, NULL);
  curl_easy_setopt(hnd, CURLOPT_AUTOREFERER, 0);
  curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.19.6 (i686-pc-linux-gnu) 
libcurl/7.19.6 OpenSSL/0.9.8b zlib/1.2.3 libssh2/1.2");
  curl_easy_setopt(hnd, CURLOPT_FTPPORT, NULL);
  curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_LIMIT, 0);
  curl_easy_setopt(hnd, CURLOPT_LOW_SPEED_TIME, 0);
  curl_easy_setopt(hnd, CURLOPT_MAX_SEND_SPEED_LARGE, (curl_off_t)0);
  curl_easy_setopt(hnd, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t)0);
  curl_easy_setopt(hnd, CURLOPT_RESUME_FROM_LARGE, (curl_off_t)0);
  curl_easy_setopt(hnd, CURLOPT_COOKIE, NULL);
  curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSLCERT, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSLCERTTYPE, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSLKEY, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSLKEYTYPE, NULL);
  curl_easy_setopt(hnd, CURLOPT_KEYPASSWD, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSH_PRIVATE_KEYFILE, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSH_PUBLIC_KEYFILE, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYHOST, 2);
  curl_easy_setopt(hnd, CURLOPT_SSH_KNOWNHOSTS, "/home/qxu/.ssh/known_hosts");
  curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50);
  curl_easy_setopt(hnd, CURLOPT_CRLF, 0);
  /* curl_easy_setopt(hnd, CURLOPT_QUOTE, 0x83efd30); [REMARK] */
  curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, NULL);
  curl_easy_setopt(hnd, CURLOPT_PREQUOTE, NULL);
  curl_easy_setopt(hnd, CURLOPT_WRITEHEADER, NULL);
  curl_easy_setopt(hnd, CURLOPT_COOKIEFILE, NULL);
  curl_easy_setopt(hnd, CURLOPT_COOKIESESSION, 0);
  curl_easy_setopt(hnd, CURLOPT_SSLVERSION, 0);
  curl_easy_setopt(hnd, CURLOPT_TIMECONDITION, 0);
  curl_easy_setopt(hnd, CURLOPT_TIMEVALUE, 0);
  curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, NULL);
  /* curl_easy_setopt(hnd, CURLOPT_STDERR, 0x7f1560); [REMARK] */
  curl_easy_setopt(hnd, CURLOPT_HTTPPROXYTUNNEL, 0);
  curl_easy_setopt(hnd, CURLOPT_INTERFACE, NULL);
  curl_easy_setopt(hnd, CURLOPT_KRBLEVEL, NULL);
  curl_easy_setopt(hnd, CURLOPT_TELNETOPTIONS, NULL);
  curl_easy_setopt(hnd, CURLOPT_RANDOM_FILE, NULL);
  curl_easy_setopt(hnd, CURLOPT_EGDSOCKET, NULL);
  curl_easy_setopt(hnd, CURLOPT_CONNECTTIMEOUT, 0);
  curl_easy_setopt(hnd, CURLOPT_ENCODING, NULL);
  curl_easy_setopt(hnd, CURLOPT_FTP_CREATE_MISSING_DIRS, 0);
  curl_easy_setopt(hnd, CURLOPT_IPRESOLVE, 0);
  curl_easy_setopt(hnd, CURLOPT_FTP_ACCOUNT, NULL);
  curl_easy_setopt(hnd, CURLOPT_IGNORE_CONTENT_LENGTH, 0);
  curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 0);
  curl_easy_setopt(hnd, CURLOPT_FTP_FILEMETHOD, 0);
  curl_easy_setopt(hnd, CURLOPT_FTP_ALTERNATIVE_TO_USER, NULL);
  curl_easy_setopt(hnd, CURLOPT_SSL_SESSIONID_CACHE, 1);
  /* curl_easy_setopt(hnd, CURLOPT_SOCKOPTFUNCTION, 0x804fa00); [REMARK] */
  /* curl_easy_setopt(hnd, CURLOPT_SOCKOPTDATA, 0xbf915454); [REMARK] */
  curl_easy_setopt(hnd, CURLOPT_POSTREDIR, 0);
  ret = curl_easy_perform(hnd);
  curl_easy_cleanup(hnd);
  return (int)ret;
}
/**** End of sample code ****/
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to