commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. release-2.2-264-gf88a8d0


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-264-gf88a8d0
Date: Mon, 06 Dec 2010 20:47:51 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=f88a8d059027ab10e2b6f0bd0f59764a6947474c

The branch, master has been updated
       via  f88a8d059027ab10e2b6f0bd0f59764a6947474c (commit)
      from  1f44f1ad1f04c4d11ae4f56d2595a6126b223540 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f88a8d059027ab10e2b6f0bd0f59764a6947474c
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 6 22:24:46 2010 +0200

    frm,messages,readmsg: Use MU streams instead of stdio.
    
    * frm/common.c: Use MU streams instead of stdio.
    * frm/frm.c: Likewise.
    * messages/messages.c: Likewise.
    * readmsg/readmsg.c: Likewise.
    * frm/frm.h: Include mailutils/stdstream.h
    * readmsg/readmsg.h: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 frm/common.c        |   20 ++++++++++----------
 frm/frm.c           |   24 ++++++++++++------------
 frm/frm.h           |    1 +
 frm/from.c          |    2 +-
 messages/messages.c |    5 +++--
 readmsg/readmsg.c   |   50 ++++++++++++++------------------------------------
 readmsg/readmsg.h   |    1 +
 7 files changed, 42 insertions(+), 61 deletions(-)

diff --git a/frm/common.c b/frm/common.c
index c0cc46f..dfecd2d 100644
--- a/frm/common.c
+++ b/frm/common.c
@@ -127,7 +127,7 @@ puts_bidi (char *string)
     }
   
   if (fb_charset_num == 0)
-    puts (string);
+    mu_printf ("%s\n", string);
   else
     {
       FriBidiStrIndex len;
@@ -186,20 +186,20 @@ puts_bidi (char *string)
              new_len = fribidi_unicode_to_charset (fb_charset_num,
                                                    visual + st, inlen,
                                                    outstring);
-             printf ("%s", outstring);
+             mu_printf ("%s", outstring);
            }
-         putchar ('\n');
+         mu_printf ("\n");
        }
       else
        {
          /* Print the string as is */
-         puts (string);
+         mu_printf ("%s\n", string);
        }
     }
 }
 #else
 # define alloc_logical(s)
-# define puts_bidi puts
+# define puts_bidi(s) mu_stream_printf ("%s\n", s)
 #endif
 
 
@@ -236,7 +236,7 @@ print_line ()
       curcol = nextstart = 0;
     }
   else
-    putchar ('\n');
+    mu_printf ("\n");
   curfield = 0;
 }
 
@@ -245,9 +245,9 @@ format_field_simple (const char *fmt, ...)
 {
   va_list ap;
   if (curfield++)
-    putchar ('\t');
+    mu_printf ("\t");
   va_start (ap, fmt);
-  vprintf (fmt, ap);
+  mu_stream_vprintf (mu_strout, fmt, ap);
   va_end (ap);
 }
 
