G'day,

Three patches attached:

0001 completes the SMTP examples work - addresses one comment from David 
Woodhouse, and adds in .gitignore entries (including missing entry for smtp-
multi)

0002 is a warnings fix for printf with size_t arguments (in examples code)

0003 is a typo fix for lib/pingpong.c comments.

Please apply.

Brad
From 238a8fac5f01850385c82b107344eff98f3d24b8 Mon Sep 17 00:00:00 2001
From: Brad Hards <[email protected]>
Date: Sat, 18 Dec 2010 09:44:57 +1100
Subject: [PATCH 1/3] Minor updates to complete simple SMTP examples.

---
 docs/examples/.gitignore |    3 +++
 docs/examples/smtp-tls.c |   23 ++++++++++++-----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/docs/examples/.gitignore b/docs/examples/.gitignore
index 3acd509..8836a7b 100644
--- a/docs/examples/.gitignore
+++ b/docs/examples/.gitignore
@@ -29,4 +29,7 @@ sendrecv
 sepheaders
 simple
 simplepost
+simplesmtp
 simplessl
+smtp-multi
+smtp-tls
diff --git a/docs/examples/smtp-tls.c b/docs/examples/smtp-tls.c
index 58719ad..212d76e 100644
--- a/docs/examples/smtp-tls.c
+++ b/docs/examples/smtp-tls.c
@@ -11,20 +11,21 @@
 #include <string.h>
 #include <curl/curl.h>
 
-/* This is a simple example showing how to send mail using libcurl's SMTP
- * capabilities. It builds on the simplesmtp.c example, adding some
+/* This is a simple example showing how to send mail using libcurl's SMTP 
+ * capabilities. It builds on the simplesmtp.c example, adding some 
  * authentication and transport security.
  */
 
-#define FROM    "[email protected]"
-#define TO      "[email protected]"
-#define CC      "[email protected]"
+#define FROM	"[email protected]"
+#define TO 	"[email protected]"
+#define CC	"[email protected]"
 
 static const char *payload_text[]={
   "Date: Mon, 29 Nov 2010 21:54:29 +1100\n",
   "To: " TO "\n",
   "From: " FROM "(Example User)\n",
-  "Cc: " CC "(Another example User)\n"
+  "Cc: " CC "(Another example User)\n",
+  "Message-ID: <[email protected]>",
   "Subject: SMTP TLS example message\n",
   "\n", /* empty line to divide headers from body, see RFC5322 */
   "The body of the message starts here.\n",
@@ -70,8 +71,8 @@ int main(void)
 
   curl = curl_easy_init();
   if (curl) {
-    /* This is the URL for your mailserver. Note the use of port 587 here,
-     * instead of the normal SMTP port (25). Port 587 is commonly used for
+    /* This is the URL for your mailserver. Note the use of port 587 here, 
+     * instead of the normal SMTP port (25). Port 587 is commonly used for 
      * secure mail submission (see RFC4403), but you should use whatever
      * matches your server configuration. */
     curl_easy_setopt(curl, CURLOPT_URL, "smtp://mainserver.example.net:587");
@@ -82,7 +83,7 @@ int main(void)
      * will continue anyway - see the security discussion in the libcurl
      * tutorial for more details. */
     curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
-
+ 
     /* If your server doesn't have a valid certificate, then you can disable
      * part of the Transport Layer Security protection by setting the
      * CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false).
@@ -102,10 +103,10 @@ int main(void)
      * on the network. Here is how the user name and password are provided: */
     curl_easy_setopt(curl, CURLOPT_USERNAME, "[email protected]");
     curl_easy_setopt(curl, CURLOPT_PASSWORD, "p...@ssw0rd");
-
+    
     /* value for envelope reverse-path */
     curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM);
-    /* Add two recipients, in this particular case they correspond to the
+    /* Add two recipients, in this particular case they correspond to the 
      * To: and Cc: addressees in the header, but they could be any kind of
      * recipient. */
     recipients = curl_slist_append(recipients, TO);
-- 
1.7.1

From cb172ae750bec33f54d90936999e660341f69f5c Mon Sep 17 00:00:00 2001
From: Brad Hards <[email protected]>
Date: Sat, 18 Dec 2010 10:26:02 +1100
Subject: [PATCH 2/3] Examples: Use 'z' printf modifier to avoid warnings with size_t arguments.

---
 docs/examples/anyauthput.c |    2 +-
 docs/examples/ftpupload.c  |    2 +-
 docs/examples/httpput.c    |    2 +-
 docs/examples/sendrecv.c   |    4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/docs/examples/anyauthput.c b/docs/examples/anyauthput.c
index cec9fed..bca953a 100644
--- a/docs/examples/anyauthput.c
+++ b/docs/examples/anyauthput.c
@@ -82,7 +82,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
 
   retcode = read(fd, ptr, size * nmemb);
 
-  fprintf(stderr, "*** We read %d bytes from file\n", retcode);
+  fprintf(stderr, "*** We read %zd bytes from file\n", retcode);
 
   return retcode;
 }
