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-372-g5e1d982


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-372-g5e1d982
Date: Mon, 04 Jul 2011 23:31:01 +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=5e1d982ec31de34b7bf7ca6b84172966ebf9d917

The branch, master has been updated
       via  5e1d982ec31de34b7bf7ca6b84172966ebf9d917 (commit)
       via  1b5098c98df757ad24841bcc8b5350a64c07a25a (commit)
      from  d09b1d73ac69c42280c48e58f1912ce242ca6edc (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 5e1d982ec31de34b7bf7ca6b84172966ebf9d917
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Jul 5 02:13:53 2011 +0300

    Allow caller to set up custom in,out,err,progname,tag before calling 
mu_app_init.
    
    * include/mailutils/stdstream.h (MU_STDSTREAM_RESET_STRIN)
    (MU_STDSTREAM_RESET_STROUT,MU_STDSTREAM_RESET_STRERR)
    (MU_STDSTREAM_RESET_NONE,MU_STDSTREAM_RESET_ALL): New flags.
    (mu_stdstream_setup): Change signature. All uses updated.
    * libmailutils/stdstream/basestr.c (mu_stdstream_setup):
    Use the flags argument to decide whether to close existing
    streams.
    Make sure stdstream_flushall enters the onexit queue only once.
    * libmu_argp/muinit.c (mu_app_init): Don't override variables
    that may be set by the caller (program_name, tag, streams).

commit 1b5098c98df757ad24841bcc8b5350a64c07a25a
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Jul 5 02:12:30 2011 +0300

    Fixes.
    
    * libmailutils/diag/errors: Fix typo.
    * libproto/imap/connect.c: Add missing includes.
    * mh/tests/mhn.at: Add extra argument quoting.

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

Summary of changes:
 include/mailutils/stdstream.h    |   12 +++++++-
 libmailutils/diag/diag.c         |    2 +-
 libmailutils/diag/errors         |    2 +-
 libmailutils/stdstream/basestr.c |   61 +++++++++++++++++++++++++-------------
 libmailutils/tests/debugspec.c   |    2 +-
 libmu_argp/muinit.c              |    8 +++--
 libproto/imap/connect.c          |    2 +
 mail/mail.c                      |    2 +-
 mail/mailvar.c                   |    2 +-
 mh/mh_init.c                     |   12 +-------
 mh/tests/mhn.at                  |    4 +-
 testsuite/smtpsend.c             |    2 +-
 12 files changed, 67 insertions(+), 44 deletions(-)

diff --git a/include/mailutils/stdstream.h b/include/mailutils/stdstream.h
index d560d9c..ecb8fde 100644
--- a/include/mailutils/stdstream.h
+++ b/include/mailutils/stdstream.h
@@ -33,7 +33,17 @@ extern const char *mu_program_name;
 #define MU_STRERR_SYSLOG  1
 /* #define MU_STRERR_FILE    2 */
 
-void mu_stdstream_setup (void);
+#define MU_STDSTREAM_RESET_STRIN  0x01
+#define MU_STDSTREAM_RESET_STROUT 0x02
+#define MU_STDSTREAM_RESET_STRERR 0x04
+
+#define MU_STDSTREAM_RESET_NONE 0  
+#define MU_STDSTREAM_RESET_ALL \
+  (MU_STDSTREAM_RESET_STRIN | \
+   MU_STDSTREAM_RESET_STROUT | \
+   MU_STDSTREAM_RESET_STRERR)
+  
+void mu_stdstream_setup (int reset_flags);
 int mu_stdstream_strerr_create (mu_stream_t *str, int type, int facility,
                                int priority, const char *tag,
                                const char *fname);
diff --git a/libmailutils/diag/diag.c b/libmailutils/diag/diag.c
index f8cd53f..5ce4c4f 100644
--- a/libmailutils/diag/diag.c
+++ b/libmailutils/diag/diag.c
@@ -60,7 +60,7 @@ void
 mu_diag_init ()
 {
   if (!mu_strerr)
-    mu_stdstream_setup ();
+    mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
 }
 
 void
diff --git a/libmailutils/diag/errors b/libmailutils/diag/errors
index 03f71b7..10bad5c 100644
--- a/libmailutils/diag/errors
+++ b/libmailutils/diag/errors
@@ -53,7 +53,7 @@ MU_ERR_MAILER_NO_RCPT_TO    _("No receipt addresses found")
 MU_ERR_MAILER_BAD_URL       _("Malformed or unsupported mailer URL")
 MU_ERR_SMTP_RCPT_FAILED     _("SMTP rcpt to command failed")
 MU_ERR_TCP_NO_HOST          _("Tcp connections need a host")
-MU_ERR_TCP_NO_PORT          _("Tcp connections need a postive port")
+MU_ERR_TCP_NO_PORT          _("Tcp connections need a positive port")
 
 MU_ERR_BAD_2047_INPUT       _("Input string is not RFC 2047 encoded")
 MU_ERR_BAD_2047_ENCODING    _("Not a valid RFC 2047 encoding")
diff --git a/libmailutils/stdstream/basestr.c b/libmailutils/stdstream/basestr.c
index 39767d3..74247f0 100644
--- a/libmailutils/stdstream/basestr.c
+++ b/libmailutils/stdstream/basestr.c
@@ -41,17 +41,22 @@ stdstream_flushall (void *data MU_ARG_UNUSED)
   mu_stream_flush (mu_strerr);
 }
 