@@ -266,7 +266,7 @@ format_field_align (const char *fmt, ...)
            {
              puts_bidi (linebuf);
              linepos = 0;
-             printf ("%*s", nextstart, "");
+             mu_printf ("%*s", nextstart, "");
            }
          else
            {
@@ -526,7 +526,7 @@ frm_abort (mu_mailbox_t *mbox)
    (mu_message_t). It returns non-zero if that message is to be displayed
    and zero otherwise.
 
-   Upon finishing scanning, the function places the overall number of
+   Upon finishing scanning, the function places total number of
    the messages processed into the memory location pointed to by
    TOTAL */
 void
diff --git a/frm/frm.c b/frm/frm.c
index c0348e0..7b2b0d8 100644
--- a/frm/frm.c
+++ b/frm/frm.c
@@ -266,16 +266,16 @@ frm (char *mailbox_name)
   if (show_summary)
     {
       if (total == 0)
-       printf (_("Folder contains no messages."));
+       mu_printf (_("Folder contains no messages."));
       else
        {
          char *delim = "";
          
-         printf (_("Folder contains "));
+         mu_printf (_("Folder contains "));
        
          if (counter.new)
            {
-             printf (ngettext ("%lu new message",
+             mu_printf (ngettext ("%lu new message",
                                "%lu new messages",
                                counter.new),
                      (u_long) counter.new);
@@ -284,9 +284,9 @@ frm (char *mailbox_name)
          
          if (counter.unread)
            {
-             printf ("%s", delim);
+             mu_printf ("%s", delim);
              
-             printf (ngettext ("%lu unread message",
+             mu_printf (ngettext ("%lu unread message",
                                "%lu unread messages",
                                counter.unread),
                      (u_long) counter.unread);
@@ -295,9 +295,9 @@ frm (char *mailbox_name)
          
          if (counter.read)
            {
-             printf ("%s", delim);
+             mu_printf ("%s", delim);
              
-             printf (ngettext ("%lu read message",
+             mu_printf (ngettext ("%lu read message",
                                "%lu read messages",
                                counter.read),
                      (u_long) counter.read);
@@ -309,16 +309,16 @@ frm (char *mailbox_name)
              Leave it as it is unless your language requires to reorder
              the parts of speach in the message
          */
-         printf (_("."));
+         mu_printf (_("."));
        }
-      printf ("\n");
+      mu_printf ("\n");
     }
   else if (show_query)
     {
       if (total > 0)
-       printf (_("There are messages in that folder.\n"));
+       mu_printf (_("There are messages in that folder.\n"));
       else
-       printf (_("No messages in that folder!\n"));
+       mu_printf (_("No messages in that folder!\n"));
     }
   
   /* EXIT STATUS
@@ -366,7 +366,7 @@ main (int argc, char **argv)
   else
     for (; c < argc; c++)
       {
-       printf ("%s:\n", argv[c]);
+       mu_printf ("%s:\n", argv[c]);
        status = frm (argv[c]);
       }
 
diff --git a/frm/frm.h b/frm/frm.h
index b45333e..a286e8e 100644
--- a/frm/frm.h
+++ b/frm/frm.h
@@ -55,6 +55,7 @@
 #include <mailutils/observer.h>
 #include <mailutils/registrar.h>
 #include <mailutils/stream.h>
+#include <mailutils/stdstream.h>
 #include <mailutils/url.h>
 #include <mailutils/nls.h>
 #include <mailutils/tls.h>
diff --git a/frm/from.c b/frm/from.c
index e621a23..cde808d 100644
--- a/frm/from.c
+++ b/frm/from.c
@@ -144,7 +144,7 @@ main (int argc, char **argv)
 
   if (count_only)
     {
-      printf (ngettext ("There is %lu message in your incoming mailbox.\n",
+      mu_printf (ngettext ("There is %lu message in your incoming mailbox.\n",
                        "There are %lu messages in your incoming mailbox.\n",
                        total),
              (unsigned long) total);
diff --git a/messages/messages.c b/messages/messages.c
index 6fc5d4b..5cf9a0a 100644
--- a/messages/messages.c
+++ b/messages/messages.c
@@ -166,9 +166,10 @@ messages_count (const char *box)
     }
 
   if (silent)
-    printf ("%lu\n", (unsigned long) count);
+    mu_printf ("%lu\n", (unsigned long) count);
   else
-    printf (_("Number of messages in %s: %lu\n"), box, (unsigned long) count);
+    mu_printf (_("Number of messages in %s: %lu\n"), box,
+              (unsigned long) count);
 
   status = mu_mailbox_close (mbox);
   if (status != 0)
diff --git a/readmsg/readmsg.c b/readmsg/readmsg.c
index 0abac00..eee12a1 100644
--- a/readmsg/readmsg.c
+++ b/readmsg/readmsg.c
@@ -175,7 +175,7 @@ print_unix_header (mu_message_t message)
       
   if (mu_envelope_sget_sender (envelope, &buf))
     buf = "UNKNOWN";
-  printf ("From %s ", buf);
+  mu_printf ("From %s ", buf);
   
   if (mu_envelope_sget_date (envelope, &buf))
     { 
@@ -189,10 +189,10 @@ print_unix_header (mu_message_t message)
       buf = datebuf;
     }
 
-  printf ("%s", buf);
+  mu_printf ("%s", buf);
   size = strlen (buf);
   if (size > 1 && buf[size-1] != '\n')
-    putchar ('\n');
+    mu_printf ("\n");
 }
     
 static void
@@ -205,17 +205,9 @@ print_header (mu_message_t message, int unix_header, int 
weedc, char **weedv)
   if (weedc == 0)
     {
       mu_stream_t stream = NULL;
-      size_t len = 0;
-      char buf[128];
 
-      /* FIXME: Use mu_stream_copy */
       mu_header_get_streamref (header, &stream);
-      while (mu_stream_read (stream, buf, sizeof (buf) - 1, &len) == 0
-            && len != 0)
-       {
-         buf[len] = '\0';
-         printf ("%s", buf);
-       }
+      mu_stream_copy (mu_strout, stream, 0, NULL);
       mu_stream_destroy (&stream);
     }
   else
@@ -235,11 +227,11 @@ print_header (mu_message_t message, int unix_header, int 
weedc, char **weedv)
       for (i = 1; i <= count; i++)
        {
          int j;
-         char *name = NULL;
-         char *value = NULL;
+         const char *name = NULL;
+         const char *value = NULL;
 
-         mu_header_aget_field_name (header, i, &name);
-         mu_header_aget_field_value (header, i, &value);
+         mu_header_sget_field_name (header, i, &name);
+         mu_header_sget_field_value (header, i, &value);
          for (j = 0; j < weedc; j++)
            {
              if (weedv[j][0] == '!')
@@ -249,15 +241,13 @@ print_header (mu_message_t message, int unix_header, int 
weedc, char **weedv)
                }
              else if (string_starts_with (name, weedv[j]))
                {
-                 /* Check if mu_header_aget_value return an empty string.  */
+                 /* Check if mu_header_sget_value returns an empty string.  */
                  if (value && *value)
-                   printf ("%s: %s\n", name, value);
+                   mu_printf ("%s: %s\n", name, value);
                }
            }
-         free (value);
-         free (name);
        }
-      putchar ('\n');
+      mu_printf ("\n");
     }
 }
 
@@ -265,26 +255,17 @@ static void
 print_body (mu_message_t message)
 {
   int status;
-  char buf[128];
   mu_body_t body = NULL;
   mu_stream_t stream = NULL;
-  size_t len = 0;
   mu_message_get_body (message, &body);
 
-  /* FIXME: Use mu_stream_copy */
   status = mu_body_get_streamref (body, &stream);
   if (status)
     {
       mu_error (_("cannot get body stream: %s"), mu_strerror (status));
       return;
     }
-
-  while (mu_stream_read (stream, buf, sizeof (buf) - 1, &len) == 0
-        && len != 0)
-    {
-      buf[len] = '\0';
-      printf ("%s", buf);
-    }
+  mu_stream_copy (mu_strout, stream, 0, NULL);
   mu_stream_destroy (&stream);
 }
 
@@ -410,13 +391,10 @@ main (int argc, char **argv)
        print_header (msg, unix_header, weedc, weedv);
       
       print_body (msg);
-      if (form_feed)
-       putchar ('\f');
-      else
-       putchar ('\n');
+      mu_printf (form_feed ? "\f" : "\n");
     }
 
-  putchar ('\n');
+  mu_printf ("\n");
 
   mu_mailbox_close (mbox);
   mu_mailbox_destroy (&mbox);
diff --git a/readmsg/readmsg.h b/readmsg/readmsg.h
index 1fc97da..7aa39b9 100644
--- a/readmsg/readmsg.h
+++ b/readmsg/readmsg.h
@@ -43,6 +43,7 @@
 #include <mailutils/filter.h>
 #include <mailutils/registrar.h>
 #include <mailutils/stream.h>
+#include <mailutils/stdstream.h>
 #include <mailutils/url.h>
 #include <mailutils/nls.h>
 #include <mailutils/tls.h>


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]