diff --git a/docs/examples/ftpupload.c b/docs/examples/ftpupload.c
index f1f66c0..5985203 100644
--- a/docs/examples/ftpupload.c
+++ b/docs/examples/ftpupload.c
@@ -44,7 +44,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
      by default internally */
   size_t retcode = fread(ptr, size, nmemb, stream);
 
-  fprintf(stderr, "*** We read %d bytes from file\n", retcode);
+  fprintf(stderr, "*** We read %zd bytes from file\n", retcode);
   return retcode;
 }
 
diff --git a/docs/examples/httpput.c b/docs/examples/httpput.c
index 821e95f..f29b7ae 100644
--- a/docs/examples/httpput.c
+++ b/docs/examples/httpput.c
@@ -33,7 +33,7 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
      by default internally */
   retcode = fread(ptr, size, nmemb, stream);
 
-  fprintf(stderr, "*** We read %d bytes from file\n", retcode);
+  fprintf(stderr, "*** We read %zd bytes from file\n", retcode);
 
   return retcode;
 }
diff --git a/docs/examples/sendrecv.c b/docs/examples/sendrecv.c
index ad5ddd1..0919e4c 100644
--- a/docs/examples/sendrecv.c
+++ b/docs/examples/sendrecv.c
@@ -49,7 +49,7 @@ int main(void)
   CURLcode res;
   /* Minimalistic http request */
   const char *request = "GET / HTTP/1.0\r\nHost: example.com\r\n\r\n";
-  int sockfd; /* socket */
+  long sockfd; /* socket */
   size_t iolen;
 
   curl = curl_easy_init();
@@ -105,7 +105,7 @@ int main(void)
       if(CURLE_OK != res)
         break;
 
-      printf("Received %u bytes.\n", iolen);
+      printf("Received %zu bytes.\n", iolen);
     }
 
     /* always cleanup */
-- 
1.7.1

From b6465c96c7db48a8d4ab5448feda406939b78908 Mon Sep 17 00:00:00 2001
From: Brad Hards <[email protected]>
Date: Fri, 17 Dec 2010 14:57:39 +1100
Subject: [PATCH 3/3] Trival comment fix.

---
 lib/pingpong.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/pingpong.c b/lib/pingpong.c
index 81f804f..67ce63e 100644
--- a/lib/pingpong.c
+++ b/lib/pingpong.c
@@ -170,7 +170,7 @@ void Curl_pp_init(struct pingpong *pp)
 
 /***********************************************************************
  *
- * Curl_pp_sendfv()
+ * Curl_pp_vsendf()
  *
  * Send the formated string as a command to a pingpong server. Note that
  * the string should not have any CRLF appended, as this function will
-- 
1.7.1

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to