+static int stdstream_flushall_setup = 0;
+
 void
-mu_stdstream_setup ()
+mu_stdstream_setup (int flags)
 {
   int rc;
   int fd;
   int yes = 1;
   
   /* If the streams are already open, close them */
-  mu_stream_destroy (&mu_strin);
-  mu_stream_destroy (&mu_strout);
-  mu_stream_destroy (&mu_strerr);
+  if (flags & MU_STDSTREAM_RESET_STRIN)
+    mu_stream_destroy (&mu_strin);
+  if (flags & MU_STDSTREAM_RESET_STROUT)
+    mu_stream_destroy (&mu_strout);
+  if (flags & MU_STDSTREAM_RESET_STRERR)
+    mu_stream_destroy (&mu_strerr);
   
   /* Ensure that first 3 descriptors are open in proper mode */
   fd = open ("/dev/null", O_RDWR);
@@ -84,28 +89,42 @@ mu_stdstream_setup ()
     }
 
   /* Create the corresponding streams */
-  rc = mu_stdio_stream_create (&mu_strin, MU_STDIN_FD, 0);
-  if (rc)
+  if (!mu_strin)
     {
-      fprintf (stderr, "mu_stdio_stream_create(%d): %s\n",
-              MU_STDIN_FD, mu_strerror (rc));
-      abort ();
+      rc = mu_stdio_stream_create (&mu_strin, MU_STDIN_FD, 0);
+      if (rc)
+       {
+         fprintf (stderr, "mu_stdio_stream_create(%d): %s\n",
+                  MU_STDIN_FD, mu_strerror (rc));
+         abort ();
+       }
+      mu_stream_ioctl (mu_strin, MU_IOCTL_FD, MU_IOCTL_FD_SET_BORROW, &yes);
     }
-  mu_stream_ioctl (mu_strin, MU_IOCTL_FD, MU_IOCTL_FD_SET_BORROW, &yes);
-  
-  rc = mu_stdio_stream_create (&mu_strout, MU_STDOUT_FD, 0);
-  if (rc)
+
+  if (!mu_strout)
+    {
+      rc = mu_stdio_stream_create (&mu_strout, MU_STDOUT_FD, 0);
+      if (rc)
+       {
+         fprintf (stderr, "mu_stdio_stream_create(%d): %s\n",
+                  MU_STDOUT_FD, mu_strerror (rc));
+         abort ();
+       }
+      mu_stream_ioctl (mu_strout, MU_IOCTL_FD, MU_IOCTL_FD_SET_BORROW, &yes);
+    }
+
+  if (!mu_strerr)
     {
-      fprintf (stderr, "mu_stdio_stream_create(%d): %s\n",
-              MU_STDOUT_FD, mu_strerror (rc));
-      abort ();
+      if (mu_stdstream_strerr_create (&mu_strerr, MU_STRERR_STDERR, 0, 0,
+                                     mu_program_name, NULL))
+       abort ();
     }
-  mu_stream_ioctl (mu_strout, MU_IOCTL_FD, MU_IOCTL_FD_SET_BORROW, &yes);
 
-  if (mu_stdstream_strerr_create (&mu_strerr, MU_STRERR_STDERR, 0, 0,
-                                 mu_program_name, NULL))
-    abort ();
-  mu_onexit (stdstream_flushall, NULL);
+  if (!stdstream_flushall_setup)
+    {
+      mu_onexit (stdstream_flushall, NULL);
+      stdstream_flushall_setup = 1;
+    }
 }
 
 int
diff --git a/libmailutils/tests/debugspec.c b/libmailutils/tests/debugspec.c
index 9dcf25f..41230ee 100644
--- a/libmailutils/tests/debugspec.c
+++ b/libmailutils/tests/debugspec.c
@@ -33,7 +33,7 @@ main (int argc, char **argv)
   char *arg;
   
   mu_set_program_name (argv[0]);
-  mu_stdstream_setup ();
+  mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
 
   if (argc == 1)
     {
diff --git a/libmu_argp/muinit.c b/libmu_argp/muinit.c
index 4f73948..ccdd34c 100644
--- a/libmu_argp/muinit.c
+++ b/libmu_argp/muinit.c
@@ -107,9 +107,11 @@ mu_app_init (struct argp *myargp, const char **capa,
   char **excapa;
   struct mu_cfg_tree *parse_tree = NULL;
   
-  mu_set_program_name (argv[0]);
-  mu_log_tag = (char*)mu_program_name;
-  mu_stdstream_setup ();
+  if (!mu_program_name)
+    mu_set_program_name (argv[0]);
+  if (!mu_log_tag)
+    mu_log_tag = (char*)mu_program_name;
+  mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
   
   mu_libargp_init ();
   if (capa)
diff --git a/libproto/imap/connect.c b/libproto/imap/connect.c
index ba77ba6..6585e8c 100644
--- a/libproto/imap/connect.c
+++ b/libproto/imap/connect.c
@@ -21,6 +21,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <sys/select.h>
+#include <sys/time.h>
 #include <mailutils/errno.h>
 #include <mailutils/wordsplit.h>
 #include <mailutils/sys/imap.h>
diff --git a/mail/mail.c b/mail/mail.c
index c7ecab7..33fac2c 100644
--- a/mail/mail.c
+++ b/mail/mail.c
@@ -323,7 +323,7 @@ main (int argc, char **argv)
   struct arguments args;
   int i, rc;
   
-  mu_stdstream_setup ();
+  mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
   set_cursor (1);
 
   /* Native Language Support */
diff --git a/mail/mailvar.c b/mail/mailvar.c
index 3ed78eb..0413fbd 100644
--- a/mail/mailvar.c
+++ b/mail/mailvar.c
@@ -164,7 +164,7 @@ struct mailvar_symbol mailvar_tab[] =
     { { "metamail", },
       MAILVAR_TYPEMASK (mailvar_type_boolean),
       N_("interpret the content of message parts; if set to a string "
-        "specifies the name of the externam metamail command") },
+        "specifies the name of the external metamail command") },
     { { "metoo", },
       MAILVAR_TYPEMASK (mailvar_type_boolean),
       N_("do not remove sender addresses from the recipient list") },
diff --git a/mh/mh_init.c b/mh/mh_init.c
index e03ff4a..7d44c90 100644
--- a/mh/mh_init.c
+++ b/mh/mh_init.c
@@ -40,20 +40,10 @@ char mh_list_format[] =
   "%<(zero)%17(decode(friendly{from}))%>"
   "  %(decode{subject})%<{body}<<%{body}>>%>";
 
-/* Make sure stdin is open.  If not, connect it to /dev/null. */
-static void
-mh_ensure_stdin ()
-{
-  int fd = open ("/dev/null", O_RDONLY);
-  if (fd != 0)
-    close (fd);
-}
-
 void
 mh_init ()
 {
-  mh_ensure_stdin ();
-  mu_stdstream_setup ();
+  mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
   
   /* Register all mailbox and mailer formats */
   mu_register_all_formats ();
diff --git a/mh/tests/mhn.at b/mh/tests/mhn.at
index 7316b1c..3d0e4e0 100644
--- a/mh/tests/mhn.at
+++ b/mh/tests/mhn.at
@@ -251,7 +251,7 @@ mhn +inbox -store -part 2.2.1 4 | remove_curdir || exit $?
 [storing message 4 part 2.2.1 to folder inbox as message 5
 ])
 
-MH_CHECK([mhn-store-: pipe],[mhn11 mhn-store-pipe],[
+MH_CHECK([mhn-store-: pipe],[mhn11 mhn-store-pipe],[[
 mkdir Mail/inbox
 cp $abs_top_srcdir/testsuite/mh/mbox1/4 Mail/inbox
 chmod +w Mail/inbox/4
@@ -259,7 +259,7 @@ chmod +w Mail/inbox/4
 echo "Current-Folder: inbox" > Mail/context
 echo "mhn-store-text: | $abs_top_srcdir/mh/tests/mhed -" >> $MH
 mhn +inbox -store -part 1 4 | sed "s|$abs_top_srcdir/mh/tests/||;s|(cd 
\(.*\)\;|(cd home\;|;s|  *$||" || exit $?
-],
+]],
 [0],
 [-- Editor invocation: -
 -- Input file:
diff --git a/testsuite/smtpsend.c b/testsuite/smtpsend.c
index b4f3754..2b0d91a 100644
--- a/testsuite/smtpsend.c
+++ b/testsuite/smtpsend.c
@@ -102,7 +102,7 @@ main (int argc, char **argv)
   struct mu_sockaddr_hints hints;
   
   mu_set_program_name (argv[0]);
-  mu_stdstream_setup ();
+  mu_stdstream_setup (MU_STDSTREAM_RESET_NONE);
 #ifdef WITH_TLS
   mu_init_tls_libs ();
 #endif  


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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