From MAILER-DAEMON Tue Mar 03 14:23:34 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LeaDG-0004Ps-O1
	for mharc-commit-mailutils@gnu.org; Tue, 03 Mar 2009 14:23:34 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LeaDF-0004Pn-OP
	for commit-mailutils@gnu.org; Tue, 03 Mar 2009 14:23:33 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LeaDB-0004P5-ON
	for commit-mailutils@gnu.org; Tue, 03 Mar 2009 14:23:32 -0500
Received: from [199.232.76.173] (port=39944 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LeaDB-0004P2-Kh
	for commit-mailutils@gnu.org; Tue, 03 Mar 2009 14:23:29 -0500
Received: from savannah.gnu.org ([199.232.41.3]:48585 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LeaDB-0000Gq-89
	for commit-mailutils@gnu.org; Tue, 03 Mar 2009 14:23:29 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LeaDA-0005Cc-HQ
	for commit-mailutils@gnu.org; Tue, 03 Mar 2009 19:23:28 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LeaD8-0005Bk-8v
	for commit-mailutils@gnu.org; Tue, 03 Mar 2009 19:23:28 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 234b002dc8b0842ee750577faa0dec82b8857228
X-Git-Newrev: cf9c751dd6b97df3ead5e2947465bccb7c8c4521
Message-Id: <E1LeaD8-0005Bk-8v@cvs.savannah.gnu.org>
Date: Tue, 03 Mar 2009 19:23:26 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-232-gcf9c751
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Mar 2009 19:23:33 -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=cf9c751dd6b97df3ead5e2947465bccb7c8c4521

The branch, master has been updated
       via  cf9c751dd6b97df3ead5e2947465bccb7c8c4521 (commit)
      from  234b002dc8b0842ee750577faa0dec82b8857228 (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 cf9c751dd6b97df3ead5e2947465bccb7c8c4521
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Mar 3 21:23:01 2009 +0200

    All client utilities: read ~/.mu-tickets
    
    * NEWS: Update.
    * include/mailutils/mailbox.h (mu_ticket_file): New extern.
    * include/mailutils/message.h (mu_message_save_to_mailbox): Change proto.
    * include/mailutils/sieve.h (mu_sieve_get_ticket, mu_sieve_set_ticket): Remove.
    * libmu_sieve/actions.c (sieve_action_fileinto): Update call to
    mu_message_save_to_mailbox.
    * libmu_sieve/sieve-priv.h (struct mu_sieve_machine): Remove ticket.
    * libmu_sieve/sieve.y (mu_sieve_get_ticket, mu_sieve_set_ticket): Remove.
    * mailbox/mbx_default.c (mu_mailbox_create_default): Read a wicket file and
    attach a ticket if mailbox opened successfully.
    * mailbox/wicket.c: Re-format.
    * sieve/sieve.c: Remove special wicket-handling code.
    
    * libmu_auth/radius.c, movemail/movemail.c: Add missing includes

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

Summary of changes:
 NEWS                        |   28 +++++++++++++++-
 include/mailutils/mailbox.h |    2 +
 include/mailutils/message.h |    2 +-
 include/mailutils/sieve.h   |    2 -
 libmu_auth/radius.c         |    1 +
 libmu_sieve/actions.c       |    2 +-
 libmu_sieve/sieve-priv.h    |    1 -
 libmu_sieve/sieve.y         |   12 -------
 mailbox/mbx_default.c       |   48 ++++++++++++++++++++++++++++
 mailbox/message.c           |   22 +------------
 mailbox/wicket.c            |   72 +++++++++++++++++++----------------------
 movemail/movemail.c         |    1 +
 sieve/sieve.c               |   74 ++----------------------------------------
 13 files changed, 119 insertions(+), 148 deletions(-)

diff --git a/NEWS b/NEWS
index dacd593..f4c2642 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
-GNU mailutils NEWS -- history of user-visible changes. 2009-02-18
+GNU mailutils NEWS -- history of user-visible changes. 2009-03-03
 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 
-2008 Free Software Foundation, Inc.
+2008, 2009 Free Software Foundation, Inc.
 See the end of file for copying conditions.
 
 Please send mailutils bug reports to <bug-mailutils@gnu.org>.
@@ -8,6 +8,30 @@ Please send mailutils bug reports to <bug-mailutils@gnu.org>.
 
 Version 2.0.90 (Git)
 
+* Ticket files
+
+All MU client utilities make use of the user ticket file,
+~/.mu-tickets, if it is present.
+
+* API
+
+** Removed functions
+
+- mu_sieve_get_ticket
+- mu_sieve_set_ticket
+
+** Changed functions
+
+- mu_message_save_to_mailbox: removed `ticket' argument.
+
+New prototype is:
+
+int mu_message_save_to_mailbox (mu_message_t msg,
+                                mu_debug_t debug,
+				const char *toname,
+				int perms);
+				       
+
 
 Version 2.0:
 
diff --git a/include/mailutils/mailbox.h b/include/mailutils/mailbox.h
index 465c649..6da847e 100644
--- a/include/mailutils/mailbox.h
+++ b/include/mailutils/mailbox.h
@@ -28,6 +28,8 @@
 extern "C" {
 #endif
 
+extern char *mu_ticket_file;
+  
 int mu_set_mail_directory (const char *p);
 int mu_set_mailbox_pattern (const char *pat);
 void mu_set_folder_directory (const char *p);
diff --git a/include/mailutils/message.h b/include/mailutils/message.h
index 11ae8e0..e0f7628 100644
--- a/include/mailutils/message.h
+++ b/include/mailutils/message.h
@@ -123,7 +123,7 @@ extern int mu_message_get_attachment_name (mu_message_t, char *name,
 					   size_t bufsz, size_t* sz);
 extern int mu_message_aget_attachment_name (mu_message_t, char **name);
 
-extern int mu_message_save_to_mailbox (mu_message_t msg, mu_ticket_t ticket,
+extern int mu_message_save_to_mailbox (mu_message_t msg, 
 				       mu_debug_t debug, const char *toname,
 				       int perms);
 
diff --git a/include/mailutils/sieve.h b/include/mailutils/sieve.h
index c551bff..1ee1cdb 100644
--- a/include/mailutils/sieve.h
+++ b/include/mailutils/sieve.h
@@ -217,7 +217,6 @@ void *mu_sieve_get_data (mu_sieve_machine_t mach);
 mu_message_t mu_sieve_get_message (mu_sieve_machine_t mach);
 size_t mu_sieve_get_message_num (mu_sieve_machine_t mach);
 int mu_sieve_get_debug_level (mu_sieve_machine_t mach);
-mu_ticket_t mu_sieve_get_ticket (mu_sieve_machine_t mach);
 mu_mailer_t mu_sieve_get_mailer (mu_sieve_machine_t mach);
 int mu_sieve_get_locus (mu_sieve_machine_t mach, mu_sieve_locus_t *);
 char *mu_sieve_get_daemon_email (mu_sieve_machine_t mach);
@@ -232,7 +231,6 @@ void mu_sieve_set_debug_object (mu_sieve_machine_t mach, mu_debug_t dbg);
 void mu_sieve_set_debug_level (mu_sieve_machine_t mach, int level);
 void mu_sieve_set_logger (mu_sieve_machine_t mach,
 			  mu_sieve_action_log_t logger);
-void mu_sieve_set_ticket (mu_sieve_machine_t mach, mu_ticket_t ticket);
 void mu_sieve_set_mailer (mu_sieve_machine_t mach, mu_mailer_t mailer);
 void mu_sieve_set_daemon_email (mu_sieve_machine_t mach, const char *email);
 
diff --git a/libmu_auth/radius.c b/libmu_auth/radius.c
index a3f458a..4091c41 100644
--- a/libmu_auth/radius.c
+++ b/libmu_auth/radius.c
@@ -42,6 +42,7 @@
 #include <mailutils/errno.h>
 #include <mailutils/nls.h>
 #include <mailutils/vartab.h>
+#include <mailutils/io.h>
 
 #ifdef ENABLE_RADIUS
 
diff --git a/libmu_sieve/actions.c b/libmu_sieve/actions.c
index 4964006..65585dc 100644
--- a/libmu_sieve/actions.c
+++ b/libmu_sieve/actions.c
@@ -105,7 +105,7 @@ sieve_action_fileinto (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
   if (mu_sieve_is_dry_run (mach))
     return 0;
 
-  rc = mu_message_save_to_mailbox (mach->msg, mach->ticket, mach->debug,
+  rc = mu_message_save_to_mailbox (mach->msg, mach->debug,
 				   val->v.string, mbflags);
   if (rc)
     mu_sieve_error (mach, _("cannot save to mailbox: %s"),
diff --git a/libmu_sieve/sieve-priv.h b/libmu_sieve/sieve-priv.h
index c145d3c..8462dd7 100644
--- a/libmu_sieve/sieve-priv.h
+++ b/libmu_sieve/sieve-priv.h
@@ -74,7 +74,6 @@ struct mu_sieve_machine {
   mu_sieve_action_log_t logger;
   
   mu_mailer_t mailer;
-  mu_ticket_t ticket;
   mu_debug_t debug;
   char *daemon_email;
   void *data;
diff --git a/libmu_sieve/sieve.y b/libmu_sieve/sieve.y
index e532190..3585799 100644
--- a/libmu_sieve/sieve.y
+++ b/libmu_sieve/sieve.y
@@ -477,18 +477,6 @@ mu_sieve_set_logger (mu_sieve_machine_t mach, mu_sieve_action_log_t logger)
   mach->logger = logger;
 }
 
-void
-mu_sieve_set_ticket (mu_sieve_machine_t mach, mu_ticket_t ticket)
-{
-  mach->ticket = ticket;
-}
-
-mu_ticket_t
-mu_sieve_get_ticket (mu_sieve_machine_t mach)
-{
-  return mach->ticket;
-}
-
 mu_mailer_t
 mu_sieve_get_mailer (mu_sieve_machine_t mach)
 {
diff --git a/mailbox/mbx_default.c b/mailbox/mbx_default.c
index 60e7426..1ce2389 100644
--- a/mailbox/mbx_default.c
+++ b/mailbox/mbx_default.c
@@ -34,10 +34,17 @@
 
 #include <mailutils/mailbox.h>
 #include <mailutils/mutil.h>
+#include <mailutils/debug.h>
 #include <mailutils/error.h>
 #include <mailutils/errno.h>
 #include <mailutils/mu_auth.h>
 #include <mailutils/vartab.h>
+#include <mailutils/folder.h>
+#include <mailutils/auth.h>
+
+#include <mailbox0.h>
+
+char *mu_ticket_file = "~/.mu-tickets";
 
 static char *_mu_mailbox_pattern;
 
@@ -328,6 +335,44 @@ percent_expand (const char *file, char **mbox)
   return status;
 }
 
+static void
+attach_auth_ticket (mu_mailbox_t mbox)
+{
+  mu_folder_t folder = NULL;
+  mu_authority_t auth = NULL;
+
+  if (mu_mailbox_get_folder (mbox, &folder) == 0
+      && mu_folder_get_authority (folder, &auth) == 0)
+    {
+      char *filename = mu_tilde_expansion (mu_ticket_file, "/", NULL);
+      mu_wicket_t wicket;
+      int rc;
+  
+      MU_DEBUG1 (mbox->debug, MU_DEBUG_TRACE1,
+		 "Reading user ticket file %s\n", filename);
+      if ((rc = mu_wicket_create (&wicket, filename)) == 0)
+	{
+	  mu_ticket_t ticket;
+      
+	  if ((rc = mu_wicket_get_ticket (wicket, &ticket, 0, 0)) == 0)
+	    {
+	      rc = mu_authority_set_ticket (auth, ticket);
+	      MU_DEBUG1 (mbox->debug, MU_DEBUG_TRACE1,
+			 "Retrieved and set ticket: %d\n", rc);
+	    }
+	  else
+	    MU_DEBUG1 (mbox->debug, MU_DEBUG_ERROR,
+		       "Error retrieving ticket: %s\n",
+		       mu_strerror (rc));
+	  mu_wicket_destroy (&wicket);
+	}
+      else
+	MU_DEBUG1 (mbox->debug, MU_DEBUG_ERROR,
+		   "Error creating wicket: %s\n", mu_strerror (rc));
+      free (filename);
+    }
+}
+
 /* We are trying to be smart about the location of the mail.
    mu_mailbox_create() is not doing this.
    %           --> system mailbox for the real uid
@@ -415,5 +460,8 @@ mu_mailbox_create_default (mu_mailbox_t *pmbox, const char *mail)
   
   status = mu_mailbox_create (pmbox, mbox);
   free (mbox);
+  if (status == 0)
+    attach_auth_ticket (*pmbox);
+      
   return status;
 }
diff --git a/mailbox/message.c b/mailbox/message.c
index dd8ff89..15a6f3f 100644
--- a/mailbox/message.c
+++ b/mailbox/message.c
@@ -1110,7 +1110,7 @@ message_body_read (mu_stream_t stream,  char *buffer, size_t n, mu_off_t off,
 }
 
 int
-mu_message_save_to_mailbox (mu_message_t msg, mu_ticket_t ticket,
+mu_message_save_to_mailbox (mu_message_t msg, 
                             mu_debug_t debug,
 			    const char *toname, int perms)
 {
@@ -1128,26 +1128,6 @@ mu_message_save_to_mailbox (mu_message_t msg, mu_ticket_t ticket,
   if (debug && (rc = mu_mailbox_set_debug (to, debug)))
 	goto end;
 
-  if (ticket)
-    {
-      mu_folder_t folder = NULL;
-
-      if ((rc = mu_mailbox_get_folder (to, &folder)))
-	goto end;
-
-      /* FIXME: not all mailboxes have folders, thus this hack. */
-      if (folder)
-	{
-	  mu_authority_t auth = NULL;
-	  if ((rc = mu_folder_get_authority (folder, &auth)))
-	    goto end;
-
-	  /* FIXME: not all folders have authentication, thus this hack. */
-	  if (auth && (rc = mu_authority_set_ticket (auth, ticket)))
-	    goto end;
-	}
-    }
-
   if ((rc = mu_mailbox_open (to,
 			     MU_STREAM_WRITE | MU_STREAM_CREAT
 			     | (perms & MU_STREAM_IMASK))))
diff --git a/mailbox/wicket.c b/mailbox/wicket.c
index 21e01c7..6ef4dc3 100644
--- a/mailbox/wicket.c
+++ b/mailbox/wicket.c
@@ -91,11 +91,11 @@ mu_wicket_destroy (mu_wicket_t *pwicket)
 
 int
 mu_wicket_get_filename (mu_wicket_t wicket, char *filename, size_t len,
-		     size_t *pwriten)
+			size_t *pwriten)
 {
- size_t n;
- if (wicket == NULL)
-   return EINVAL;
+  size_t n;
+  if (wicket == NULL)
+    return EINVAL;
   n = mu_cpystr (filename, wicket->filename, len);
   if (pwriten)
     *pwriten = n;
@@ -107,10 +107,10 @@ mu_wicket_set_filename (mu_wicket_t wicket, const char *filename)
 {
   if (wicket == NULL)
     return EINVAL;
-
+  
   if (wicket->filename)
     free (wicket->filename);
-
+  
   wicket->filename = (filename) ? strdup (filename) : NULL;
   return 0;
 }
@@ -127,8 +127,9 @@ mu_wicket_set_ticket (mu_wicket_t wicket, int (*get_ticket)
 }
 
 int
-mu_wicket_get_ticket (mu_wicket_t wicket, mu_ticket_t *pticket, const char *user,
-		   const char *type)
+mu_wicket_get_ticket (mu_wicket_t wicket, mu_ticket_t *pticket,
+		      const char *user,
+		      const char *type)
 {
   if (wicket == NULL || pticket == NULL)
     return EINVAL;
@@ -142,7 +143,8 @@ mu_wicket_get_ticket (mu_wicket_t wicket, mu_ticket_t *pticket, const char *user
 }
 
 static int
-myticket_create (mu_ticket_t *pticket, const char *user, const char *pass, const char *filename)
+myticket_create (mu_ticket_t *pticket, const char *user,
+		 const char *pass, const char *filename)
 {
   struct myticket_data *mdata;
   int status = mu_ticket_create (pticket, NULL);
@@ -197,42 +199,35 @@ myticket_create (mu_ticket_t *pticket, const char *user, const char *pass, const
 }
 
 static int
-myticket_pop (mu_ticket_t ticket, mu_url_t url, const char *challenge, char **parg)
+myticket_pop (mu_ticket_t ticket, mu_url_t url,
+	      const char *challenge, char **parg)
 {
   struct myticket_data *mdata = NULL;
   int e = 0;
-
+  
   mu_ticket_get_data (ticket, (void **)&mdata);
-  if (challenge &&
-    (
-      strstr (challenge, "ass") != NULL ||
-      strstr (challenge, "ASS") != NULL
-   )
-      )
-  {
-    if(mdata->pass)
+  if (challenge && (strstr (challenge, "ass") != NULL ||
+		    strstr (challenge, "ASS") != NULL))
     {
-      *parg = strdup(mdata->pass);
-      if(!*parg)
-	e = ENOMEM;
-    }
-    else
-    {
-      e = get_pass (url, mdata->user, mdata->filename, parg);
+      if (mdata->pass)
+	{
+	  *parg = strdup (mdata->pass);
+	  if (!*parg)
+	    e = ENOMEM;
+	}
+      else
+	e = get_pass (url, mdata->user, mdata->filename, parg);
     }
-  }
   else
-  {
-    if(mdata->user)
-    {
-      *parg = strdup(mdata->user);
-      if(!*parg)
-	e = ENOMEM;
-    }
-    else
     {
-      e = get_user (url, mdata->filename, parg);
-    }
+      if (mdata->user)
+	{
+	  *parg = strdup(mdata->user);
+	  if (!*parg)
+	    e = ENOMEM;
+	}
+      else
+	e = get_user (url, mdata->filename, parg);
   }
   return e;
 }
@@ -255,7 +250,8 @@ myticket_destroy (mu_ticket_t ticket)
 }
 
 static int
-get_ticket (mu_url_t url, const char *user, const char *filename, mu_url_t * ticket)
+get_ticket (mu_url_t url, const char *user, const char *filename,
+	    mu_url_t * ticket)
 {
   int err = 0;
   FILE *fp = NULL;
diff --git a/movemail/movemail.c b/movemail/movemail.c
index 4dee71d..b2674e0 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -29,6 +29,7 @@
 #include <mailutils/tls.h>
 #include <mu_asprintf.h>
 #include "mailutils/libargp.h"
+#include <lib/muaux.h>
 
 const char *program_version = "movemail (" PACKAGE_STRING ")";
 static char doc[] = N_("GNU movemail");
diff --git a/sieve/sieve.c b/sieve/sieve.c
index 22ec8f2..7af6275 100644
--- a/sieve/sieve.c
+++ b/sieve/sieve.c
@@ -106,8 +106,6 @@ static struct argp_option options[] =
 int keep_going;
 int compile_only;
 char *mbox_url;
-char *tickets;
-int tickets_default;
 int debug_level;
 int sieve_debug;
 int verbose;
@@ -282,24 +280,13 @@ cb_email (mu_debug_t debug, void *data, mu_config_value_t *val)
   return rc;
 }
 
-static int
-cb_ticket (mu_debug_t debug, void *data, mu_config_value_t *val)
-{
-  if (mu_cfg_assert_value_type (val, MU_CFG_STRING, debug))
-    return 1;
-  free (tickets);
-  tickets = mu_tilde_expansion (val->v.string, "/", NULL);
-  tickets_default = 0;
-  return 0;
-}
-
 static struct mu_cfg_param sieve_cfg_param[] = {
   { "keep-going", mu_cfg_bool, &keep_going, 0, NULL,
     N_("Do not abort if execution fails on a message.") },
   { "mbox-url", mu_cfg_string, &mbox_url, 0, NULL,
     N_("Mailbox to sieve (defaults to user's mail spool)."),
     N_("url") },
-  { "ticket", mu_cfg_callback, NULL, 0, cb_ticket,
+  { "ticket", mu_cfg_string, &mu_ticket_file, 0, NULL,
     N_("Ticket file for user authentication."),
     N_("ticket") },
   { "debug", mu_cfg_callback, NULL, 0, cb_debug,
@@ -405,12 +392,12 @@ sieve_message (mu_sieve_machine_t mach)
 }
 
 static int
-sieve_mailbox (mu_sieve_machine_t mach, mu_ticket_t ticket, mu_debug_t debug)
+sieve_mailbox (mu_sieve_machine_t mach, mu_debug_t debug)
 {
   int rc;
   mu_mailbox_t mbox = NULL;
   
-  /* Create, give a ticket to, and open the mailbox. */
+  /* Create and open the mailbox. */
   if ((rc = mu_mailbox_create_default (&mbox, mbox_url)) != 0)
     {
       if (mbox)
@@ -428,34 +415,6 @@ sieve_mailbox (mu_sieve_machine_t mach, mu_ticket_t ticket, mu_debug_t debug)
       goto cleanup;
     }
 
-  if (ticket)
-    {
-      mu_folder_t folder = NULL;
-      mu_authority_t auth = NULL;
-      
-      if ((rc = mu_mailbox_get_folder (mbox, &folder)))
-	{
-	  mu_error (_("mu_mailbox_get_folder failed: %s"),
-		    mu_strerror (rc));
-	  goto cleanup;
-	}
-      
-      if ((rc = mu_folder_get_authority (folder, &auth)))
-	{
-	  mu_error (_("mu_folder_get_authority failed: %s"),
-		    mu_strerror (rc));
-	  goto cleanup;
-	}
-      
-      /* Authentication-less folders don't have authorities. */
-      if (auth && (rc = mu_authority_set_ticket (auth, ticket)))
-	{
-	  mu_error (_("mu_authority_set_ticket failed: %s"),
-		    mu_strerror (rc));
-	  goto cleanup;
-	}
-    }
-  
   /* Open the mailbox read-only if we aren't going to modify it. */
   if (sieve_debug & MU_SIEVE_DRY_RUN)
     rc = mu_mailbox_open (mbox, MU_STREAM_READ);
@@ -516,8 +475,6 @@ int
 main (int argc, char *argv[])
 {
   mu_sieve_machine_t mach;
-  mu_wicket_t wicket = 0;
-  mu_ticket_t ticket = 0;
   mu_debug_t debug = 0;
   int rc;
 
@@ -532,8 +489,6 @@ main (int argc, char *argv[])
 
   mu_register_all_formats ();
 
-  tickets = mu_tilde_expansion ("~/.tickets", "/", NULL);
-  tickets_default = 1;
   debug_level = MU_DEBUG_LEVEL_MASK (MU_DEBUG_ERROR);
   mu_log_facility = 0;
 
@@ -574,27 +529,6 @@ main (int argc, char *argv[])
       return EX_OK;
     }
 
-  /* Create a ticket, if we can. */
-  if (tickets)
-    {
-      if ((rc = mu_wicket_create (&wicket, tickets)) == 0)
-        {
-          if ((rc = mu_wicket_get_ticket (wicket, &ticket, 0, 0)) != 0)
-            {
-              mu_error (_("ticket_get failed: %s"), mu_strerror (rc));
-              return EX_SOFTWARE; /* FIXME: really? */
-            }
-        }
-      else if (!(tickets_default && errno == ENOENT))
-        {
-          mu_error (_("mu_wicket_create `%s' failed: %s"),
-                    tickets, mu_strerror (rc));
-          return EX_SOFTWARE;
-        }
-      if (ticket)
-        mu_sieve_set_ticket (mach, ticket);
-    }
-
   /* Create a debug object, if needed. */
   if (debug_level)
     {
@@ -617,7 +551,7 @@ main (int argc, char *argv[])
   if (mbox_url && strcmp (mbox_url, "-") == 0)
     rc = sieve_message (mach);
   else
-    rc = sieve_mailbox (mach, ticket, debug);
+    rc = sieve_mailbox (mach, debug);
   mu_debug_destroy (&debug, mach);
 
   return rc;


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Wed Mar 04 12:40:28 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Lev51-0003VL-Su
	for mharc-commit-mailutils@gnu.org; Wed, 04 Mar 2009 12:40:27 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Lev4z-0003Ud-Sm
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 12:40:25 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Lev4x-0003TI-9o
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 12:40:24 -0500
Received: from [199.232.76.173] (port=37438 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Lev4w-0003T6-Kx
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 12:40:22 -0500
Received: from savannah.gnu.org ([199.232.41.3]:33891 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Lev4w-0003iR-2v
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 12:40:22 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Lev4r-0000rs-8G
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 17:40:17 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Lev4d-0000n3-Ur
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 17:40:15 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: cf9c751dd6b97df3ead5e2947465bccb7c8c4521
X-Git-Newrev: 178da060ff84dee3653bd9ad82e4f67d5b804eff
Message-Id: <E1Lev4d-0000n3-Ur@cvs.savannah.gnu.org>
Date: Wed, 04 Mar 2009 17:40:07 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-234-g178da06
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Mar 2009 17:40:26 -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=178da060ff84dee3653bd9ad82e4f67d5b804eff

The branch, master has been updated
       via  178da060ff84dee3653bd9ad82e4f67d5b804eff (commit)
       via  7d43411a434ec7404f7f52b7bbf801415ddddf23 (commit)
      from  cf9c751dd6b97df3ead5e2947465bccb7c8c4521 (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 178da060ff84dee3653bd9ad82e4f67d5b804eff
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Mar 4 17:03:44 2009 +0200

    Fix the return of get_ticket

commit 7d43411a434ec7404f7f52b7bbf801415ddddf23
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Mar 4 16:08:09 2009 +0200

    Fix semantics of mu_attribute_to_string
    
    * include/mailutils/attribute.h (MU_STATUS_BUF_SIZE): New define.
    * libproto/mbox/mbox.c: Update use of mu_attribute_to_string.
    * mailbox/amd.c: Likewise.
    * mailbox/attribute.c (mu_string_to_flags): Rewrite.
    (mu_attribute_to_string): Fill the string with flag letters only, without
    "Status:" prefix and final newline.
    * NEWS: Update.

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

Summary of changes:
 NEWS                          |   10 +++-
 include/mailutils/attribute.h |    6 ++-
 libproto/mbox/mbox.c          |   15 ++++--
 mailbox/amd.c                 |   11 ++--
 mailbox/attribute.c           |  107 +++++++++++++++++++++--------------------
 mailbox/wicket.c              |   23 ++++-----
 6 files changed, 93 insertions(+), 79 deletions(-)

diff --git a/NEWS b/NEWS
index f4c2642..24a2faa 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2009-03-03
+GNU mailutils NEWS -- history of user-visible changes. 2009-03-04
 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 
 2008, 2009 Free Software Foundation, Inc.
 See the end of file for copying conditions.
@@ -22,7 +22,7 @@ All MU client utilities make use of the user ticket file,
 
 ** Changed functions
 
-- mu_message_save_to_mailbox: removed `ticket' argument.
+*** mu_message_save_to_mailbox: removed `ticket' argument.
 
 New prototype is:
 
@@ -30,7 +30,11 @@ int mu_message_save_to_mailbox (mu_message_t msg,
                                 mu_debug_t debug,
 				const char *toname,
 				int perms);
-				       
+
+*** mu_attribute_to_string
+
+This function now returns a string consisting of flag letters only, without
+"Status:" prefix or final newline.
 
 
 Version 2.0:
diff --git a/include/mailutils/attribute.h b/include/mailutils/attribute.h
index 45834c0..dacf04e 100644
--- a/include/mailutils/attribute.h
+++ b/include/mailutils/attribute.h
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2005, 2007,
+   2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -96,6 +97,9 @@ extern int mu_attribute_is_equal        (mu_attribute_t, mu_attribute_t att2);
 
 extern int mu_attribute_copy            (mu_attribute_t, mu_attribute_t);
 
+/* Maximum size of buffer for mu_attribute_to_string call, including nul */
+#define MU_STATUS_BUF_SIZE sizeof("OAFRd")
+  
 extern int mu_attribute_to_string       (mu_attribute_t, char *, size_t, size_t *);
 extern int mu_string_to_flags           (const char *, int *);
 
diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c
index f3e8a25..37b980c 100644
--- a/libproto/mbox/mbox.c
+++ b/libproto/mbox/mbox.c
@@ -1585,14 +1585,19 @@ mbox_append_message0 (mu_mailbox_t mailbox, mu_message_t msg, mu_off_t *psize,
       case MBOX_STATE_APPEND_ATTRIBUTE:
       /* Put the new attributes.  */
       {
-	char abuf[64];
+#define STATUS_PREFIX_LEN (sizeof(MU_HEADER_STATUS) - 1 + 2)
+	char abuf[STATUS_PREFIX_LEN + MU_STATUS_BUF_SIZE + 1];
 	size_t na = 0;
 	mu_attribute_t attr = NULL;
-	abuf[0] = '\0';
-	mu_message_get_attribute (msg, &attr);
-	mu_attribute_to_string (attr, abuf, sizeof(abuf), &na);
 
-	status = mu_stream_write (mailbox->stream, abuf, na, *psize, &n);
+	strcpy(abuf, MU_HEADER_STATUS);
+	strcat(abuf, ": ");
+	mu_message_get_attribute (msg, &attr);
+	mu_attribute_to_string (attr, abuf + STATUS_PREFIX_LEN, 
+	                        sizeof(abuf) - STATUS_PREFIX_LEN - 1, &na);
+	strcat (abuf, "\n");
+	na = strlen (abuf);
+	mu_stream_write (mailbox->stream, abuf, na, *psize, &n);
 	if (status != 0)
 	  break;
 	*psize += n;
diff --git a/mailbox/amd.c b/mailbox/amd.c
index 8066518..27850f0 100644
--- a/mailbox/amd.c
+++ b/mailbox/amd.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2003, 
-   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -613,7 +613,8 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
   mu_body_t body;
   const char *sbuf;
   mu_envelope_t env = NULL;
-  
+  char statbuf[MU_STATUS_BUF_SIZE];
+
   status = mu_message_size (msg, &bsize);
   if (status)
     return status;
@@ -661,7 +662,7 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
   while ((status = mu_stream_readline (stream, buf, bsize, off, &n)) == 0
 	 && n != 0)
     {
-      if (_amd_delim(buf))
+      if (_amd_delim (buf))
 	break;
 
       if (!(strncasecmp (buf, "status:", 7) == 0
@@ -710,10 +711,10 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
   
   /* Add status */
   mu_message_get_attribute (msg, &attr);
-  mu_attribute_to_string (attr, buf, bsize, &n);
+  mu_attribute_to_string (attr, statbuf, sizeof (statbuf), &n);
   if (n)
     {
-      nbytes += fprintf (fp, "%s", buf);
+      nbytes += fprintf (fp, "Status: %s\n", statbuf);
       nlines++;
     }
   nbytes += fprintf (fp, "\n");
diff --git a/mailbox/attribute.c b/mailbox/attribute.c
index 84b678e..b5c03ec 100644
--- a/mailbox/attribute.c
+++ b/mailbox/attribute.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2004, 2005, 
-   2007 Free Software Foundation, Inc.
+   2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -31,10 +31,9 @@
 #endif
 
 #include <mailutils/errno.h>
+#include <mailutils/mutil.h>
 #include <attribute0.h>
 
-static int flags_to_string (int, char *, size_t, size_t *);
-
 int
 mu_attribute_create (mu_attribute_t *pattr, void *owner)
 {
@@ -384,6 +383,31 @@ mu_attribute_copy (mu_attribute_t dest, mu_attribute_t src)
   return 0;
 }
 
+struct flagtrans
+{
+  int flag;
+  char letter;
+};
+
+/* The two macros below are taken from gnulib module verify.h */
+#define mu_verify_true(R) \
+  (!!sizeof \
+   (struct { unsigned int verify_error_if_negative_size__: (R) ? 1 : -1; }))
+#define mu_verify(R) extern int (* verify_function__ (void)) [mu_verify_true (R)]
+
+static struct flagtrans flagtrans[] = {
+  { MU_ATTRIBUTE_SEEN, 'O' },
+  { MU_ATTRIBUTE_ANSWERED, 'A' },
+  { MU_ATTRIBUTE_FLAGGED, 'F' },
+  { MU_ATTRIBUTE_READ, 'R' },
+  { MU_ATTRIBUTE_DELETED, 'd' },
+  { 0 }
+};
+
+/* If cc reports an error in this statement, fix the MU_STATUS_BUF_SIZE
+   declaration in include/mailutils/attribute.h */
+mu_verify (MU_ARRAY_SIZE (flagtrans) == MU_STATUS_BUF_SIZE);
+
 int
 mu_string_to_flags (const char *buffer, int *pflags)
 {
@@ -401,64 +425,43 @@ mu_string_to_flags (const char *buffer, int *pflags)
   else
     sep = buffer;
 
-  while (*sep)
+  for (; *sep; sep++)
     {
-      if (strchr (sep, 'R') != NULL || strchr (sep, 'r') != NULL)
-	*pflags |= MU_ATTRIBUTE_READ;
-      if (strchr (sep, 'O') != NULL || strchr (sep, 'o') != NULL)
-	*pflags |= MU_ATTRIBUTE_SEEN;
-      if (strchr (sep, 'A') != NULL || strchr (sep, 'a') != NULL)
-	*pflags |= MU_ATTRIBUTE_ANSWERED;
-      if (strchr (sep, 'F') != NULL || strchr (sep, 'f') != NULL)
-	*pflags |= MU_ATTRIBUTE_FLAGGED;
-      sep++;
+      struct flagtrans *ft;
+
+      for (ft = flagtrans; ft->flag; ft++)
+	if (ft->letter == *sep)
+	  {
+	    *pflags |= ft->flag;
+	    break;
+	  }
     }
   return 0;
 }
 
+/* NOTE: When adding/removing flags, make sure to update the
+   MU_STATUS_BUF_SIZE define in include/mailutils/attribute.h */
 int
-mu_attribute_to_string (mu_attribute_t attr, char *buffer, size_t len, size_t *pn)
-{
-  int flags = 0;;
-  mu_attribute_get_flags (attr, &flags);
-  return flags_to_string (flags, buffer, len, pn);
-}
-
-static int
-flags_to_string (int flags, char *buffer, size_t len, size_t *pn)
+mu_attribute_to_string (mu_attribute_t attr, char *buffer, size_t len,
+			size_t *pn)
 {
-  char status[32];
-  char a[8];
-  size_t i;
-
-  *status = *a = '\0';
-
-  if (flags & MU_ATTRIBUTE_SEEN)
-    strcat (a, "O");
-  if (flags & MU_ATTRIBUTE_ANSWERED)
-    strcat (a, "A");
-  if (flags & MU_ATTRIBUTE_FLAGGED)
-    strcat (a, "F");
-  if (flags & MU_ATTRIBUTE_READ)
-    strcat (a, "R");
-  if (flags & MU_ATTRIBUTE_DELETED)
-    strcat (a, "d");
-
-  if (*a != '\0')
-    {
-      strcpy (status, "Status: ");
-      strcat (status, a);
-      strcat (status, "\n");
-    }
+  int flags = 0;
+  char buf[MU_STATUS_BUF_SIZE];
+  int i;
+  int rc;
+  struct flagtrans *ft;
+  
+  rc = mu_attribute_get_flags (attr, &flags);
+  if (rc)
+    return rc;
 
-  i = strlen (status);
+  i = 0;
+  for (ft = flagtrans; ft->flag; ft++)
+    if (ft->flag & flags)
+      buf[i++] = ft->letter;
+  buf[i++] = 0;
 
-  if (buffer && len != 0)
-    {
-      strncpy (buffer, status, len - 1);
-      buffer[len - 1] = '\0';
-      i = strlen (buffer);
-    }
+  i = mu_cpystr (buffer, buf, i);
   if (pn)
     *pn = i;
   return 0;
diff --git a/mailbox/wicket.c b/mailbox/wicket.c
index 6ef4dc3..30392b6 100644
--- a/mailbox/wicket.c
+++ b/mailbox/wicket.c
@@ -253,7 +253,7 @@ static int
 get_ticket (mu_url_t url, const char *user, const char *filename,
 	    mu_url_t * ticket)
 {
-  int err = 0;
+  int status = MU_ERR_NOENT;
   FILE *fp = NULL;
   size_t buflen = 128;
   char *buf = NULL;
@@ -279,7 +279,8 @@ get_ticket (mu_url_t url, const char *user, const char *filename,
       char *ptr = buf;
       int len = 0;
       mu_url_t u = NULL;
-
+      int err;
+      
       /* fgets:
 	 1) return true, read some data
            1a) read a newline, so break
@@ -310,26 +311,21 @@ get_ticket (mu_url_t url, const char *user, const char *filename,
 
       /* Truncate a trailing newline. */
       if (len && buf[len - 1] == '\n')
-	buf[len - 1] = 0;
+	buf[--len] = 0;
 
       /* Skip leading spaces.  */
       ptr = buf;
       while (isspace (*ptr))
 	ptr++;
 
-      /* Skip comments. */
-      if (*ptr == '#')
-	continue;
-
-      /* Skip empty lines. */
-      if ((len = strlen (ptr)) == 0)
+      /* Skip empty lines and comments. */
+      if (!*ptr || *ptr == '#')
 	continue;
 
       if ((err = mu_url_create (&u, ptr)) != 0)
 	{
-	  free (buf);
-	  fclose (fp);
-	  return err;
+	  status = err;
+	  break;
 	}
       if ((err = mu_url_parse (u)) != 0)
 	{
@@ -361,13 +357,14 @@ get_ticket (mu_url_t url, const char *user, const char *filename,
       /* Looks like a match! */
       *ticket = u;
       u = NULL;
+      status = 0;
       break;
     }
 
   fclose (fp);
   free (buf);
 
-  return 0;
+  return status;
 }
 
 static int


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Wed Mar 04 17:38:12 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LezjA-0001iq-EL
	for mharc-commit-mailutils@gnu.org; Wed, 04 Mar 2009 17:38:12 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Lezj8-0001iZ-H9
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 17:38:10 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Lezj7-0001iN-Dw
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 17:38:09 -0500
Received: from [199.232.76.173] (port=52410 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Lezj7-0001iK-6o
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 17:38:09 -0500
Received: from savannah.gnu.org ([199.232.41.3]:45291 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Lezj6-0000de-Ul
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 17:38:09 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Lezj6-0007EM-A4
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 22:38:08 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Lezj4-0007Df-Hw
	for commit-mailutils@gnu.org; Wed, 04 Mar 2009 22:38:08 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 178da060ff84dee3653bd9ad82e4f67d5b804eff
X-Git-Newrev: 29b072f730bbe6b96d8518987ed125a6020fb5d4
Message-Id: <E1Lezj4-0007Df-Hw@cvs.savannah.gnu.org>
Date: Wed, 04 Mar 2009 22:38:07 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-235-g29b072f
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Mar 2009 22:38:10 -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=29b072f730bbe6b96d8518987ed125a6020fb5d4

The branch, master has been updated
       via  29b072f730bbe6b96d8518987ed125a6020fb5d4 (commit)
      from  178da060ff84dee3653bd9ad82e4f67d5b804eff (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 29b072f730bbe6b96d8518987ed125a6020fb5d4
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Mar 5 00:37:46 2009 +0200

    Fix coredumps on null passwords in pam and ldap auth.
    
    * libmu_auth/pam.c (mu_pam_service): Initialize to package name.
    (mu_pam_conv): Raise PAM_AUTHTOK_RECOVER_ERR, if password is NULL.
    Fix memory leak on errors.
    (mu_authenticate_pam): Fix return value.
    * libmu_auth/ldap.c (mu_ldap_authenticate): Prevent coredump on empty password.

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

Summary of changes:
 libmu_auth/ldap.c |    2 +-
 libmu_auth/pam.c  |   88 ++++++++++++++++++++++++++++++++++++++---------------
 2 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/libmu_auth/ldap.c b/libmu_auth/ldap.c
index 7e76926..760c695 100644
--- a/libmu_auth/ldap.c
+++ b/libmu_auth/ldap.c
@@ -769,7 +769,7 @@ mu_ldap_authenticate (struct mu_auth_data **return_data MU_ARG_UNUSED,
   char *db_pass = auth_data->passwd;
   char *pass = call_data;
 
-  if (auth_data->passwd == NULL)
+  if (auth_data->passwd == NULL || !pass)
     return EINVAL;
 
   if (db_pass[0] == '{')
diff --git a/libmu_auth/pam.c b/libmu_auth/pam.c
index ed0a0a9..903ba24 100644
--- a/libmu_auth/pam.c
+++ b/libmu_auth/pam.c
@@ -39,63 +39,96 @@
 #ifdef HAVE_CRYPT_H
 # include <crypt.h>
 #endif
-
 #include <mailutils/list.h>
+#include <mailutils/errno.h>
 #include <mailutils/iterator.h>
 #include <mailutils/mailbox.h>
 #include <mailutils/mu_auth.h>
 #include <mailutils/nls.h>
 
-char *mu_pam_service = NULL;
+char *mu_pam_service = PACKAGE;
 
 #ifdef USE_LIBPAM
 #define COPY_STRING(s) (s) ? strdup(s) : NULL
 
 static char *_pwd;
 static char *_user;
-static int _perr = 0;
+
+#define overwrite_and_free(ptr)			\
+  do						\
+    {						\
+      char *s = ptr;				\
+      while (*s)				\
+	*s++ = 0;				\
+    }						\
+  while (0)
+
 
 static int
 mu_pam_conv (int num_msg, const struct pam_message **msg,
 	     struct pam_response **resp, void *appdata_ptr MU_ARG_UNUSED)
 {
-  int replies = 0;
+  int status = PAM_SUCCESS;
+  int i;
   struct pam_response *reply = NULL;
 
-  reply = malloc (sizeof (*reply) * num_msg);
+  reply = calloc (num_msg, sizeof (*reply));
   if (!reply)
     return PAM_CONV_ERR;
 
-  for (replies = 0; replies < num_msg; replies++)
+  for (i = 0; i < num_msg && status == PAM_SUCCESS; i++)
     {
-      switch (msg[replies]->msg_style)
+      switch (msg[i]->msg_style)
 	{
 	case PAM_PROMPT_ECHO_ON:
-	  reply[replies].resp_retcode = PAM_SUCCESS;
-	  reply[replies].resp = COPY_STRING (_user);
+	  reply[i].resp_retcode = PAM_SUCCESS;
+	  reply[i].resp = COPY_STRING (_user);
 	  /* PAM frees resp */
 	  break;
 
 	case PAM_PROMPT_ECHO_OFF:
-	  reply[replies].resp_retcode = PAM_SUCCESS;
-	  reply[replies].resp = COPY_STRING (_pwd);
-	  /* PAM frees resp */
+	  if (_pwd)
+	    {
+	      reply[i].resp_retcode = PAM_SUCCESS;
+	      reply[i].resp = COPY_STRING (_pwd);
+	      /* PAM frees resp */
+	    }
+	  else
+	    status = PAM_AUTHTOK_RECOVER_ERR;
 	  break;
 
 	case PAM_TEXT_INFO:
 	case PAM_ERROR_MSG:
-	  reply[replies].resp_retcode = PAM_SUCCESS;
-	  reply[replies].resp = NULL;
+	  reply[i].resp_retcode = PAM_SUCCESS;
+	  reply[i].resp = NULL;
 	  break;
  
 	default:
-	  free (reply);
-	  _perr = 1;
-	  return PAM_CONV_ERR;
+	  status = PAM_CONV_ERR;
 	}
     }
-  *resp = reply;
-  return PAM_SUCCESS;
+  if (status != PAM_SUCCESS)
+    {
+      for (i = 0; i < num_msg; i++)
+	if (reply[i].resp)
+	  {
+	    switch (msg[i]->msg_style)
+	      {
+	      case PAM_PROMPT_ECHO_ON:
+	      case PAM_PROMPT_ECHO_OFF:
+		overwrite_and_free (reply[i].resp);
+		break;
+		
+	      case PAM_ERROR_MSG:
+	      case PAM_TEXT_INFO:
+		free (reply[i].resp);
+	      }
+	  }
+      free (reply);
+    }
+  else
+    *resp = reply;
+  return status;
 }
 
 static struct pam_conv PAM_conversation = { &mu_pam_conv, NULL };
@@ -111,11 +144,10 @@ mu_authenticate_pam (struct mu_auth_data **return_data MU_ARG_UNUSED,
   pam_handle_t *pamh;
   int pamerror;
 
-#define PAM_ERROR if (_perr || (pamerror != PAM_SUCCESS)) \
-    goto pam_errlab;
+#define PAM_ERROR if (pamerror != PAM_SUCCESS) goto pam_errlab;
 
   if (!auth_data)
-    return 1;
+    return EINVAL;
   
   _user = (char *) auth_data->name;
   _pwd = pass;
@@ -128,7 +160,14 @@ mu_authenticate_pam (struct mu_auth_data **return_data MU_ARG_UNUSED,
   pamerror = pam_setcred (pamh, PAM_ESTABLISH_CRED);
  pam_errlab:
   pam_end (pamh, PAM_SUCCESS);
-  return pamerror != PAM_SUCCESS;
+  switch (pamerror)
+    {
+    case PAM_SUCCESS:
+      return 0;
+    case PAM_AUTH_ERR:
+      return MU_ERR_AUTH_FAILURE;
+    }
+  return MU_ERR_FAILURE;
 }
 
 #else
@@ -139,8 +178,7 @@ mu_authenticate_pam (struct mu_auth_data **return_data MU_ARG_UNUSED,
 		     void *func_data MU_ARG_UNUSED,
 		     void *call_data MU_ARG_UNUSED)
 {
-  errno = ENOSYS;
-  return 1;
+  return ENOSYS;
 }
 
 #endif


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Thu Mar 12 12:18:02 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Lhnbe-0000hO-Kq
	for mharc-commit-mailutils@gnu.org; Thu, 12 Mar 2009 12:18:02 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Lhnbc-0000fc-SW
	for commit-mailutils@gnu.org; Thu, 12 Mar 2009 12:18:00 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Lhnbc-0000eh-1m
	for commit-mailutils@gnu.org; Thu, 12 Mar 2009 12:18:00 -0400
Received: from [199.232.76.173] (port=55155 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Lhnbb-0000eP-SV
	for commit-mailutils@gnu.org; Thu, 12 Mar 2009 12:17:59 -0400
Received: from savannah.gnu.org ([199.232.41.3]:37608 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Lhnbb-0000IG-Gx
	for commit-mailutils@gnu.org; Thu, 12 Mar 2009 12:17:59 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Lhnba-0006uz-1Z
	for commit-mailutils@gnu.org; Thu, 12 Mar 2009 16:17:58 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LhnbV-0006uU-Qf
	for commit-mailutils@gnu.org; Thu, 12 Mar 2009 16:17:57 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: fef67bbdc7399fb7b2820057431bd4d703686c73
X-Git-Newrev: 5b1a5402662d6685f0216a528c1c19536a7d421a
Message-Id: <E1LhnbV-0006uU-Qf@cvs.savannah.gnu.org>
Date: Thu, 12 Mar 2009 16:17:55 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-239-g5b1a540
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 12 Mar 2009 16:18: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=5b1a5402662d6685f0216a528c1c19536a7d421a

The branch, master has been updated
       via  5b1a5402662d6685f0216a528c1c19536a7d421a (commit)
      from  fef67bbdc7399fb7b2820057431bd4d703686c73 (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 5b1a5402662d6685f0216a528c1c19536a7d421a
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Mar 12 17:38:02 2009 +0200

    Bugfixes.
    
    * imap4d/bye.c: Discern between input and output errors.
    * imap4d/imap4d.h (ERR_NO_IFILE): New error code.
    * imap4d/util.c: Discern between input and output errors.
    Improve trace output.
    (imap4d_getline): Signal ERR_NO_IFILE on EOF.
    * movemail/movemail.c: Fix include statements.

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

Summary of changes:
 imap4d/bye.c        |    7 +++++-
 imap4d/imap4d.h     |   11 +++++----
 imap4d/util.c       |   56 +++++++++++++++++++++++++++++++++++++++++---------
 movemail/movemail.c |    2 +-
 4 files changed, 59 insertions(+), 17 deletions(-)

diff --git a/imap4d/bye.c b/imap4d/bye.c
index 85dc43a..801644c 100644
--- a/imap4d/bye.c
+++ b/imap4d/bye.c
@@ -65,7 +65,12 @@ imap4d_bye0 (int reason, struct imap4d_command *command)
 
     case ERR_NO_OFILE:
       status = EX_IOERR;
-      mu_diag_output (MU_DIAG_INFO, _("No socket to send to"));
+      mu_diag_output (MU_DIAG_INFO, _("Write error on control stream"));
+      break;
+
+    case ERR_NO_IFILE:
+      status = EX_IOERR;
+      mu_diag_output (MU_DIAG_INFO, _("Read error on control stream"));
       break;
 
     case ERR_MAILBOX_CORRUPTED:
diff --git a/imap4d/imap4d.h b/imap4d/imap4d.h
index 8a6e8e4..c054884 100644
--- a/imap4d/imap4d.h
+++ b/imap4d/imap4d.h
@@ -145,11 +145,12 @@ struct imap4d_command
 #define OK                    0
 #define ERR_NO_MEM            1
 #define ERR_NO_OFILE          2
-#define ERR_TIMEOUT           3
-#define ERR_SIGNAL            4
-#define ERR_TLS               5
-#define ERR_MAILBOX_CORRUPTED 6
-#define ERR_TERMINATE         7
+#define ERR_NO_IFILE          3
+#define ERR_TIMEOUT           4
+#define ERR_SIGNAL            5
+#define ERR_TLS               6
+#define ERR_MAILBOX_CORRUPTED 7
+#define ERR_TERMINATE         8
   
 /* Namespace numbers */
 #define NS_PRIVATE 0
diff --git a/imap4d/util.c b/imap4d/util.c
index f70e0a3..47b1f08 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -340,7 +340,10 @@ util_out (int rc, const char *format, ...)
     imap4d_bye (ERR_NO_MEM);
 
   if (imap4d_transcript)
-    mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
+    {
+      int len = strcspn (buf, "\r\n");
+      mu_diag_output (MU_DIAG_DEBUG, "sent: %*.*s", len, len, buf);
+    }
 
   status = mu_stream_sequential_write (ostream, buf, strlen (buf));
   free (buf);
@@ -381,7 +384,7 @@ util_finish (struct imap4d_command *command, int rc, const char *format, ...)
   free (tempbuf);
 
   if (imap4d_transcript)
-    mu_diag_output (MU_DIAG_DEBUG, "sent: %s\r\n", buf);
+    mu_diag_output (MU_DIAG_DEBUG, "sent: %s", buf);
 
   mu_stream_sequential_write (ostream, buf, strlen (buf));
   free (buf);
@@ -882,13 +885,16 @@ util_uidvalidity (mu_mailbox_t smbox, unsigned long *uidvp)
 void
 util_setio (FILE *in, FILE *out)
 {
-  if (!out || !in)
+  if (!in)
+    imap4d_bye (ERR_NO_IFILE);
+  if (!out)
     imap4d_bye (ERR_NO_OFILE);
 
   setvbuf (in, NULL, _IOLBF, 0);
   setvbuf (out, NULL, _IOLBF, 0);
-  if (mu_stdio_stream_create (&istream, in, MU_STREAM_NO_CLOSE)
-      || mu_stdio_stream_create (&ostream, out, MU_STREAM_NO_CLOSE))
+  if (mu_stdio_stream_create (&istream, in, MU_STREAM_NO_CLOSE))
+    imap4d_bye (ERR_NO_IFILE);
+  if (mu_stdio_stream_create (&ostream, out, MU_STREAM_NO_CLOSE))
     imap4d_bye (ERR_NO_OFILE);
 }
 
@@ -1312,12 +1318,12 @@ check_input_err (int rc, size_t sz)
       
       mu_diag_output (MU_DIAG_INFO,
 		      _("Error reading from input file: %s"), p);
-      imap4d_bye (ERR_NO_OFILE);
+      imap4d_bye (ERR_NO_IFILE);
     }
   else if (sz == 0)
     {
       mu_diag_output (MU_DIAG_INFO, _("Unexpected eof on input"));
-      imap4d_bye (ERR_NO_OFILE);
+      imap4d_bye (ERR_NO_IFILE);
     }
 }
 
@@ -1358,10 +1364,30 @@ imap4d_readline (struct imap4d_tokbuf *tok)
       char *last_arg;
       size_t off = imap4d_tokbuf_getline (tok);
       if (transcript)
-        mu_diag_output (MU_DIAG_DEBUG, "recv: %s", tok->buffer);
+        {
+          int len;
+          char *p = strcasestr (tok->buffer, "LOGIN");
+          if (p && p > tok->buffer && isspace(p[-1]))
+            {
+              char *q = p + 5;
+              while (*q && isspace (*q))
+                q++;
+              while (*q && !isspace (*q))
+                q++;
+              len = q - tok->buffer; 
+              mu_diag_output (MU_DIAG_DEBUG, "recv: %*.*s {censored}", len, len,
+                              tok->buffer);
+             }
+           else
+             {
+               len = strcspn (tok->buffer, "\r\n");
+               mu_diag_output (MU_DIAG_DEBUG, "recv: %*.*s", 
+                               len, len, tok->buffer);
+             }
+        }
       imap4d_tokbuf_tokenize (tok, off);
       if (tok->argc == 0)
-	break;
+        break;  
       last_arg = tok->buffer + tok->argp[tok->argc - 1];
       if (last_arg[0] == '{' && last_arg[strlen(last_arg)-1] == '}')
 	{
@@ -1439,7 +1465,17 @@ imap4d_getline (char **pbuf, size_t *psize, size_t *pnbytes)
       char *s = *pbuf;
       len = util_trim_nl (s, len);
       if (imap4d_transcript)
-        mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s);
+        {
+          if (len)
+            mu_diag_output (MU_DIAG_DEBUG, "recv: %s", s);
+          else
+            mu_diag_output (MU_DIAG_DEBUG, "got EOF");
+        }
+      if (len == 0)
+        {
+          imap4d_bye (ERR_NO_IFILE);
+          /*FIXME rc = ECONNABORTED;*/
+        }
       if (pnbytes)
 	*pnbytes = len;
     }
diff --git a/movemail/movemail.c b/movemail/movemail.c
index b2674e0..f3004ca 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -29,7 +29,7 @@
 #include <mailutils/tls.h>
 #include <mu_asprintf.h>
 #include "mailutils/libargp.h"
-#include <lib/muaux.h>
+#include <muaux.h>
 
 const char *program_version = "movemail (" PACKAGE_STRING ")";
 static char doc[] = N_("GNU movemail");


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Thu Mar 19 17:45:33 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LkQ3R-0005nn-66
	for mharc-commit-mailutils@gnu.org; Thu, 19 Mar 2009 17:45:33 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LkQ3O-0005me-V8
	for commit-mailutils@gnu.org; Thu, 19 Mar 2009 17:45:31 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LkQ3N-0005ly-EY
	for commit-mailutils@gnu.org; Thu, 19 Mar 2009 17:45:30 -0400
Received: from [199.232.76.173] (port=56389 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LkQ3N-0005ln-6n
	for commit-mailutils@gnu.org; Thu, 19 Mar 2009 17:45:29 -0400
Received: from savannah.gnu.org ([199.232.41.3]:57377 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LkQ3M-0003ix-SB
	for commit-mailutils@gnu.org; Thu, 19 Mar 2009 17:45:28 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LkQ3M-0004zm-8X
	for commit-mailutils@gnu.org; Thu, 19 Mar 2009 21:45:28 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LkQ3K-0004zD-5Z
	for commit-mailutils@gnu.org; Thu, 19 Mar 2009 21:45:28 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 17751e6bf80cd75c278145222f414f4cd434fe9e
X-Git-Newrev: c09870d821d43dadfc6ebc9de143172fce358243
Message-Id: <E1LkQ3K-0004zD-5Z@cvs.savannah.gnu.org>
Date: Thu, 19 Mar 2009 21:45:26 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-242-gc09870d
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Mar 2009 21:45:31 -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=c09870d821d43dadfc6ebc9de143172fce358243

The branch, master has been updated
       via  c09870d821d43dadfc6ebc9de143172fce358243 (commit)
      from  17751e6bf80cd75c278145222f414f4cd434fe9e (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 c09870d821d43dadfc6ebc9de143172fce358243
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Mar 19 23:42:03 2009 +0200

    Mail: fix parsing of arguments containing =.
    
    * mail/util.c (util_do_command): Do not use = as a delimiter.
    * mail/set.c (mail_set): = is no longer returned as a token.
    * mail/setenv.c (mail_setenv): Likewise.

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

Summary of changes:
 mail/set.c    |   19 +++++++++----------
 mail/setenv.c |   19 +++++--------------
 mail/util.c   |    7 +++----
 3 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/mail/set.c b/mail/set.c
index 5c5c256..78c0b48 100644
--- a/mail/set.c
+++ b/mail/set.c
@@ -40,25 +40,24 @@ mail_set (int argc, char **argv)
 
       for (i = 1; i < argc; i++)
 	{
-	  if (!strncmp ("no", argv[i], 2))
+	  char *value = strchr (argv[i], '=');
+	  if (value)
+	    *value++ = 0;
+	  
+	  if (!strncmp ("no", argv[i], 2) && !value)
 	    {
 	      util_setenv (&argv[i][2], NULL, Mail_env_boolean, 1);
 	    }
-	  else if (i+1 < argc && argv[i+1][0] == '=')
+	  else if (value)
 	    {
 	      int nval;
-	      char *name = argv[i];
 	      char *p;
 	      
-	      i += 2;
-	      if (i >= argc)
-		break;
-
-	      nval = strtoul (argv[i], &p, 0);
+	      nval = strtoul (value, &p, 0);
 	      if (*p == 0)
-		util_setenv (name, &nval, Mail_env_number, 1);
+		util_setenv (argv[i], &nval, Mail_env_number, 1);
 	      else
-		util_setenv (name, argv[i], Mail_env_string, 1);
+		util_setenv (argv[i], value, Mail_env_string, 1);
 	    }
 	  else
 	    {
diff --git a/mail/setenv.c b/mail/setenv.c
index d3ac45d..624fb13 100644
--- a/mail/setenv.c
+++ b/mail/setenv.c
@@ -39,21 +39,12 @@ mail_setenv (int argc, char **argv)
       /* Note: POSIX requires that the argument to putenv become part
 	 of the environment itself, hence the memory allocation. */
 
-      for (i = 1; i < argc;)
+      for (i = 1; i < argc; i++)
 	{
-	  char *p;
-	  
-	  if (i+1 < argc && argv[i+1][0] == '=')
-	    {
-	      asprintf (&p, "%s=%s", argv[i], argv[i+2]);
-	      i += 3;
-	    }
-	  else
-	    {
-	      p = argv[i];
-	      i++;
-	    }
-	  putenv (p);
+	  char *value = strchr (argv[i], '=');
+	  if (value)
+	    *value++ = 0;
+	  setenv (argv[i], value ? value : "", 1);
 	}
     }
   return 0;
diff --git a/mail/util.c b/mail/util.c
index 108b6b1..5a5b8ca 100644
--- a/mail/util.c
+++ b/mail/util.c
@@ -52,7 +52,6 @@ util_do_command (const char *c, ...)
   const struct mail_command_entry *entry = NULL;
   char *cmd = NULL;
   va_list ap;
-  static const char *delim = "=";
   
   va_start (ap, c);
   status = vasprintf (&cmd, c, ap);
@@ -82,7 +81,7 @@ util_do_command (const char *c, ...)
 	    return 0;
 	}
 
-      if (mu_argcv_get (cmd, delim, NULL, &argc, &argv) == 0 && argc > 0)
+      if (mu_argcv_get (cmd, NULL, NULL, &argc, &argv) == 0 && argc > 0)
 	{
 	  char *p;
 
@@ -93,7 +92,7 @@ util_do_command (const char *c, ...)
 	    {
 	      asprintf (&p, "print %s", argv[0]);
 	      mu_argcv_free (argc, argv);
-	      mu_argcv_get (p, delim, NULL, &argc, &argv);
+	      mu_argcv_get (p, NULL, NULL, &argc, &argv);
 	      free (p);
 	    }
 
@@ -690,7 +689,7 @@ util_setenv (const char *variable, void *value, mail_env_data_t type,
 	  abort();
 	}
     }
-
+    
   /* Special handling for some variables */
   if (strcmp (variable, "replyregex") == 0)
     { 


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Sun Mar 22 11:28:18 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LlPb0-0001mo-FE
	for mharc-commit-mailutils@gnu.org; Sun, 22 Mar 2009 11:28:18 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LlPay-0001md-Ob
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 11:28:16 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LlPax-0001mL-7I
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 11:28:16 -0400
Received: from [199.232.76.173] (port=53124 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LlPax-0001mI-28
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 11:28:15 -0400
Received: from savannah.gnu.org ([199.232.41.3]:56864 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LlPaw-00075H-8l
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 11:28:14 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LlPav-00068W-PV
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 15:28:13 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LlPap-00067e-TA
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 15:28:13 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: c09870d821d43dadfc6ebc9de143172fce358243
X-Git-Newrev: c37b2f1f3e51dc5489b349cba20771cd762db148
Message-Id: <E1LlPap-00067e-TA@cvs.savannah.gnu.org>
Date: Sun, 22 Mar 2009 15:28:09 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-243-gc37b2f1
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Mar 2009 15:28:17 -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=c37b2f1f3e51dc5489b349cba20771cd762db148

The branch, master has been updated
       via  c37b2f1f3e51dc5489b349cba20771cd762db148 (commit)
      from  c09870d821d43dadfc6ebc9de143172fce358243 (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 c37b2f1f3e51dc5489b349cba20771cd762db148
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sun Mar 22 17:26:55 2009 +0200

    Improve autoconf machinery, drop support for Guile < 1.8
    
    * scripts/guile-1.4: Removed.
    * scripts/guile-1.6/guile-doc-snarf: Move to the parent dir.
    * scripts/guile-1.6/guile-doc-snarf.awk: Move to the parent dir.
    * scripts: Rename to mu-aux. All references updated.
    * am/enable.m4 (MU_ENABLE_SUPPORT): add fourth argument, action-default
    Translate + to x.
    * am/guile.m4 (MU_RESULT_ACTIONS): Remove.
    (MU_CHECK_GUILE): Rewrite. Drop support for versions < 1.8
    * am/lib.m4 (MU_CHECK_LIB): Rewrite using a cleaner approach.
    * bootstrap.conf: Remove build_aux assignement.
    * configure.ac: Assume a new naming scheme for optional builds: for
    each subst variable named MU_whatever_BUILD there is a corresponing
    Makefile.am variable named MU_whatever_LIST, if `whatever' is to be
    built MU_whatever_BUILD is set to '$(MU_whatever_LIST)'
    New option --disable-c++.
    Improve status output.
    * examples/Makefile.am, examples/cpp/Makefile.am,
    include/mailutils/Makefile.am, libmu_cpp/Makefile.am, libmu_scm/Makefile.am,
    libmu_sieve/Makefile.am, libmu_sieve/extensions/Makefile.am,
    libmu_sieve/load.c, mail.remote/Makefile.am,
    mail.remote/testsuite/Makefile.am, mailbox/Makefile.am,
    mh/Makefile.am, mimeview/Makefile.am, mu-aux/Makefile.am,
    python/mailutils/Makefile.am: Reflect changes to autoconf machinery.
    
    * /include/mailutils/guile.h: Drop support for versions < 1.8
    * libmu_scm/mu_util.c: Likewise.

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

Summary of changes:
 .gitignore                                        |    1 +
 Makefile.am                                       |    2 +-
 am/enable.m4                                      |    9 +-
 am/guile.m4                                       |  154 ++++++-----------
 am/lib.m4                                         |   41 +++--
 bootstrap.conf                                    |    1 -
 configure.ac                                      |  193 +++++++++++----------
 doc/texinfo/Makefile.am                           |    2 +-
 examples/Makefile.am                              |    7 +-
 examples/cpp/Makefile.am                          |    6 +-
 include/mailutils/Makefile.am                     |    6 +-
 include/mailutils/guile.h                         |   57 +------
 libmu_cpp/Makefile.am                             |    6 +-
 libmu_scm/Makefile.am                             |    8 +-
 libmu_scm/mu_util.c                               |    6 +-
 libmu_sieve/Makefile.am                           |    4 +-
 libmu_sieve/extensions/Makefile.am                |   17 +--
 libmu_sieve/load.c                                |    4 +-
 mail.remote/Makefile.am                           |    4 +-
 mail.remote/testsuite/Makefile.am                 |    2 +-
 mailbox/Makefile.am                               |    4 +-
 mh/Makefile.am                                    |   14 +-
 mimeview/Makefile.am                              |    2 +-
 {scripts => mu-aux}/Makefile.am                   |    3 +-
 {scripts => mu-aux}/debugdef.m4                   |    0 
 {scripts => mu-aux}/generr.awk                    |    0 
 {scripts/guile-1.6 => mu-aux}/guile-doc-snarf     |    0 
 {scripts/guile-1.6 => mu-aux}/guile-doc-snarf.awk |    0 
 {scripts => mu-aux}/gylwrap                       |    0 
 {scripts => mu-aux}/mailutils.spec.in             |    0 
 {scripts => mu-aux}/sqlmod.sh                     |    0 
 {scripts => mu-aux}/texify.sed                    |    0 
 python/libmu_py/Makefile.am                       |    7 +-
 python/mailutils/Makefile.am                      |    4 +-
 scripts/.cvsignore                                |   17 --
 scripts/.gitignore                                |   16 --
 scripts/guile-1.4/.gitignore                      |    2 -
 scripts/guile-1.4/Makefile.am                     |   23 ---
 scripts/guile-1.4/guile-doc-snarf                 |   82 ---------
 scripts/guile-1.4/guile-func-name-check           |   64 -------
 scripts/guile-1.4/guile-snarf.awk                 |   98 -----------
 scripts/guile-1.6/.gitignore                      |    2 -
 scripts/guile-1.6/Makefile.am                     |   22 ---
 43 files changed, 238 insertions(+), 652 deletions(-)
 rename {scripts => mu-aux}/Makefile.am (96%)
 rename {scripts => mu-aux}/debugdef.m4 (100%)
 rename {scripts => mu-aux}/generr.awk (100%)
 rename {scripts/guile-1.6 => mu-aux}/guile-doc-snarf (100%)
 rename {scripts/guile-1.6 => mu-aux}/guile-doc-snarf.awk (100%)
 rename {scripts => mu-aux}/gylwrap (100%)
 rename {scripts => mu-aux}/mailutils.spec.in (100%)
 rename {scripts => mu-aux}/sqlmod.sh (100%)
 rename {scripts => mu-aux}/texify.sed (100%)
 delete mode 100644 scripts/.cvsignore
 delete mode 100644 scripts/.gitignore
 delete mode 100644 scripts/guile-1.4/.gitignore
 delete mode 100644 scripts/guile-1.4/Makefile.am
 delete mode 100755 scripts/guile-1.4/guile-doc-snarf
 delete mode 100755 scripts/guile-1.4/guile-func-name-check
 delete mode 100755 scripts/guile-1.4/guile-snarf.awk
 delete mode 100644 scripts/guile-1.6/.gitignore
 delete mode 100644 scripts/guile-1.6/Makefile.am

diff --git a/.gitignore b/.gitignore
index dc3cea2..4a3a0d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@ Makefile
 Makefile.in
 aclocal.m4
 autom4te.cache
+build-aux
 config.h
 config.h.in
 config.log
diff --git a/Makefile.am b/Makefile.am
index c1cffd4..d22df6d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,7 @@ AUTOMAKE_OPTIONS = gnits 1.8.5 dist-bzip2 std-options
 ACLOCAL_AMFLAGS = -I m4 -I am
 
 SUBDIRS = \
+ mu-aux\
  include\
  po\
  testsuite\
@@ -44,7 +45,6 @@ SUBDIRS = \
  maidag\
  mail\
  sieve\
- scripts\
  guimb\
  messages\
  comsat\
diff --git a/am/enable.m4 b/am/enable.m4
index d0d6ad0..876be0e 100644
--- a/am/enable.m4
+++ b/am/enable.m4
@@ -16,11 +16,12 @@ dnl along with this program; if not, write to the Free Software Foundation,
 dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 dnl
 
-dnl MU_ENABLE_SUPPORT(feature, [action-if-true], [action-if-false])
+dnl MU_ENABLE_SUPPORT(feature, [action-if-true], [action-if-false],
+dnl                   [action-default])
 
 AC_DEFUN([MU_ENABLE_SUPPORT], [
-	pushdef([mu_upcase],translit($1,[a-z-],[A-Z_]))
-	pushdef([mu_cache_var],[mu_cv_enable_]translit($1,[-],[_]))
+	pushdef([mu_upcase],translit($1,[a-z+-],[A-ZX_]))
+	pushdef([mu_cache_var],[mu_cv_enable_]translit($1,[+-],[x_]))
 
 	AC_ARG_ENABLE($1, 
 	              AC_HELP_STRING([--disable-]$1,
@@ -31,7 +32,7 @@ AC_DEFUN([MU_ENABLE_SUPPORT], [
                 no)  mu_cache_var=no;;
 	        *)   AC_MSG_ERROR([bad value ${enableval} for --disable-$1]) ;;
         esac],
-                      [mu_cache_var=yes])
+                      [ifelse([$4],,mu_cache_var=yes,[$4])])
 
 	if test x"[$]mu_cache_var" = x"yes"; then
 		ifelse([$2],,:,[$2])
diff --git a/am/guile.m4 b/am/guile.m4
index 30fa298..cf283fd 100644
--- a/am/guile.m4
+++ b/am/guile.m4
@@ -16,110 +16,58 @@ dnl along with this program; if not, write to the Free Software Foundation,
 dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 dnl
 
-dnl MU_RESULT_ACTIONS -- generate shell code for the result of a test
-dnl   $1 -- CVAR  -- cache variable to check
-dnl   $2 -- NAME  -- if not empty, used to generate a default value TRUE:
-dnl                  `AC_DEFINE(HAVE_NAME)'
-dnl   $2 -- TRUE  -- what to do if the CVAR is not `no'
-dnl   $3 -- FALSE -- what to do otherwise; defaults to `:'
-dnl
-AC_DEFUN([MU_RESULT_ACTIONS], [
-[if test "$$1" != "" -a "$$1" != no; then
-  ]ifelse([$3], ,
-          [AC_DEFINE(HAVE_]translit($2, [a-z ./<>], [A-Z___])[,1,[FIXME])],
-          [$3])[
-else
-  ]ifelse([$4], , [:], [$4])[
-fi]])dnl
-
+dnl MU_CHECK_GUILE(minversion, [act-if-found], [ac-if-not-found])
+dnl                    $1            $2               $3
 AC_DEFUN([MU_CHECK_GUILE],
 [
- if test "x$mu_cv_lib_guile" = x; then
-   cached=""
-   AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $PATH)
-   if test $GUILE_CONFIG = no; then
-     mu_cv_lib_guile=no
-   else
-     GUILE_INCLUDES=`$GUILE_CONFIG compile`
-     GUILE_LIBS=`$GUILE_CONFIG link`
-   fi
+  AS_VAR_SET([mu_cv_guile], [no])
+  AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $PATH)
+  if test "$GUILE_CONFIG" = no; then
+    m4_if($3,,[AC_MSG_ERROR(cannot find Guile)], [$3])
+  else
+    AC_SUBST(GUILE_INCLUDES)
+    AC_SUBST(GUILE_LIBS)
+    AC_SUBST(GUILE_VERSION)
+    AC_SUBST(GUILE_VERSION_NUMBER)
+  
+    GUILE_INCLUDES=`$GUILE_CONFIG compile`
+    GUILE_LIBS=`$GUILE_CONFIG link`
+    GUILE_VERSION=`($GUILE_CONFIG --version 2>&1; echo '')|sed 's/guile-config [[^0-9]]* \([[0-9]][[0-9.]]*\)$/\1/'`
+    VEX=`echo $GUILE_VERSION | sed 's/\./ \\\\* 1000 + /;s/\./ \\\\* 100 + /'`
+    GUILE_VERSION_NUMBER=`eval expr "$VEX"`
+
+    ifelse($1,,,[
+      VEX=`echo $1 | sed 's/\./ \\\\* 1000 + /;s/\./ \\\\* 100 + /'`
+      min=`eval expr "$VEX"`
+      if test $GUILE_VERSION_NUMBER -lt $min; then
+        m4_if($3,,
+	        [AC_MSG_ERROR([Guile version too old; required is at least ]$1)],
+	        [$3])
+      fi])
+
+    save_LIBS=$LIBS
+    save_CFLAGS=$CFLAGS
+    LIBS="$LIBS $GUILE_LIBS"
+    CFLAGS="$CFLAGS $GUILE_INCLUDES"
+    AC_TRY_LINK([#include <libguile.h>],
+                 m4_if([$1], , scm_shell(0, NULL);, [$1]),
+                [AS_VAR_SET([mu_cv_guile], $GUILE_VERSION)])
+    LIBS=$save_LIBS
+    CFLAGS=$save_CFLAGS
+  fi
 
-   if test $GUILE_CONFIG != no; then
-     AC_MSG_CHECKING(for guile version 1.4 or higher)
-     GUILE_VERSION=`($GUILE_CONFIG --version 2>&1; echo '')|sed -n 's/guile-config [[^0-9]]* \([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\).*/\1\2/p'`
-     case "x$GUILE_VERSION" in
-     x[[0-9]]*)
-       if test $GUILE_VERSION -lt 14; then
-         AC_MSG_RESULT([Nope. Version number too low.])
-         mu_cv_lib_guile=no
-       else
-         AC_DEFINE_UNQUOTED(GUILE_VERSION, $GUILE_VERSION,
-                            [Guile version number: MAX*10 + MIN])
-         AC_MSG_RESULT(OK)
-         save_LIBS=$LIBS
-         save_CFLAGS=$CFLAGS
-         LIBS="$LIBS $GUILE_LIBS"
-         CFLAGS="$CFLAGS $GUILE_INCLUDES"
-         AC_TRY_LINK([#include <libguile.h>],
-                     ifelse([$1], , scm_shell(0, NULL);, [$1]),
-                     [mu_cv_lib_guile=yes],
-                     [mu_cv_lib_guile=no])
-         LIBS=$save_LIBS
-         CFLAGS=$save_CFLAGS
-       fi ;;
-     *) AC_MSG_RESULT(Nope. Unknown version number)
-        mu_cv_lib_guile=no;;
-     esac
-   fi
- else
-   cached=" (cached) "
-   GUILE_INCLUDES=`$GUILE_CONFIG compile`
-   GUILE_LIBS=`$GUILE_CONFIG link`
- fi
- AC_MSG_CHECKING(whether to build guile support)
- MU_RESULT_ACTIONS([mu_cv_lib_guile],[LIBGUILE],[$2],[$3])
- AC_MSG_RESULT(${cached}$mu_cv_lib_guile)
- if test $mu_cv_lib_guile = yes; then
-    if test $GUILE_VERSION -gt 14; then
-      LIBS="$LIBS $GUILE_LIBS"
-      CFLAGS="$CFLAGS $GUILE_INCLUDES"
-      AC_CHECK_FUNCS(scm_long2num scm_cell scm_list_1 scm_list_n scm_c_define\
-                     scm_c_lookup)
-      if test $ac_cv_func_scm_cell = no; then
-         AC_MSG_CHECKING(for inline scm_cell)
-         AC_TRY_LINK([#include <libguile.h>],
-                     [scm_cell(SCM_EOL, SCM_EOL)],
-                     [ac_cv_func_scm_cell=yes
-                     AC_DEFINE(HAVE_SCM_CELL,1,
-                               Define if you have scm_cell function)])
-         AC_MSG_RESULT($ac_cv_func_scm_cell)
-      fi
-      CFLAGS=$save_CFLAGS
-      LIBS=$save_LIBS
-    fi
-   AC_ARG_WITH([guiledir],
-               AC_HELP_STRING([--with-guiledir=DIR],
-                              [Specify the directory to install guile modules to]),
-               [case $withval in
-                /*) GUILE_SITE=$withval;;
-                yes) GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site;;
-                *)  AC_MSG_ERROR([Argument to --with-guiledir must be an absolute directory name]);;
-                esac],
-               [GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site
-                pfx=$prefix 
-                test "x$pfx" = xNONE && pfx=$ac_default_prefix
-                case $GUILE_SITE in
-                $pfx/*) ;; # OK
-	        *) AC_MSG_WARN([guile site directory "$GUILE_SITE" lies outside your current prefix ($pfx).])
-                   GUILE_SITE='$(pkgdatadir)/$(VERSION)/guile'
-                   AC_MSG_WARN([Falling back to ${GUILE_SITE} instead. Use --with-guiledir to force using site directory.])
-                   ;;
-                esac])
- fi
- AC_SUBST(GUILE_SITE) 
- AC_SUBST(GUILE_INCLUDES)
- AC_SUBST(GUILE_LIBS)
-])
- 
-	
+  if test $mu_cv_guile = no; then
+    GUILE_INCLUDES=
+    GUILE_LIBS=
+    GUILE_VERSION=
+    GUILE_VERSION_NUMBER=
+    m4_if($3,,[AC_MSG_ERROR(required library libguile not found)], [$3])
+  else    
+    AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION",
+                       [Guile version number])
+    AC_DEFINE_UNQUOTED(GUILE_VERSION_NUMBER, $GUILE_VERSION_NUMBER,
+                       [Guile version number: MAX*10 + MIN])
+    m4_if($2,,,[$2])
+  fi
+])     
 
diff --git a/am/lib.m4 b/am/lib.m4
index 256ae00..c44e13f 100644
--- a/am/lib.m4
+++ b/am/lib.m4
@@ -6,21 +6,30 @@ dnl   $4     --    Action to be taken when test succeeds
 dnl   $5     --    Action to be taken when test fails
 dnl   $6     --    Directories where the library may reside
 AC_DEFUN([MU_CHECK_LIB],
-[
-  save_LIBS=$LIBS
-  AC_CACHE_CHECK([for -l$1], mu_cv_lib_$1,
-  [
-   for path in $6
-   do
-      LIBS="$save_LIBS $3 -L$path -l$1"
-      AC_TRY_LINK_FUNC($2,
-                   [mu_cv_lib_$1="$3 -L$path -l$1"
-                    break],
-                   [mu_cv_lib_$1=no],$3)
-   done
-  ])
-  MU_RESULT_ACTIONS([mu_cv_lib_$1],[LIB$1],[$4],[$5])
-  LIBS=$save_LIBS
-])
+[m4_ifval([$4], , [AH_CHECK_LIB([$1])])dnl
+AS_VAR_PUSHDEF([mu_Lib], [mu_cv_lib_$1])dnl
+AC_CACHE_CHECK([for $2 in -l$1], [mu_Lib],
+[AS_VAR_SET([mu_Lib], [no])
+ mu_check_lib_save_LIBS=$LIBS
+ for path in "" $6
+ do
+   if test -n "$path"; then
+     mu_ldflags="-L$path -l$1 $3"
+   else
+     mu_ldflags="-l$1 $3"
+   fi
+   LIBS="$mu_ldflags $mu_check_lib_save_LIBS"
+   AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
+                  [AS_VAR_SET([mu_Lib], ["$mu_ldflags"])
+		   break])
+ done		  
+ LIBS=$mu_check_lib_save_LIBS])
+AS_IF([test "AS_VAR_GET([mu_Lib])" != no],
+      [m4_default([$4], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
+  LIBS="-l$1 $LIBS"
+])],
+      [$5])dnl
+AS_VAR_POPDEF([mu_Lib])dnl
+])# MU_CHECK_LIB
 
 
diff --git a/bootstrap.conf b/bootstrap.conf
index 3fa07af..42dc0c2 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -18,7 +18,6 @@
 # 02110-1301, USA.
 
 gnulib_name=libmuaux
-build_aux=scripts
 
 # We don't need these modules, even though gnulib-tool mistakenly
 # includes them because of gettext dependencies.
diff --git a/configure.ac b/configure.ac
index 414c33b..98d669e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ dnl Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 AC_INIT([GNU Mailutils], [2.0.90], [bug-mailutils@gnu.org], [mailutils])
 AC_CONFIG_SRCDIR([mailbox/mailbox.c])
-AC_CONFIG_AUX_DIR([scripts])
+AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
@@ -53,7 +53,8 @@ AC_SUBST(MU_LIB_ARGP,'${top_builddir}/libmu_argp/libmu_argp.la')
 AC_SUBST(MU_LIB_PY, '${top_builddir}/python/libmu_py/libmu_py.la')
 
 dnl Other variables
-AC_SUBST(SIEVE_MODDIR,'$(libdir)/$(PACKAGE)')
+AC_SUBST(mu_aux_dir,'$(top_srcdir)/mu-aux')
+AC_SUBST(MU_SIEVE_MODDIR,'$(libdir)/$(PACKAGE)')
 
 AC_SUBST(MU_COMMON_LIBRARIES,'$(LTLIBINTL) $(LTLIBICONV)')
 AC_SUBST(MU_APP_LIBRARIES,'../libmu_argp/libmu_argp.a ../libmu_cfg/libmu_cfg.la ../lib/libmuaux.la')
@@ -722,7 +723,7 @@ if test -n "$SQL_MODULES"; then
                   sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
 
   AC_CONFIG_COMMANDS([sql/modlist.h],
-                     [$srcdir/scripts/sqlmod.sh $SQL_MODULES > sql/modlist.h],
+                     [$srcdir/mu-aux/sqlmod.sh $SQL_MODULES > sql/modlist.h],
                      [if test $USE_LOADABLE_MODULES = yes; then
 			SQL_MODULES=
                       else
@@ -767,23 +768,24 @@ MU_ENABLE_SUPPORT(imap)
 MU_ENABLE_SUPPORT(pop)
 MU_ENABLE_SUPPORT(nntp)
 
-AC_SUBST(BUILD_SMTP_PROGRAMS)
-AC_SUBST(RUN_SMTP_DEJATOOL)
+AC_SUBST(MU_SMTP_PROGRAMS_BUILD)
+AC_SUBST(MU_SMTP_DEJATOOL)
 
-MU_ENABLE_SUPPORT(smtp, [BUILD_SMTP_PROGRAMS='$(PROGRAMS_SMTP)'
-RUN_SMTP_DEJATOOL='$(SMTP_DEJATOOL)'])
+MU_ENABLE_SUPPORT(smtp,
+                  [MU_SMTP_PROGRAMS_BUILD='$(MU_SMTP_PROGRAMS_LIST)'
+                   MU_SMTP_DEJATOOL='$(SMTP_DEJATOOL)'])
 MU_ENABLE_SUPPORT(sendmail)
 
 MU_ENABLE_SUPPORT(prog)
 
-AC_SUBST(BUILD_MH_PROGRAMS)
-AC_SUBST(BUILD_MH_LIBRARIES)
-AC_SUBST(BUILD_MH_EXEC_HOOK)
+AC_SUBST(MU_MH_PROGRAMS_BUILD)
+AC_SUBST(MU_MH_LIBRARIES_BUILD)
+AC_SUBST(MU_MH_EXEC_HOOK)
 
 MU_ENABLE_SUPPORT(mh,
-                  [BUILD_MH_PROGRAMS='$(PROGRAMS_MH)';
-                   BUILD_MH_LIBRARIES='$(LIBRARIES_MH)';
-                   BUILD_MH_EXEC_HOOK=mh_finish_install])
+                  [MU_MH_PROGRAMS_BUILD='$(MU_MH_PROGRAMS_LIST)';
+                   MU_MH_LIBRARIES_BUILD='$(MU_MH_LIBRARIES_LIST)';
+                   MU_MH_EXEC_HOOK=mh_finish_install])
 MU_ENABLE_SUPPORT(maildir)
 
 # FIXME: Should be --with-radius 
@@ -793,18 +795,7 @@ MU_ENABLE_SUPPORT(radius,
 				  mu_cv_enable_radius=yes],
 				 [mu_cv_enable_radius=no])]) 
 
-AC_ARG_ENABLE([mh-utils],
-              AC_HELP_STRING([--enable-mh-utils],
-                             [Build MH utilities]),
-              [MU_BUILD_MH="${enableval}"],
-              [MU_BUILD_MH=no])
-
 AC_SUBST(MH_BIN_DIR)
-if test ".$MU_BUILD_MH" = ".no"; then
-	BUILD_MH_PROGRAMS=
-	BUILD_MH_LIBRARIES=
-	BUILD_MH_EXEC_HOOK=
-fi
 
 AC_ARG_WITH([mh-bindir],
 	    AC_HELP_STRING([--with-mh-bindir],
@@ -818,15 +809,8 @@ AC_ARG_WITH([mh-bindir],
 AC_ARG_ENABLE([experimental],
               AC_HELP_STRING([--enable-experimental],
                              [build experimental and/or unfinished utilities]),
-              [MU_BUILD_EXPERIMENTAL="${enableval}"],
-              [MU_BUILD_EXPERIMENTAL=no])
-
-AC_SUBST(MU_CXX_LIBS)
-AC_SUBST(MU_BUILT_CXX_EXAMPLES)
-if test "$MU_BUILD_EXPERIMENTAL" = yes; then
-	MU_CXX_LIBS='$(MU_CXX_LIBS)'
-	MU_BUILT_CXX_EXAMPLES='$(CXX_EXAMPLES)'
-fi
+              [mu_build_experimental="${enableval}"],
+              [mu_build_experimental=no])
 
 if test x"$testpam" = x"yes"; then
 	AC_CHECK_HEADERS(security/pam_appl.h)
@@ -1047,12 +1031,9 @@ if test "$status_dbm" != no; then
 fi
 
 dnl Check for Guile
-AC_SUBST(GUILE_INCLUDES)
-AC_SUBST(GUILE_LIBS)
 AC_SUBST(GUILE_BINDIR)
-AC_SUBST(GUILE_SNARF_VERSION)
 AC_SUBST(GUIMB)
-AC_SUBST(MU_SCM)
+AC_SUBST(MU_SCM_LTLIBRARIES_BUILD)
 AC_SUBST(LIBMU_SCM)
 AC_SUBST(LIBMU_SCM_DEPS)
 AC_SUBST(GUILE_SITE_DATA)
@@ -1062,30 +1043,47 @@ AC_SUBST(MU_GUILE_SIEVE_MOD_DIR)
 AC_SUBST(MU_GUILE_SIEVE_SCRIPTS)
 AC_SUBST(MU_GUILE_SIEVE_MOD_DATA)
 
-if test x"$useguile" = x"yes"; then
-	MU_CHECK_GUILE(,[
-            AC_DEFINE(WITH_GUILE,1,[Enable Guile support])
-            GUILE_INCLUDES=`guile-config compile`
-  	    GUILE_LIBS=`guile-config link`
-	    GUILE_BINDIR=`guile-config info bindir`
-	    GUIMB='guimb$(EXEEXT)'
-            MU_SCM=libmu_scm.la
-            LIBMU_SCM=../libmu_scm/libmu_scm.la
-	    LIBMU_SCM_DEPS='${MU_LIB_MBOX} ${MU_LIB_IMAP} ${MU_LIB_POP} ${MU_LIB_MH} ${MU_LIB_MAILDIR} ${MU_LIB_MAILER}'
-            GUILE_SITE_DATA='$(GUILE_SITE_DATA_X)'
-	    MU_GUILE_SITE_DIR='$(GUILE_SITE)/$(PACKAGE)'
-	    MU_GUILE_SIEVE_MOD_DIR='$(GUILE_SITE)/sieve-modules'
-	    MU_GUILE_SIEVE_SCRIPTS='$(MU_GUILE_SIEVE_SCRIPTS_X)'
-	    MU_GUILE_SIEVE_MOD_DATA='$(MU_GUILE_SIEVE_MOD_DATA_X)'
-	    GUILE_BUILT_SOURCES='$(GUILE_BUILT_SOURCES_X)'
-            case "$GUILE_VERSION" in
-	      14) GUILE_SNARF_VERSION="1.4";;
-	      16|17) GUILE_SNARF_VERSION="1.6";;
-	      *) GUILE_SNARF_VERSION="1.6";;
-            esac
-         ],[useguile=no])
+if test "$useguile" != "no"; then
+  MU_CHECK_GUILE(1.8,
+         [useguile=yes
+   	  AC_DEFINE(WITH_GUILE,1,[Enable Guile support])
+          GUILE_BINDIR=`guile-config info bindir`
+          GUIMB='guimb$(EXEEXT)'  # FIXME
+          MU_SCM_LTLIBRARIES_BUILD='$(MU_SCM_LTLIBRARIES_LIST)'
+          LIBMU_SCM=../libmu_scm/libmu_scm.la
+          LIBMU_SCM_DEPS='${MU_LIB_MBOX} ${MU_LIB_IMAP} ${MU_LIB_POP} ${MU_LIB_MH} ${MU_LIB_MAILDIR} ${MU_LIB_MAILER}'
+          GUILE_SITE_DATA='$(GUILE_SITE_DATA_X)'
+          MU_GUILE_SITE_DIR='$(GUILE_SITE)/$(PACKAGE)'
+          MU_GUILE_SIEVE_MOD_DIR='$(GUILE_SITE)/sieve-modules'
+          MU_GUILE_SIEVE_SCRIPTS='$(MU_GUILE_SIEVE_SCRIPTS_X)'
+          MU_GUILE_SIEVE_MOD_DATA='$(MU_GUILE_SIEVE_MOD_DATA_X)'
+          GUILE_BUILT_SOURCES='$(GUILE_BUILT_SOURCES_X)'
+  ],[useguile=no])
+
+ if test "$useguile" = "yes"; then
+  AC_ARG_WITH([guiledir],
+           AC_HELP_STRING([--with-guiledir=DIR],
+                          [Specify the directory to install guile modules to]),
+           [case $withval in
+            /*)  GUILE_SITE=$withval;;
+            yes) GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site;;
+            *)   AC_MSG_ERROR([Argument to --with-guiledir must be an absolute directory name]);;
+            esac],
+            [GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site
+             pfx=$prefix
+             test "$pfx" = NONE && pfx=$ac_default_prefix
+             case $GUILE_SITE in
+             $pfx/*) ;; # OK
+             *)  AC_MSG_WARN([guile site directory "$GUILE_SITE" lies outside your current prefix ($pfx).])
+                 GUILE_SITE='$(pkgdatadir)/$(VERSION)/guile'
+                 AC_MSG_WARN([Falling back to ${GUILE_SITE} instead. Use --with-guiledir to force using site directory.])
+                 ;;
+             esac])
+ fi 
 fi
 
+AC_SUBST(GUILE_SITE)
+
 dnl Check for Emacs site-lisp directory
 AM_PATH_LISPDIR
 
@@ -1105,11 +1103,9 @@ case "${withval}" in
   *)   AC_MSG_ERROR(bad value ${withval} for --without-python) ;;
 esac],[status_python=yes])
 
-AC_SUBST(MU_PY)
 if test "$status_python" = yes; then
   AM_PATH_PYTHON(2.5.0,, [status_python=no])
   if test "$status_python" = yes; then
-    MU_PY=libmu_py.la
     AC_ARG_VAR([PYTHON_CONFIG], [The name of python-config binary])
     AC_PATH_PROG([PYTHON_CONFIG], python-config)
     if test -n "$PYTHON_CONFIG"; then
@@ -1121,11 +1117,21 @@ if test "$status_python" = yes; then
 
     if test "$status_python" = yes; then
       AC_DEFINE(WITH_PYTHON,1,[Enable Python support])
-      AC_SUBST(MU_PYTHON_LTLIBS,'$(MU_PYTHON_LTLIBS)')
+      AC_SUBST(MU_PY_LIB_LTLIBRARIES_BUILD, '$(MU_PY_LIB_LTLIBRARIES_LIST)')
+      AC_SUBST(MU_PY_PKGPYEXEC_LTLIBRARIES_BUILD,'$(MU_PY_PKGPYEXEC_LTLIBRARIES_LIST)')
+      AC_SUBST(MU_PY_PKGPYTHON_BUILD,'$(MU_PY_PKGPYTHON_LIST)')
     fi
   fi
 fi
 
+AC_SUBST(MU_CXX_LTLIBRARIES_BUILD)
+AC_SUBST(MU_CXX_EXAMPLES_BUILD)
+MU_ENABLE_SUPPORT(c++,
+  	          [MU_CXX_LTLIBRARIES_BUILD='$(MU_CXX_LTLIBRARIES_LIST)'
+	           MU_CXX_EXAMPLES_BUILD='$(MU_CXX_EXAMPLES_LIST)'],
+		  :,
+		  [mu_cv_enable_cxx=$mu_build_experimental])
+
 # Default mailbox record
 # Note: 1. Support for mbox type is always enabled.
 #       2. Only local mailbox types are allowed for MU_DEFAULT_SCHEME
@@ -1188,35 +1194,39 @@ cat <<EOF
 *******************************************************************
 GNU Mailutils configured with the following settings:
 
-Default mailbox scheme......... $status_scheme
-Use PAM........................ $status_pam
-Use -ltdl...................... $status_ltdl
-Use DBM........................ $status_dbm
-Use GNU TLS.................... $status_gnutls
-Use GSASL...................... $status_gsasl
-Use GSSAPI..................... $status_gssapi
-Use Guile...................... $status_guile
-Use Python..................... $status_python
-Use TCP wrappers............... $status_tcpwrap
-Pthread support................ $status_pthread
-Readline support............... $status_readline
-MySQL support.................. $status_mysql
-PostgreSQL support............. $status_pgsql
-LDAP support................... $status_ldap
-Radius support................. $status_radius
-Support for virtual domains.... $status_virtual_domains
-
-Protocols:
-
-IMAP........................... $status_imap
-POP............................ $status_pop
-MH............................. $status_mh
-maildir........................ $status_maildir
+Default mailbox scheme ........ $status_scheme
+Use PAM ....................... $status_pam
+Use -ltdl ..................... $status_ltdl
+Use DBM ....................... $status_dbm
+Use GNU TLS ................... $status_gnutls
+Use GSASL ..................... $status_gsasl
+Use GSSAPI .................... $status_gssapi
+Use TCP wrappers .............. $status_tcpwrap
+Pthread support ............... $status_pthread
+Readline support .............. $status_readline
+MySQL support ................. $status_mysql
+PostgreSQL suppor ............. $status_pgsql
+LDAP support .................. $status_ldap
+Radius support ................ $status_radius
+Support for virtual domains ... $status_virtual_domains
+
+Interfaces:
+
+Guile ......................... $status_guile
+C++ ........................... $status_cxx
+Python ........................ $status_python
+
+Mailbox formats:
+
+IMAP .......................... $status_imap
+POP ........................... $status_pop
+MH ............................ $status_mh
+maildir ....................... $status_maildir
 
 Mailers:
 
-SMTP........................... $status_smtp
-Sendmail....................... $status_sendmail
+SMTP .......................... $status_smtp
+Sendmail ...................... $status_sendmail
 
 
 *******************************************************************
@@ -1234,6 +1244,7 @@ status_gsasl=$status_gsasl
 status_gssapi=$WITH_GSSAPI
 status_guile=$useguile
 status_python=$status_python
+status_cxx=$mu_cv_enable_cxx
 status_tcpwrap=$status_tcpwrap
 status_pthread=$usepthread
 status_readline=$usereadline
@@ -1313,10 +1324,8 @@ AC_CONFIG_FILES([Makefile
  python/mailutils/Makefile
  readmsg/Makefile
  readmsg/testsuite/Makefile
- scripts/Makefile
- scripts/guile-1.4/Makefile
- scripts/guile-1.6/Makefile
- scripts/mailutils.spec
+ mu-aux/Makefile
+ mu-aux/mailutils.spec
  sieve/Makefile
  sieve/testsuite/Makefile
  testsuite/Makefile
diff --git a/doc/texinfo/Makefile.am b/doc/texinfo/Makefile.am
index 47aa90f..b647205 100644
--- a/doc/texinfo/Makefile.am
+++ b/doc/texinfo/Makefile.am
@@ -83,7 +83,7 @@ VPATH = $(s)
 
 SUFFIXES=.c .inc 
 .c.inc:
-	sed -f $(top_srcdir)/scripts/texify.sed $< > $@
+	sed -f $(mu_aux_dir)/texify.sed $< > $@
 
 DISTCLEANFILES=*.pgs *.kys *.vrs
 MAINTAINERCLEANFILES=$(INCFILES)
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 6643c00..083e088 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,6 +1,7 @@
 ## Process this file with GNU Automake to create Makefile.in
 
-##   Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+##   Copyright (C) 2002, 2003, 2004, 2007, 2008,
+##   2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -48,7 +49,7 @@ noinst_PROGRAMS = \
 ## will not create a shared library and `make check' will fail in
 ## sieve. Pity.
 ## -Sergey
-moddir=@SIEVE_MODDIR@
+moddir=@MU_SIEVE_MODDIR@
 mod_LTLIBRARIES = numaddr.la
 
 INCLUDES = @MU_COMMON_INCLUDES@ 
@@ -60,7 +61,7 @@ LDADD = \
 
 numaddr_la_SOURCES = numaddr.c
 numaddr_la_LIBADD = ${MU_LIB_SIEVE}
-numaddr_la_LDFLAGS = -module -avoid-version -no-undefined
+numaddr_la_LDFLAGS = -module -avoid-version -no-undefined -rpath '$(moddir)'
 
 mimetest_LDADD =\
  ../lib/libmuaux.la\
diff --git a/examples/cpp/Makefile.am b/examples/cpp/Makefile.am
index c7395e1..d1b63fb 100644
--- a/examples/cpp/Makefile.am
+++ b/examples/cpp/Makefile.am
@@ -17,7 +17,7 @@
 ##   Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
 ##   02110-1301 USA
 
-CXX_EXAMPLES = \
+MU_CXX_EXAMPLES_LIST = \
  addr\
  http\
  iconv\
@@ -30,8 +30,8 @@ CXX_EXAMPLES = \
  sfrom\
  url-parse
 
-EXTRA_PROGRAMS=$(CXX_EXAMPLES)
-noinst_PROGRAMS = @MU_BUILT_CXX_EXAMPLES@
+EXTRA_PROGRAMS=$(MU_CXX_EXAMPLES_LIST)
+noinst_PROGRAMS = @MU_CXX_EXAMPLES_BUILD@
 
 INCLUDES = @MU_COMMON_INCLUDES@ 
 
diff --git a/include/mailutils/Makefile.am b/include/mailutils/Makefile.am
index 1096954..f9198c1 100644
--- a/include/mailutils/Makefile.am
+++ b/include/mailutils/Makefile.am
@@ -21,10 +21,10 @@
 BUILT_SOURCES=errno.h debug.h
 EXTRA_DIST=errno.hin debug.hm4 types.hin
 errno.h: $(top_srcdir)/mailbox/errors errno.hin
-	$(AWK) -f $(top_srcdir)/scripts/generr.awk $^ > $@
+	$(AWK) -f $(mu_aux_dir)/generr.awk $^ > $@
 
-debug.h: $(top_srcdir)/scripts/debugdef.m4 debug.hm4
-	m4 $(top_srcdir)/scripts/debugdef.m4 debug.hm4 > debug.h
+debug.h: $(mu_aux_dir)/debugdef.m4 debug.hm4
+	m4 $(mu_aux_dir)/debugdef.m4 debug.hm4 > debug.h
 
 types.h: $(top_srcdir)/include/mailutils/types.hin Makefile
 	sed 's/_MU_OFF_TYPE_/$(MU_OFF_TYPE)/;s/_MU_DEFAULT_RECORD_/$(MU_DEFAULT_RECORD)/' $(top_srcdir)/include/mailutils/types.hin > $@
diff --git a/include/mailutils/guile.h b/include/mailutils/guile.h
index c86db1c..ad03dcf 100644
--- a/include/mailutils/guile.h
+++ b/include/mailutils/guile.h
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006, 2007 
-   Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006, 2007,
+   2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -22,58 +22,7 @@
 
 #include <libguile.h>
 
-#if GUILE_VERSION == 14
-
-# define SCM_STRING_CHARS SCM_CHARS
-# define scm_list_1 SCM_LIST1
-# define scm_list_2 SCM_LIST2
-# define scm_list_3 SCM_LIST3
-# define scm_list_4 SCM_LIST4
-# define scm_list_5 SCM_LIST5
-# define scm_list_n SCM_LISTN
-# define scm_c_define scm_sysintern
-# define scm_primitive_eval_x scm_eval_x
-# define scm_i_big2dbl scm_big2dbl
-# define scm_c_eval_string scm_eval_0str
-# define MU_SCM_SYMBOL_VALUE(p) scm_symbol_value0(p)
-
-extern SCM scm_long2num (long val);
-
-#else
-# define MU_SCM_SYMBOL_VALUE(p) SCM_VARIABLE_REF(scm_c_lookup(p))
-#endif
-
-#if GUILE_VERSION < 18
-
-# define scm_i_string_chars SCM_ROCHARS 
-# define scm_i_string_length SCM_ROLENGTH 
-# define scm_is_string(s) (SCM_NIMP(s) && SCM_STRINGP(s))
-# define scm_from_locale_stringn(s,l) scm_makfromstr(s,l,0) 
-# define scm_from_locale_string(s) scm_makfrom0str(s)
-
-# define scm_from_locale_symbol(s) scm_str2symbol(s)
-
-# define scm_from_int SCM_MAKINUM 
-# define scm_from_size_t mu_scm_makenum
-
-# define scm_gc_malloc scm_must_malloc 
-
-/* FIXME */
-# define scm_is_integer SCM_INUMP 
-# define scm_to_int32 SCM_INUM 
-# define scm_to_int SCM_INUM 
-
-# define DECL_SCM_T_ARRAY_HANDLE(name) 
-# define SCM_T_ARRAY_HANDLE_PTR(name) 0
-# define scm_vector_writable_elements(res,handle,a,b) SCM_VELTS(res)
-# define scm_array_handle_release(h)
-
-#else
-
-# define DECL_SCM_T_ARRAY_HANDLE(name) scm_t_array_handle name
-# define SCM_T_ARRAY_HANDLE_PTR(name) &(name)
-
-#endif
+#define MU_SCM_SYMBOL_VALUE(p) SCM_VARIABLE_REF(scm_c_lookup(p))
 
 typedef struct
 {
diff --git a/libmu_cpp/Makefile.am b/libmu_cpp/Makefile.am
index 947f3db..535ae90 100644
--- a/libmu_cpp/Makefile.am
+++ b/libmu_cpp/Makefile.am
@@ -19,9 +19,9 @@
 
 INCLUDES = @MU_COMMON_INCLUDES@ 
 
-MU_CXX_LIBS = libmu_cpp.la
-lib_LTLIBRARIES = @MU_CXX_LIBS@
-EXTRA_LTLIBRARIES = $(MU_CXX_LIBS)
+MU_CXX_LTLIBRARIES_LIST = libmu_cpp.la
+lib_LTLIBRARIES = @MU_CXX_LTLIBRARIES_BUILD@
+EXTRA_LTLIBRARIES = $(MU_CXX_LTLIBRARIES_LIST)
 
 libmu_cpp_la_SOURCES = \
  address.cc\
diff --git a/libmu_scm/Makefile.am b/libmu_scm/Makefile.am
index d099dfe..4a4ecb2 100644
--- a/libmu_scm/Makefile.am
+++ b/libmu_scm/Makefile.am
@@ -1,6 +1,7 @@
 ## Process this file with GNU Automake to create Makefile.in
 
-##   Copyright (C) 2001, 2002, 2006, 2007 Free Software Foundation, Inc.
+##   Copyright (C) 2001, 2002, 2006, 2007,
+##   2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -19,7 +20,8 @@
 
 INCLUDES = -I. @MU_COMMON_INCLUDES@ @GUILE_INCLUDES@ 
 
-lib_LTLIBRARIES=@MU_SCM@
+MU_SCM_LTLIBRARIES_LIST = libmu_scm.la
+lib_LTLIBRARIES=@MU_SCM_LTLIBRARIES_BUILD@
 EXTRA_LTLIBRARIES=libmu_scm.la
 C_SRCS=\
  mu_address.c\
@@ -90,7 +92,7 @@ AM_CPPFLAGS=-DDATADIR=\"$(pkgdatadir)\"
 ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \
    --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'
 
-GUILE_DOC_SNARF=$(top_srcdir)/scripts/guile-$(GUILE_SNARF_VERSION)/guile-doc-snarf
+GUILE_DOC_SNARF=$(mu_aux_dir)/guile-doc-snarf
 
 SUFFIXES=.x .doc .inc .in
 
diff --git a/libmu_scm/mu_util.c b/libmu_scm/mu_util.c
index 22ef112..b21dc20 100644
--- a/libmu_scm/mu_util.c
+++ b/libmu_scm/mu_util.c
@@ -31,11 +31,11 @@ SCM_DEFINE (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0,
   SCM result;
   struct mu_auth_data *entry;
   SCM *ve;
-  DECL_SCM_T_ARRAY_HANDLE(handle);
+  scm_t_array_handle handle;
   
   result = scm_c_make_vector (8, SCM_UNSPECIFIED);
   ve = scm_vector_writable_elements (result,
-				     SCM_T_ARRAY_HANDLE_PTR(handle),
+				     &handle,
 				     NULL, NULL);
   
   if (scm_is_integer (USER))
@@ -69,7 +69,7 @@ SCM_DEFINE (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0,
     ve[6] = scm_makfrom0str (entry->shell);
   ve[7] = scm_makfrom0str (entry->mailbox);
 
-  scm_array_handle_release (SCM_T_ARRAY_HANDLE_PTR (handle));
+  scm_array_handle_release (&handle);
   
   mu_auth_data_free (entry);
   return result;
diff --git a/libmu_sieve/Makefile.am b/libmu_sieve/Makefile.am
index cc435e7..7f21800 100644
--- a/libmu_sieve/Makefile.am
+++ b/libmu_sieve/Makefile.am
@@ -20,9 +20,9 @@
 
 INCLUDES = @MU_COMMON_INCLUDES@ 
 
-YLWRAP = $(SHELL) $(top_srcdir)/scripts/gylwrap
+YLWRAP = $(SHELL) $(mu_aux_dir)/gylwrap
 AM_YFLAGS = -dtv
-AM_CPPFLAGS = -DSIEVE_MODDIR=\"@SIEVE_MODDIR@\"
+AM_CPPFLAGS = -DMU_SIEVE_MODDIR=\"@MU_SIEVE_MODDIR@\"
 
 SUBDIRS = . extensions
 
diff --git a/libmu_sieve/extensions/Makefile.am b/libmu_sieve/extensions/Makefile.am
index 38d0bee..6813f1e 100644
--- a/libmu_sieve/extensions/Makefile.am
+++ b/libmu_sieve/extensions/Makefile.am
@@ -18,7 +18,7 @@
 ##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
 ##   02110-1301 USA
 
-moddir=@SIEVE_MODDIR@
+moddir=@MU_SIEVE_MODDIR@
 mod_LTLIBRARIES = \
  list.la\
  moderator.la\
@@ -29,28 +29,17 @@ mod_LTLIBRARIES = \
 
 INCLUDES = @MU_COMMON_INCLUDES@ 
 
-AM_LDFLAGS = ../../lib/libmuaux.la ${MU_LIB_MAILUTILS} 
+AM_LDFLAGS = -module -avoid-version -no-undefined -rpath '$(moddir)' 
 
 list_la_SOURCES = list.c
-list_la_LIBADD = ../libmu_sieve.la 
-list_la_LDFLAGS = -module -avoid-version -no-undefined 
+LIBS = ../libmu_sieve.la 
 
 moderator_la_SOURCES = moderator.c
-moderator_la_LIBADD = ../libmu_sieve.la 
-moderator_la_LDFLAGS = -module -avoid-version -no-undefined 
 
 spamd_la_SOURCES = spamd.c
-spamd_la_LIBADD = ../libmu_sieve.la 
-spamd_la_LDFLAGS = -module -avoid-version -no-undefined 
 
 timestamp_la_SOURCES = timestamp.c
-timestamp_la_LIBADD = ../libmu_sieve.la 
-timestamp_la_LDFLAGS = -module -avoid-version -no-undefined 
 
 vacation_la_SOURCES = vacation.c
-vacation_la_LIBADD = ../libmu_sieve.la 
-vacation_la_LDFLAGS = -module -avoid-version -no-undefined 
 
 pipe_la_SOURCES = pipe.c
-pipe_la_LIBADD = ../libmu_sieve.la 
-pipe_la_LDFLAGS = -module -avoid-version -no-undefined 
diff --git a/libmu_sieve/load.c b/libmu_sieve/load.c
index 7eb8f44..d160688 100644
--- a/libmu_sieve/load.c
+++ b/libmu_sieve/load.c
@@ -53,8 +53,8 @@ sieve_init_load_path ()
     {
       if (lt_dlinit ())
 	return 1;
-#ifdef SIEVE_MODDIR
-      _add_load_dir (SIEVE_MODDIR, NULL);
+#ifdef MU_SIEVE_MODDIR
+      _add_load_dir (MU_SIEVE_MODDIR, NULL);
       inited = 1;
 #endif
     }
diff --git a/mail.remote/Makefile.am b/mail.remote/Makefile.am
index d4745b4..70a0c96 100644
--- a/mail.remote/Makefile.am
+++ b/mail.remote/Makefile.am
@@ -20,9 +20,9 @@
 INCLUDES = @MU_COMMON_INCLUDES@ 
 
 SUBDIRS = testsuite
-PROGRAMS_SMTP = mail.remote$(EXEEXT)
+MU_SMTP_PROGRAMS_LIST = mail.remote$(EXEEXT)
 EXTRA_PROGRAMS = mail.remote
-libexec_PROGRAMS = @BUILD_SMTP_PROGRAMS@
+libexec_PROGRAMS = @MU_SMTP_PROGRAMS_BUILD@
 
 mail_remote_SOURCES = mail.remote.c 
 
diff --git a/mail.remote/testsuite/Makefile.am b/mail.remote/testsuite/Makefile.am
index 2f283e5..5444e2d 100644
--- a/mail.remote/testsuite/Makefile.am
+++ b/mail.remote/testsuite/Makefile.am
@@ -19,7 +19,7 @@
 
 AUTOMAKE_OPTIONS = dejagnu
 SMTP_DEJATOOL = mail.remote
-DEJATOOL = @RUN_SMTP_DEJATOOL@
+DEJATOOL = @MU_SMTP_DEJATOOL@
 RUNTESTFLAGS = 
 CLEANFILES = *.log
 test_dirs = lib mail.remote
diff --git a/mailbox/Makefile.am b/mailbox/Makefile.am
index 5d3a8e0..546f853 100644
--- a/mailbox/Makefile.am
+++ b/mailbox/Makefile.am
@@ -20,7 +20,7 @@
 
 INCLUDES = @MU_COMMON_INCLUDES@ -I${top_srcdir}/libproto/include 
 
-YLWRAP = $(SHELL) $(top_srcdir)/scripts/gylwrap
+YLWRAP = $(SHELL) $(mu_aux_dir)/gylwrap
 AM_YFLAGS=-vt
 AM_LFLAGS=-dvp
 
@@ -146,7 +146,7 @@ cfg_lexer.c: $(srcdir)/cfg_lexer.l cfg_parser.h
                   -- -yy mu_cfg_yy
 
 muerrno.c: errors muerrno.cin
-	$(AWK) -f $(top_srcdir)/scripts/generr.awk $^ > $@
+	$(AWK) -f $(mu_aux_dir)/generr.awk $^ > $@
 
 libmailutils_la_LIBADD = @MU_COMMON_LIBRARIES@
 libmailutils_la_LDFLAGS = -version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@
diff --git a/mh/Makefile.am b/mh/Makefile.am
index dcc731b..bd39d18 100644
--- a/mh/Makefile.am
+++ b/mh/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with GNU Automake to create Makefile.in
 
-##   Copyright (C) 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
+##   Copyright (C) 2001, 2002, 2003, 2007, 2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -19,7 +19,7 @@
 
 # All MH programs. Note that we have to explicitely append EXEEXT, Makefile
 # won't do that.
-PROGRAMS_MH = \
+MU_MH_PROGRAMS_LIST = \
  ali$(EXEEXT)\
  anno$(EXEEXT)\
  burst$(EXEEXT)\
@@ -71,13 +71,13 @@ EXTRA_PROGRAMS = \
  whatnow\
  whom
 
-LIBRARIES_MH = libmh.a
+MU_MH_LIBRARIES_LIST = libmh.a
 EXTRA_LIBRARIES = libmh.a
 
 bindir = @MH_BIN_DIR@
 mhlibdir = $(pkgdatadir)/mh
-bin_PROGRAMS = @BUILD_MH_PROGRAMS@
-noinst_LIBRARIES = @BUILD_MH_LIBRARIES@
+bin_PROGRAMS = @MU_MH_PROGRAMS_BUILD@
+noinst_LIBRARIES = @MU_MH_LIBRARIES_BUILD@
 
 libmh_a_SOURCES= \
  compcommon.c\
@@ -143,7 +143,7 @@ LDADD = $(mh_LIBS)
 scan_LDADD = $(mh_LIBS) @CURSES_LIBS@
 pick_SOURCES = pick.c pick.h pick-gram.c pick-gram.h
 
-YLWRAP = $(SHELL) $(top_srcdir)/scripts/gylwrap
+YLWRAP = $(SHELL) $(mu_aux_dir)/gylwrap
 AM_YFLAGS=-vt
 
 pick-gram.c pick-gram.h: $(srcdir)/pick.y
@@ -168,7 +168,7 @@ mh_alias_lex.c: $(srcdir)/mh_alias.l mh_alias.h
                   $(srcdir)/mh_alias.l lex.yy.c mh_alias_lex.c \
                   -- -yy ali_yy
 
-install-exec-hook: @BUILD_MH_EXEC_HOOK@
+install-exec-hook: @MU_MH_EXEC_HOOK@
 
 mh_finish_install:
 	@here=`pwd`; \
diff --git a/mimeview/Makefile.am b/mimeview/Makefile.am
index 92a14c7..21574e3 100644
--- a/mimeview/Makefile.am
+++ b/mimeview/Makefile.am
@@ -29,7 +29,7 @@ mimeview_SOURCES = \
  mimetypes-decl.h \
  mimeview.h 
 
-YLWRAP = $(SHELL) $(top_srcdir)/scripts/gylwrap
+YLWRAP = $(SHELL) $(mu_aux_dir)/gylwrap
 AM_YFLAGS=-vt
 AM_LEXFLAGS=-d
 AM_CPPFLAGS=-D_GNU_SOURCE=1
diff --git a/scripts/Makefile.am b/mu-aux/Makefile.am
similarity index 96%
rename from scripts/Makefile.am
rename to mu-aux/Makefile.am
index f990e94..65f1ac2 100644
--- a/scripts/Makefile.am
+++ b/mu-aux/Makefile.am
@@ -17,9 +17,10 @@
 ##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
 ##   02110-1301 USA
 
-SUBDIRS = guile-1.4 guile-1.6
 EXTRA_DIST = \
  debugdef.m4\
+ guile-doc-snarf\
+ guile-doc-snarf.awk\
  gylwrap\
  mailutils.spec\
  mailutils.spec.in\
diff --git a/scripts/debugdef.m4 b/mu-aux/debugdef.m4
similarity index 100%
rename from scripts/debugdef.m4
rename to mu-aux/debugdef.m4
diff --git a/scripts/generr.awk b/mu-aux/generr.awk
similarity index 100%
rename from scripts/generr.awk
rename to mu-aux/generr.awk
diff --git a/scripts/guile-1.6/guile-doc-snarf b/mu-aux/guile-doc-snarf
similarity index 100%
rename from scripts/guile-1.6/guile-doc-snarf
rename to mu-aux/guile-doc-snarf
diff --git a/scripts/guile-1.6/guile-doc-snarf.awk b/mu-aux/guile-doc-snarf.awk
similarity index 100%
rename from scripts/guile-1.6/guile-doc-snarf.awk
rename to mu-aux/guile-doc-snarf.awk
diff --git a/scripts/gylwrap b/mu-aux/gylwrap
similarity index 100%
rename from scripts/gylwrap
rename to mu-aux/gylwrap
diff --git a/scripts/mailutils.spec.in b/mu-aux/mailutils.spec.in
similarity index 100%
rename from scripts/mailutils.spec.in
rename to mu-aux/mailutils.spec.in
diff --git a/scripts/sqlmod.sh b/mu-aux/sqlmod.sh
similarity index 100%
rename from scripts/sqlmod.sh
rename to mu-aux/sqlmod.sh
diff --git a/scripts/texify.sed b/mu-aux/texify.sed
similarity index 100%
rename from scripts/texify.sed
rename to mu-aux/texify.sed
diff --git a/python/libmu_py/Makefile.am b/python/libmu_py/Makefile.am
index 8aa31fe..c225ed0 100644
--- a/python/libmu_py/Makefile.am
+++ b/python/libmu_py/Makefile.am
@@ -21,7 +21,8 @@ INCLUDES = @MU_COMMON_INCLUDES@ $(PYTHON_INCLUDES)
 
 EXTRA_LTLIBRARIES = libmu_py.la c_api.la
 
-lib_LTLIBRARIES=@MU_PY@
+MU_PY_LIB_LTLIBRARIES_LIST=libmu_py.la
+lib_LTLIBRARIES=@MU_PY_LIB_LTLIBRARIES_BUILD@
 libmu_py_la_SOURCES = \
  error.c \
  address.c \
@@ -61,8 +62,8 @@ libmu_py_la_LIBADD = $(PYTHON_LIBS) @MU_COMMON_LIBRARIES@ \
  @MU_AUTHLIBS@\
  ${MU_LIB_MAILUTILS}
 
-MU_PYTHON_LTLIBS = c_api.la
-pkgpyexec_LTLIBRARIES = @MU_PYTHON_LTLIBS@
+MU_PY_PKGPYEXEC_LTLIBRARIES_LIST = c_api.la
+pkgpyexec_LTLIBRARIES = @MU_PY_PKGPYEXEC_LTLIBRARIES_BUILD@
 c_api_la_LDFLAGS = -avoid-version -module -rpath $(pkgpyexecdir)
 c_api_la_LIBADD = $(PYTHON_LIBS) ${MU_LIB_PY}
 c_api_la_SOURCES = c_api.c
diff --git a/python/mailutils/Makefile.am b/python/mailutils/Makefile.am
index 4dec11e..6b6aed9 100644
--- a/python/mailutils/Makefile.am
+++ b/python/mailutils/Makefile.am
@@ -17,7 +17,7 @@
 ##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
 ##   02110-1301 USA
 
-pkgpython_PYTHON = \
+MU_PY_PKGPYTHON_LIST=\
  __init__.py \
  error.py \
  address.py \
@@ -39,3 +39,5 @@ pkgpython_PYTHON = \
  url.py \
  util.py
 
+pkgpython_PYTHON=@MU_PY_PKGPYTHON_BUILD@
+EXTRA_PYTHON=$(MU_PY_PKGPYTHON_LIST)
diff --git a/scripts/.cvsignore b/scripts/.cvsignore
deleted file mode 100644
index 4f1afb2..0000000
--- a/scripts/.cvsignore
+++ /dev/null
@@ -1,17 +0,0 @@
-.gdbinit
-Makefile
-Makefile.in
-compile
-config.guess
-config.rpath
-config.sub
-depcomp
-elisp-comp
-install-sh
-link-warning.h
-ltmain.sh
-mailutils.spec
-mdate-sh
-missing
-mkinstalldirs
-texinfo.tex
diff --git a/scripts/.gitignore b/scripts/.gitignore
deleted file mode 100644
index 7c0ed05..0000000
--- a/scripts/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-compile
-config.guess
-config.rpath
-config.sub
-depcomp
-elisp-comp
-gitlog-to-changelog
-install-sh
-link-warning.h
-ltmain.sh
-mailutils.spec
-mdate-sh
-missing
-py-compile
-texinfo.tex
-ylwrap
diff --git a/scripts/guile-1.4/.gitignore b/scripts/guile-1.4/.gitignore
deleted file mode 100644
index 282522d..0000000
--- a/scripts/guile-1.4/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/scripts/guile-1.4/Makefile.am b/scripts/guile-1.4/Makefile.am
deleted file mode 100644
index 46d2e46..0000000
--- a/scripts/guile-1.4/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-## Process this file with GNU Automake to create Makefile.in
-
-##   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
-##
-##   GNU Mailutils is free software; you can redistribute it and/or
-##   modify it under the terms of the GNU General Public License as
-##   published by the Free Software Foundation; either version 3, or (at
-##   your option) any later version.
-##
-##   This program is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-##   General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with this program; if not, write to the Free Software
-##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
-##   02110-1301 USA
-
-EXTRA_DIST = \
- guile-doc-snarf\
- guile-func-name-check\
- guile-snarf.awk
diff --git a/scripts/guile-1.4/guile-doc-snarf b/scripts/guile-1.4/guile-doc-snarf
deleted file mode 100755
index fc7f9ff..0000000
--- a/scripts/guile-1.4/guile-doc-snarf
+++ /dev/null
@@ -1,82 +0,0 @@
-#! /bin/sh
-# Extract the initialization actions for builtin things.
-#
-#  Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this software; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-## For some obscure reason, the original guile-doc-snarf distributed
-## with guile up to version 1.4, passes guile-func-name-check
-## to awk without absolute path spec. Consequently the script bails
-## out unless guile-func-name-check is in the current directory.
-## This version assumes that both scripts live in the same directory
-## and deduces the path to guile-func-name-check from the own pathname.
-## --gray
-
-OUTFILE=/dev/tty
-DOCFILE=0
-
-# process aruments
-while [ $# -gt 0 ];
-do
-    case $1 in
-    -o) OUTFILE=$2; shift 2;;
-    -d) DOCFILE=1; shift;;
-    *)  break;;
-    esac
-done    
-
-fullfilename=$1; shift
-
-# strip path to source directory
-filename=`basename $fullfilename`
-
-if [ $DOCFILE -ne 0 ]; then
-    dot_doc=$OUTFILE
-    OUTFILE=/dev/null
-else
-    # we need to be sure that the .x file exists
-    # since the .c/.cc file may include it
-    # (the old guile-snarf did not have this problem
-    #  because the makefile redirects output to the .x file
-    #  which creates the file before the inclusion occurs)
-    # --12/12/99 gjb
-    no_ext=`echo $filename | sed 's/\.[^.]*$//g'`
-    dot_doc=${no_ext}.doc
-fi
-
-temp="/tmp/snarf.$$"
-trap "rm -f $temp" 0 1 2 15
-
-## Let the user override the preprocessor & awk autoconf found.
-test -n "${CPP+set}" || CPP="gcc -E"
-test -n "${AWK+set}" || AWK="gawk"
-
-## Must run guile-func-name-check on the unpreprocessed source
-${AWK} -f `dirname $0`/guile-func-name-check "$fullfilename"
-
-## We must use a temporary file here, instead of a pipe, because we
-## need to know if CPP exits with a non-zero status.
-echo "/* empty */" > $OUTFILE
-${CPP} -DSCM_MAGIC_SNARFER $fullfilename "$@" > ${temp}
-if [ $? -ne 0 ]; then
-    rm -f $OUTFILE
-    exit 1
-fi
-
-cat ${temp} | \
-sed 's/^\(.\{128\}.\{128\}.\{128\}.\{128\}.\{128\}.\{128\}.\{128\}.\{128\}\).*/\1/g' | \
-${AWK} -f `dirname $0`/guile-snarf.awk `basename ${dot_doc}` > $OUTFILE
diff --git a/scripts/guile-1.4/guile-func-name-check b/scripts/guile-1.4/guile-func-name-check
deleted file mode 100755
index 72905ab..0000000
--- a/scripts/guile-1.4/guile-func-name-check
+++ /dev/null
@@ -1,64 +0,0 @@
-#! /usr/bin/awk -f
-#
-#  Copyright (C) 2000, 2007 Free Software Foundation, Inc.
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this software; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-# Written by Greg J. Badros, <gjb@cs.washington.edu>
-# 11-Jan-2000
-
-BEGIN {
-  filename = ARGV[1];
-}
-
-/^SCM_DEFINE/ { 
-  func_name = $0;
-  sub(/^[^\(\n]*\([ \t]*/,"", func_name);
-  sub(/[ \t]*,.*/,"", func_name);
-#  print func_name;  # GJB:FIXME:: flag to do this to list primitives?
-  in_a_func = 1;
-}
-
-in_a_func && /^\{/ {
-  if (!match(last_line,/^#define[ \t]+FUNC_NAME[ \t]+/)) {
-    printf filename ":" NR ":***" > "/dev/stderr";
-    print "Missing or erroneous `#define FUNC_NAME s_" func_name "'" > "/dev/stderr";
-  } else {
-    sub(/^#define[ \t]+FUNC_NAME[ \t]+s_/, "", last_line);
-    sub(/[ \t]*$/,"",last_line);
-    if (last_line != func_name) {
-      printf filename ":" NR ":***" > "/dev/stderr";
-      print "Mismatching FUNC_NAME.  Should be: `#define FUNC_NAME s_" func_name "'" > "/dev/stderr";
-    }
-  }
-}
-
-1 == next_line_better_be_undef {
-  if (!match($0,/^#undef FUNC_NAME[ \t]*$/)) {
-    printf filename ":" NR ":***" > "/dev/stderr";
-    print "Missing or erroneous #undef for " func_name ": "
-          "Got `" $0 "' instead." > "/dev/stderr";
-  }
-  in_a_func = "";
-  func_name = "";
-  next_line_better_be_undef = 0;
-}
-
-in_a_func && /^\}/ {
-  next_line_better_be_undef = 1;
-}
-
-{ last_line = $0; }
diff --git a/scripts/guile-1.4/guile-snarf.awk b/scripts/guile-1.4/guile-snarf.awk
deleted file mode 100755
index 4ff0f67..0000000
--- a/scripts/guile-1.4/guile-snarf.awk
+++ /dev/null
@@ -1,98 +0,0 @@
-#  Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
-# 
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this software; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-#
-# Written by Greg J. Badros, <gjb@cs.washington.edu>
-# 12-Dec-1999
-
-BEGIN { FS="|"; 
-        dot_doc_file = ARGV[1]; ARGV[1] = "-";
-        std_err = "/dev/stderr";
-        # be sure to put something in the files to help make out
-        print "";
-        printf "" > dot_doc_file;
-}
-
-/^[ \t]*SCM__I/ { copy = $0; 
-               gsub(/[ \t]*SCM__I/, "", copy); 
-               gsub(/SCM__D.*$/, "", copy); 
-               print copy; } 
-
-/SCM__D/,/SCM__S/ { copy = $0; 
-                 if (match(copy,/SCM__DR/)) { registering = 1; } 
-                 else {registering = 0; } 
-                 gsub(/.*SCM__D./,"", copy); 
-                 gsub(/SCM__S.*/,"",copy); 
-                 gsub(/[ \t]+/," ", copy); 
-		 sub(/^[ \t]*/,"(", copy);
-                 gsub(/\"/,"",copy); 
-		 sub(/\([ \t]*void[ \t]*\)/,"()", copy);
-		 sub(/ \(/," ",copy);
-		 numargs = gsub(/SCM /,"", copy);
-		 numcommas = gsub(/,/,"", copy);
-		 numactuals = $2 + $3 + $4;
-		 location = $5;
-		 gsub(/\"/,"",location);
-		 sub(/^[ \t]*/,"",location);
-		 sub(/[ \t]*$/,"",location);
-		 sub(/: /,":",location);
-		 # Now whittle copy down to just the $1 field
-		 #   (but do not use $1, since it hasn't been
-                 #    altered by the above regexps)
-		 gsub(/[ \t]*\|.*$/,"",copy);
-		 sub(/ \)/,")",copy);
-		 # Now `copy' contains the nice scheme proc "prototype", e.g.
-		 # (set-car! pair value)
-		 # print copy > "/dev/stderr";  # for debugging
-		 proc_and_args = copy;
-		 curr_function_proto = copy;
-		 sub(/[^ \n]* /,"",proc_and_args);
-		 sub(/\)[ \t]*/,"",proc_and_args);
-		 split(proc_and_args,args," ");
-		 # now args is an array of the arguments
-		 # args[1] is the formal name of the first argument, etc.
-		 if (numargs != numactuals && !registering) 
-		   { print location ":*** `" copy "' is improperly registered as having " numactuals " arguments" > std_err; }
-		 print "\n" copy (registering?")":"") > dot_doc_file ; }
-
-/SCM__S/,/SCM__E.*$/ { copy = $0; 
-                      gsub(/.*SCM__S/,"",copy); 
-		      sub(/^[ \t]*"?/,"", copy);
-		      sub(/\"?[ \t]*SCM__E.*$/,"", copy);
-                      gsub(/\\n\\n"?/,"\n",copy);
-                      gsub(/\\n"?[ \t]*$/,"",copy);
-                      gsub(/\\\"[ \t]*$/,"\"",copy);
-                      gsub(/[ \t]*$/,"", copy);
-                      if (copy != "") { print copy > dot_doc_file }
-                }
-
-/SCM__E[ \t]/ { print "[" location "]" >> dot_doc_file; }
-
-/\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION/ { copy = $0;
-         sub(/.*\*&\*&\*&\*SCM_ARG_BETTER_BE_IN_POSITION\([ \t]*/,"",copy);
-         if (copy ~ /\"/) { next }
-         gsub(/[ \t]*,[ \t]*/,":",copy);
-         sub(/[ \t]*\).*/,"",copy);
-         split(copy,argpos,":");
-         argname = argpos[1];
-         pos = argpos[2];
-         if (pos ~ /[A-Za-z]/) { next }
-         if (pos ~ /^[ \t]*$/) { next }
-         if (argname ~ / /) { next }
-         line = argpos[3];
-#         print pos " " args[pos] " vs. " argname > "/dev/stderr";
-         if (args[pos] != argname) { print filename ":" line ":*** Argument name/number mismatch in `" curr_function_proto "' -- " argname " is not formal #" pos > "/dev/stderr"; }
-      }
diff --git a/scripts/guile-1.6/.gitignore b/scripts/guile-1.6/.gitignore
deleted file mode 100644
index 282522d..0000000
--- a/scripts/guile-1.6/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/scripts/guile-1.6/Makefile.am b/scripts/guile-1.6/Makefile.am
deleted file mode 100644
index d90bfd3..0000000
--- a/scripts/guile-1.6/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-## Process this file with GNU Automake to create Makefile.in
-
-##   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
-##
-##   GNU Mailutils is free software; you can redistribute it and/or
-##   modify it under the terms of the GNU General Public License as
-##   published by the Free Software Foundation; either version 3, or (at
-##   your option) any later version.
-##
-##   This program is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-##   General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with this program; if not, write to the Free Software
-##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
-##   02110-1301 USA
-
-EXTRA_DIST = \
- guile-doc-snarf\
- guile-doc-snarf.awk


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Sun Mar 22 13:21:28 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LlRMW-0005Vd-H0
	for mharc-commit-mailutils@gnu.org; Sun, 22 Mar 2009 13:21:28 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LlRMU-0005Us-2q
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 13:21:26 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LlRMS-0005UL-Ob
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 13:21:25 -0400
Received: from [199.232.76.173] (port=52785 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LlRMS-0005U9-Im
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 13:21:24 -0400
Received: from savannah.gnu.org ([199.232.41.3]:34105 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LlRMS-00025t-CL
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 13:21:24 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LlRMR-0000Ws-5Z
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 17:21:23 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LlRMM-0000WH-8s
	for commit-mailutils@gnu.org; Sun, 22 Mar 2009 17:21:22 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: c37b2f1f3e51dc5489b349cba20771cd762db148
X-Git-Newrev: 37fcd5c14e6e258cda738c99bdf4cad51bc63643
Message-Id: <E1LlRMM-0000WH-8s@cvs.savannah.gnu.org>
Date: Sun, 22 Mar 2009 17:21:19 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-244-g37fcd5c
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Mar 2009 17:21:26 -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=37fcd5c14e6e258cda738c99bdf4cad51bc63643

The branch, master has been updated
       via  37fcd5c14e6e258cda738c99bdf4cad51bc63643 (commit)
      from  c37b2f1f3e51dc5489b349cba20771cd762db148 (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 37fcd5c14e6e258cda738c99bdf4cad51bc63643
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sun Mar 22 19:17:42 2009 +0200

    Bugfix.
    
    * mailbox/stream.c (mu_stream_readline): Fix byte counting.

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

Summary of changes:
 mailbox/stream.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/mailbox/stream.c b/mailbox/stream.c
index edd4076..208ca0b 100644
--- a/mailbox/stream.c
+++ b/mailbox/stream.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2004, 2005,
-   2006, 2007 Free Software Foundation, Inc.
+   2006, 2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -298,7 +298,7 @@ mu_stream_readline (mu_stream_t is, char *buf, size_t count,
       size_t n, nr = 0;
       char c;
       /* Grossly inefficient hopefully they override this */
-      for (n = 1; n < count; n++)
+      for (n = 0; n < count; )
 	{
 	  status = is->_read (is, &c, 1, offset, &nr);
 	  if (status != 0) /* Error.  */
@@ -307,19 +307,16 @@ mu_stream_readline (mu_stream_t is, char *buf, size_t count,
 	    {
 	      *buf++ = c;
 	      offset++;
+	      n++;
 	      if (c == '\n') /* Newline is stored like fgets().  */
 		break;
 	    }
 	  else if (nr == 0)
-	    {
-	      if (n == 1) /* EOF, no data read.  */
-		n = 0;
-	      break; /* EOF, some data was read.  */
-	    }
+	    break; /* EOF */
 	}
       *buf = '\0';
       if (pnread)
-	*pnread = (n == count) ? n - 1: n;
+	*pnread = n;
     }
   else /* Buffered.  */
     {


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Tue Mar 24 14:56:41 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LmBnl-00019V-C7
	for mharc-commit-mailutils@gnu.org; Tue, 24 Mar 2009 14:56:41 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LmBnf-00019A-9d
	for commit-mailutils@gnu.org; Tue, 24 Mar 2009 14:56:35 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LmBna-00018k-1R
	for commit-mailutils@gnu.org; Tue, 24 Mar 2009 14:56:34 -0400
Received: from [199.232.76.173] (port=43868 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LmBnZ-00018Y-7B
	for commit-mailutils@gnu.org; Tue, 24 Mar 2009 14:56:29 -0400
Received: from savannah.gnu.org ([199.232.41.3]:54687 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LmBnX-0007BR-SQ
	for commit-mailutils@gnu.org; Tue, 24 Mar 2009 14:56:28 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LmBnX-00077g-5A
	for commit-mailutils@gnu.org; Tue, 24 Mar 2009 18:56:27 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LmBnS-000771-1c
	for commit-mailutils@gnu.org; Tue, 24 Mar 2009 18:56:26 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 37fcd5c14e6e258cda738c99bdf4cad51bc63643
X-Git-Newrev: 43088a1c350b70b627edeb98d927beca3bcd7708
Message-Id: <E1LmBnS-000771-1c@cvs.savannah.gnu.org>
Date: Tue, 24 Mar 2009 18:56:22 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-247-g43088a1
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Mar 2009 18:56:36 -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=43088a1c350b70b627edeb98d927beca3bcd7708

The branch, master has been updated
       via  43088a1c350b70b627edeb98d927beca3bcd7708 (commit)
       via  303823bda827fcf3a6f570afe4a9ad7b637663b4 (commit)
       via  128efb9c9b268678f477fb39aa427c7c939019a7 (commit)
      from  37fcd5c14e6e258cda738c99bdf4cad51bc63643 (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 43088a1c350b70b627edeb98d927beca3bcd7708
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Mar 24 20:56:07 2009 +0200

    Rewrite scripting support in maidag.
    
    * include/mailutils/guile.h (mu_guile_init, mu_guile_load)
    (mu_guile_eval, mu_guile_mailbox_apply, mu_guile_message_apply)
    (mu_guile_safe_exec, mu_guile_safe_proc_call): New protos.
    
    * libmu_scm/Makefile.am: Add mu_guile.c
    * libmu_scm/mu_guile.c: New file.
    * libmu_scm/mu_mailbox.c (struct mu_mailbox): Kludge: new member noclose.
    (mu_scm_mailbox_free): Do not close/destroy mailbox if it is marked
    noclose.
    (mu_scm_mailbox_create0): Kludge: new function.
    
    * libmu_scm/mu_message.c (mu_scm_message_print): Bugfix.
    
    * maidag/Makefile.am: Add guile.c and sieve.c.
    * maidag/deliver.c (maidag_stdio_delivery) [WITH_GUILE]: Remove block.
    (deliver_url): Call script_apply, instead of sieve_test.
    * maidag/maidag.c: Rewrite scripting support in a modular way.
    Remove options: --sieve, --source (and the corresponding config statements).
    Add options: --language, --script.
    Add configure statement: filter (block).
    * maidag/maidag.h (progfile_pattern, sieve_pattern): Remove.
    (script_list, sieve_debug_flags, message_id_header, sieve_enable_log): New
    prototypes.
    [WITH_GUILE]: Remove.
    (maidag_script_fun, struct maidag_script): New data type.
    (script_handler): New extern.
    (script_lang_handler, script_suffix_handler)
    (script_register, script_apply): New protos.
    (scheme_check_msg, sieve_check_msg): New protos.
    * maidag/script.c: Rewrite. Provide general-purpose serialized script support.
    
    * guimb/guimb.h (struct guimb_data): Remove.
    * guimb/main.c: Rewrite in a cleaner way, using functions from mu_guile.c.
    * guimb/collect.c (guimb_catch_body, guimb_catch_handler)
    (guimb_exit): Remove.
    
    * guimb/scm/sieve-core.scm (sieve-current-message, sieve-mailbox): Public.
    (sieve-run-current-message): New public function.
    (sieve-run): Call sieve-run-current-message for each message.
    * guimb/scm/sieve.scm.in (sieve-save-program): Change code generation to
    suit both per-mailbox and per-message invocation. This kicks mail.local
    out of whack.
    
    * maidag/guile.c: New file.
    * maidag/sieve.c: New file.

commit 303823bda827fcf3a6f570afe4a9ad7b637663b4
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Mar 24 13:27:30 2009 +0200

    Minor fixes
    
    * configure.ac (GUIMB): Rename to MU_SCM_BIN_PROGRAMS_BUILD.
    * guimb/Makefile.am: Likewise.

commit 128efb9c9b268678f477fb39aa427c7c939019a7
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Mar 23 21:26:55 2009 +0200

    Fix imap4d input tokenizer.
    
    The proper delimiters are ( and ), listed in RFC as atom_specials.
    The characters "[]<>." are delimiters for FETCH, and "." is  a
    delimiter for STORE.  Fix tokenizer to recognize these only in the
    corresponding contexts.
    
    In particular, it fixes parsing of input atoms containing dots, as
    foo@bar.baz, which previous versions incorrectly splitted in three.
    
    * imap4d/util.c (ISDELIM): Delimiters are only ( and )
    * imap4d/imap4d.h (struct imap4d_parsebuf): new data type.
    (imap4d_parsebuf_t): New data type.
    (imap4d_parsebuf_exit, imap4d_parsebuf_peek)
    (imap4d_parsebuf_next, imap4d_parsebuf_token)
    (imap4d_parsebuf_data, imap4d_with_parsebuf): New prototypes.
    * imap4d/parsebuf.c: New file.
    * imap4d/Makefile.am: Add parsebuf.c
    * imap4d/fetch.c, imap4d/store.c: Rewrite using parsebuf functions.

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

Summary of changes:
 configure.ac                |    4 +-
 guimb/Makefile.am           |    7 +-
 guimb/collect.c             |   30 +----
 guimb/guimb.h               |   11 +--
 guimb/main.c                |   68 ++++++----
 guimb/scm/sieve-core.scm    |   17 ++-
 guimb/scm/sieve.scm.in      |   83 +++++++-----
 imap4d/Makefile.am          |    3 +-
 imap4d/fetch.c              |  321 +++++++++++++++++++++----------------------
 imap4d/imap4d.h             |   30 ++++-
 imap4d/parsebuf.c           |  175 +++++++++++++++++++++++
 imap4d/store.c              |  223 +++++++++++++++---------------
 imap4d/util.c               |   13 ++-
 include/mailutils/guile.h   |   12 ++-
 libmu_scm/Makefile.am       |    1 +
 libmu_scm/mu_guile.c        |  199 ++++++++++++++++++++++++++
 libmu_scm/mu_mailbox.c      |   32 ++++-
 libmu_scm/mu_message.c      |    2 +-
 libmu_scm/mu_scm.h          |    1 -
 maidag/Makefile.am          |    2 +
 maidag/deliver.c            |   17 +--
 mail/cd.c => maidag/guile.c |   37 +++---
 maidag/maidag.c             |  265 ++++++++++++++---------------------
 maidag/maidag.h             |   48 +++++--
 maidag/script.c             |  212 ++++++++++++++++-------------
 maidag/sieve.c              |  115 +++++++++++++++
 26 files changed, 1227 insertions(+), 701 deletions(-)
 create mode 100644 imap4d/parsebuf.c
 create mode 100644 libmu_scm/mu_guile.c
 copy mail/cd.c => maidag/guile.c (63%)
 create mode 100644 maidag/sieve.c

diff --git a/configure.ac b/configure.ac
index 98d669e..bdcb49b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1032,7 +1032,7 @@ fi
 
 dnl Check for Guile
 AC_SUBST(GUILE_BINDIR)
-AC_SUBST(GUIMB)
+AC_SUBST(MU_SCM_BIN_PROGRAMS_BUILD)
 AC_SUBST(MU_SCM_LTLIBRARIES_BUILD)
 AC_SUBST(LIBMU_SCM)
 AC_SUBST(LIBMU_SCM_DEPS)
@@ -1048,7 +1048,7 @@ if test "$useguile" != "no"; then
          [useguile=yes
    	  AC_DEFINE(WITH_GUILE,1,[Enable Guile support])
           GUILE_BINDIR=`guile-config info bindir`
-          GUIMB='guimb$(EXEEXT)'  # FIXME
+	  MU_SCM_BIN_PROGRAMS_BUILD='$(MU_SCM_BIN_PROGRAMS_LIST)'
           MU_SCM_LTLIBRARIES_BUILD='$(MU_SCM_LTLIBRARIES_LIST)'
           LIBMU_SCM=../libmu_scm/libmu_scm.la
           LIBMU_SCM_DEPS='${MU_LIB_MBOX} ${MU_LIB_IMAP} ${MU_LIB_POP} ${MU_LIB_MH} ${MU_LIB_MAILDIR} ${MU_LIB_MAILER}'
diff --git a/guimb/Makefile.am b/guimb/Makefile.am
index 2c452e2..ebfd475 100644
--- a/guimb/Makefile.am
+++ b/guimb/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with GNU Automake to create Makefile.in
 
-##   Copyright (C) 2001, 2002, 2007 Free Software Foundation, Inc.
+##   Copyright (C) 2001, 2002, 2007, 2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -21,8 +21,9 @@ INCLUDES = @MU_COMMON_INCLUDES@ @GUILE_INCLUDES@
 
 SUBDIRS=scm
 
-bin_PROGRAMS=@GUIMB@
-EXTRA_PROGRAMS=guimb
+MU_SCM_BIN_PROGRAMS_LIST=guimb # FIXME: does it need $(EXEEXT)?
+bin_PROGRAMS=@MU_SCM_BIN_PROGRAMS_BUILD@
+EXTRA_PROGRAMS=$(MU_SCM_BIN_PROGRAMS_LIST)
 guimb_SOURCES=main.c collect.c util.c guimb.h 
 guimb_LDADD = \
  ${MU_APP_LIBRARIES}\
diff --git a/guimb/collect.c b/guimb/collect.c
index d4f78f9..8839d98 100644
--- a/guimb/collect.c
+++ b/guimb/collect.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2005, 
-   2007 Free Software Foundation, Inc.
+   2007, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -191,31 +191,3 @@ collect_drop_mailbox ()
     }
 }
 
-SCM
-guimb_catch_body (void *data, mu_mailbox_t unused)
-{
-  struct guimb_data *gd = data;
-  if (gd->program_file)
-    scm_primitive_load (scm_makfrom0str (gd->program_file));
-
-  if (gd->program_expr)
-    scm_c_eval_string (gd->program_expr);
-
-  return SCM_BOOL_F;
-}
-
-SCM
-guimb_catch_handler (void *unused, SCM tag, SCM throw_args)
-{
-  collect_drop_mailbox ();
-  return scm_handle_by_message ("guimb", tag, throw_args);
-}
-
-int
-guimb_exit (void *unused1, mu_mailbox_t unused2)
-{
-  int rc = collect_output ();
-  collect_drop_mailbox ();
-  return rc;
-}
-
diff --git a/guimb/guimb.h b/guimb/guimb.h
index 95df141..166f86c 100644
--- a/guimb/guimb.h
+++ b/guimb/guimb.h
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2005,
-   2007 Free Software Foundation, Inc.
+   2007, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -67,12 +67,3 @@ int collect_output (void);
 void util_error (const char *fmt, ...) MU_PRINTFLIKE(1, 2);
 int util_tempfile (char **namep);
 
-struct guimb_data
-{
-  char *program_file;
-  char *program_expr;
-};
-
-SCM guimb_catch_body (void *data, mu_mailbox_t unused);
-SCM guimb_catch_handler (void *unused, SCM tag, SCM throw_args);
-int guimb_exit (void *unused1, mu_mailbox_t unused2);
diff --git a/guimb/main.c b/guimb/main.c
index 64c548b..6a29472 100644
--- a/guimb/main.c
+++ b/guimb/main.c
@@ -145,19 +145,21 @@ static const char *guimb_argp_capa[] = {
   "license",
   NULL
 };
-    
+
+const char *main_sym = "mailutils-main";
+
 int
 main (int argc, char *argv[])
 {
+  int rc;
   int c = argc;
   int index;
-  mu_guimb_param_t param;
-  struct guimb_data gd;
 
   /* Native Language Support */
   MU_APP_INIT_NLS ();
 
-  append_arg ("");
+  /* Register the desired formats. */
+  mu_register_all_formats ();
 
   mu_argp_init (program_version, NULL);
   if (mu_app_init (&argp, guimb_argp_capa, NULL, argc, argv, 0, &index, &c))
@@ -169,17 +171,12 @@ main (int argc, char *argv[])
   if (!user_name)
     user_name = who_am_i ();
   
-  if (program_file)
-    g_argv[0] = program_file;
-  else if (!program_expr)
+  if (!program_file && !program_expr)
     {
       mu_error (_("At least one of -fecs must be used. Try guimb --help for more info."));
-      exit (0);
+      exit (1);
     }
     
-  /* Register the desired formats. */
-  mu_register_all_formats ();
-
   if (!argv[index])
     {
       if (default_mailbox)
@@ -202,27 +199,42 @@ main (int argc, char *argv[])
 	collect_append_file ("-");
     }
 
-  append_arg (NULL);
-  g_argc--;
-
   /* Finish creating input mailbox */
   collect_create_mailbox ();
 
-  gd.program_file = program_file;
-  gd.program_expr = program_expr;
+  mu_guile_init (debug_guile);
+  if (program_file)
+    mu_guile_load (program_file, g_argc, g_argv);
+  if (program_expr)
+    mu_guile_eval (program_expr);
+
+  rc = mu_guile_mailbox_apply (mbox, main_sym);
+  switch (rc)
+    {
+    case 0:
+      collect_output ();
+      break;
+
+    case MU_ERR_NOENT:
+      mu_error (_("%s not defined"), main_sym);
+      break;
+      
+    case EINVAL:
+      mu_error (_("%s is not a procedure object"), main_sym);
+      break;
+
+    case MU_ERR_FAILURE:
+      mu_error (_("execution of %s failed"), main_sym);
+      break;
+      
+    default:
+      mu_error (_("unrecognized error"));
+      break;
+    }
+
+  collect_drop_mailbox ();
   
-  param.debug_guile = debug_guile;
-  param.mbox = mbox;
-  param.user_name = user_name;
-  param.init = NULL;
-  param.catch_body = guimb_catch_body;
-  param.catch_handler = guimb_catch_handler;
-  param.next = NULL;
-  param.exit = guimb_exit;
-  param.data = &gd;
-  mu_process_mailbox (g_argc, g_argv, &param);
-  /*NOTREACHED*/
-  return 0;
+  return !!rc;
 }
 
 char *
diff --git a/guimb/scm/sieve-core.scm b/guimb/scm/sieve-core.scm
index 89a0872..c75cf34 100644
--- a/guimb/scm/sieve-core.scm
+++ b/guimb/scm/sieve-core.scm
@@ -457,8 +457,15 @@
 	 (lambda args #f)))
 
 ;;; Sieve-main
-(define sieve-mailbox #f)
-(define sieve-current-message #f)
+(define-public sieve-mailbox #f)
+(define-public sieve-current-message #f)
+
+(define-public (sieve-run-current-message thunk)
+  (and (catch 'sieve-stop
+	      thunk
+	      (lambda args
+		#f))
+       (sieve-verbose-print "IMPLICIT KEEP")))
 
 (define (sieve-run thunk)
   (if (not sieve-my-email)
@@ -470,11 +477,7 @@
 	((> n count) #f)
 	(set! sieve-current-message
 	      (mu-mailbox-get-message sieve-mailbox n))
-	(and (catch 'sieve-stop
-		    thunk
-		    (lambda args
-		      #f))
-	     (sieve-verbose-print "IMPLICIT KEEP")))
+	(sieve-run-current-message thunk))
     (sieve-close-mailboxes)))
 
 (define (sieve-command-line)
diff --git a/guimb/scm/sieve.scm.in b/guimb/scm/sieve.scm.in
index 4a8672f..293dcf7 100644
--- a/guimb/scm/sieve.scm.in
+++ b/guimb/scm/sieve.scm.in
@@ -1,8 +1,9 @@
 #! %GUILE_BINDIR%/guile -s
-# Emacs, its -*- scheme -*-
+# Emacs, it's -*- scheme -*-
 !#
 ;;;; GNU Mailutils -- a suite of utilities for electronic mail
-;;;; Copyright (C) 1999, 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
+;;;; Copyright (C) 1999, 2000, 2001, 2006, 2007,
+;;;; 2009 Free Software Foundation, Inc.
 ;;;;
 ;;;; GNU Mailutils is free software; you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
@@ -931,39 +932,53 @@
       outfile
     (lambda ()
       (display "#! ")
-      (if guimb-header
-	 (display "/home/gray/alpha/bin/guimb -s\n")
-	 (display "/usr/bin/guile -s\n"))
-     (display (string-append
-	       "# Guile mailbox parser made from " filename))
-     (newline) 
-     (display "# by sieve.scm, GNU %PACKAGE% %VERSION%\n!#")
-     (newline)
-
-     (display 
-      "(if (not (member \"%GUILE_SITE%\" %load-path))\n
+      (cond
+       (guimb-header
+	(display "/home/gray/alpha/bin/guimb -s\n"))
+       (else
+	(display "/bin/sh\n\
+# aside from this initial boilerplate, this is actually -*- scheme -*- code\n\
+exec ${GUILE-guile} -l $0 -c '(mailutils-main)'\n")))
+      (display (string-append
+		"# This Guile mailbox parser was made from " filename))
+      (newline) 
+      (display "# by sieve.scm, GNU %PACKAGE% %VERSION%\n!#")
+      (newline)
+      
+      (display 
+       "(if (not (member \"%GUILE_SITE%\" %load-path))\n
            (set! %load-path (cons \"%GUILE_SITE%\" %load-path)))\n")
-     
-     (display "(use-modules (mailutils sieve-core))\n")
-     (display (string-append
-	       "(set! sieve-source \"" filename "\")"))
-     (newline)
-
-     (for-each
-      (lambda (file)
-	(display (string-append
-		  "(load \"" file "\")"))
-	(newline))
-      sieve-load-files)
-     (newline)
-     (if request-verbose
-	 (display "(set! sieve-verbose #t)\n"))
-     (display "(sieve-main ")
-
-     (sieve-code-print-list
-      (append '(lambda ())
-	      sieve-code-list))
-     (display ")"))))
+      
+      (display "(use-modules (mailutils sieve-core))\n")
+      (display (string-append
+		"(set! sieve-source \"" filename "\")"))
+      (newline)
+      
+      (for-each
+       (lambda (file)
+	 (display (string-append
+		   "(load \"" file "\")"))
+	 (newline))
+       sieve-load-files)
+      (newline)
+      (if request-verbose
+	  (display "(set! sieve-verbose #t)\n"))
+      (display "(define (sieve-filter-thunk) ")
+      
+      (sieve-code-print-list (car sieve-code-list))
+      (display ")\n\n")
+
+      (display "(define (mailutils-main . rest)\n")
+      (display "  (sieve-main sieve-filter-thunk))\n\n")
+
+      (display "(define (mailutils-check-message msg)\n\
+  (set! sieve-current-message msg)\n\
+  (sieve-run-current-message sieve-filter-thunk))\n")
+      
+      (display "\n\
+;;;; Local Variables:\n\
+;;;; buffer-read-only: t\n\
+;;;; End:\n"))))
 
 ;;;;
 
diff --git a/imap4d/Makefile.am b/imap4d/Makefile.am
index 5c0a720..751daf3 100644
--- a/imap4d/Makefile.am
+++ b/imap4d/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with GNU Automake to create Makefile.in
 
 ##   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005,
-##   2007, 2008 Free Software Foundation, Inc.
+##   2007, 2008, 2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -47,6 +47,7 @@ imap4d_SOURCES = \
  lsub.c\
  namespace.c\
  noop.c\
+ parsebuf.c\
  preauth.c\
  rename.c\
  search.c\
diff --git a/imap4d/fetch.c b/imap4d/fetch.c
index c90337e..141acc9 100644
--- a/imap4d/fetch.c
+++ b/imap4d/fetch.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2001, 2005, 2006, 2007,
-   2008 Free Software Foundation, Inc.
+   2008, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -58,6 +58,14 @@ struct fetch_function_closure
   size_t size;                     /* Substring length */
 };
 
+struct fetch_parse_closure
+{
+  int isuid;
+  mu_list_t fnlist;
+  size_t *set;
+  size_t count;
+};
+
 
 static int
 fetch_send_address (const char *addr)
@@ -1086,42 +1094,9 @@ _do_fetch (void *item, void *data)
     util_send (" ");
   return ffc->fun (ffc, frt);
 }
-    
-struct parsebuf
-{
-  imap4d_tokbuf_t tok;
-  int arg;
-  char *token;
-  int isuid;
-  mu_list_t fnlist;
-  jmp_buf errjmp;
-  char *err_text;
-};
 
 static void
-parsebuf_exit (struct parsebuf *p, char *text)
-{
-  p->err_text = text;
-  longjmp (p->errjmp, 1);
-}
-
-static char *
-parsebuf_peek (struct parsebuf *p)
-{
-  return imap4d_tokbuf_getarg (p->tok, p->arg);
-}
-
-static char *
-parsebuf_next (struct parsebuf *p, int req)
-{
-  p->token = imap4d_tokbuf_getarg (p->tok, p->arg++);
-  if (!p->token && req)
-    parsebuf_exit (p, "Too few arguments");
-  return p->token;
-}
-
-static void
-append_ffc (struct parsebuf *p, struct fetch_function_closure *ffc)
+append_ffc (struct fetch_parse_closure *p, struct fetch_function_closure *ffc)
 {
   struct fetch_function_closure *new_ffc = malloc (sizeof (*new_ffc));
   if (!new_ffc)
@@ -1131,7 +1106,7 @@ append_ffc (struct parsebuf *p, struct fetch_function_closure *ffc)
 }
 
 static void
-append_simple_function (struct parsebuf *p, const char *name,
+append_simple_function (struct fetch_parse_closure *p, const char *name,
 			fetch_function_t fun)
 {
   struct fetch_function_closure ffc;
@@ -1199,12 +1174,12 @@ fetch-att       = "ENVELOPE" / "FLAGS" / "INTERNALDATE" /
 
 /*  "RFC822" [".HEADER" / ".SIZE" / ".TEXT"]  */
 static void
-parse_fetch_rfc822 (struct parsebuf *p)
+parse_fetch_rfc822 (imap4d_parsebuf_t p)
 {
   struct fetch_function_closure ffc;
   ffc_init (&ffc);
   ffc.name = "RFC822";
-  parsebuf_next (p, 0);
+  imap4d_parsebuf_next (p, 0);
   if (p->token == NULL || p->token[0] == ')') 
     {
       /* Equivalent to BODY[]. */
@@ -1212,7 +1187,7 @@ parse_fetch_rfc822 (struct parsebuf *p)
     }
   else if (p->token[0] == '.')
     {
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       if (strcasecmp (p->token, "HEADER") == 0)
 	{
 	  /* RFC822.HEADER
@@ -1225,14 +1200,14 @@ parse_fetch_rfc822 (struct parsebuf *p)
 	  ffc.name = "RFC822.HEADER";
 	  ffc.fun = _frt_header;
 	  ffc.peek = 1;
-	  parsebuf_next (p, 0);
+	  imap4d_parsebuf_next (p, 0);
 	}
       else if (strcasecmp (p->token, "SIZE") == 0)
 	{
 	  /* A number expressing the [RFC-2822] size of the message. */
 	  ffc.name = "RFC822.SIZE";
 	  ffc.fun = _frt_size;
-	  parsebuf_next (p, 0);
+	  imap4d_parsebuf_next (p, 0);
 	}
       else if (strcasecmp (p->token, "TEXT") == 0)
 	{
@@ -1240,14 +1215,14 @@ parse_fetch_rfc822 (struct parsebuf *p)
 	     Equivalent to BODY[TEXT]. */
 	  ffc.name = "RFC822.TEXT";
 	  ffc.fun = _frt_body_text;
-	  parsebuf_next (p, 0);
+	  imap4d_parsebuf_next (p, 0);
 	}
       else
-	parsebuf_exit (p, "Syntax error after RFC822.");
+	imap4d_parsebuf_exit (p, "Syntax error after RFC822.");
     }
   else
-    parsebuf_exit (p, "Syntax error after RFC822");
-  append_ffc (p, &ffc);
+    imap4d_parsebuf_exit (p, "Syntax error after RFC822");
+  append_ffc (imap4d_parsebuf_data (p), &ffc);
 }
 
 static int
@@ -1262,19 +1237,19 @@ header-fld-name = astring
 header-list     = "(" header-fld-name *(SP header-fld-name) ")"
 */
 static void
-parse_header_list (struct parsebuf *p, struct fetch_function_closure *ffc)
+parse_header_list (imap4d_parsebuf_t p, struct fetch_function_closure *ffc)
 {
   if (!(p->token && p->token[0] == '('))
-    parsebuf_exit (p, "Syntax error: expected (");
+    imap4d_parsebuf_exit (p, "Syntax error: expected (");
   mu_list_create (&ffc->headers);
   mu_list_set_comparator (ffc->headers, _header_cmp);
-  for (parsebuf_next (p, 1); p->token[0] != ')'; parsebuf_next (p, 1))
+  for (imap4d_parsebuf_next (p, 1); p->token[0] != ')'; imap4d_parsebuf_next (p, 1))
     {
-      if (util_isdelim (p->token))
-	parsebuf_exit (p, "Syntax error: unexpected delimiter");
+      if (p->token[1] == 0 && strchr ("()[]<>.", p->token[0]))
+	imap4d_parsebuf_exit (p, "Syntax error: unexpected delimiter");
       mu_list_append (ffc->headers, p->token);
     }
-  parsebuf_next (p, 1);
+  imap4d_parsebuf_next (p, 1);
 }
 
 /*
@@ -1285,30 +1260,30 @@ section-text    = section-msgtext / "MIME"
                     ; text other than actual body part (headers, etc.)
 */  
 static int
-parse_section_text (struct parsebuf *p, struct fetch_function_closure *ffc,
+parse_section_text (imap4d_parsebuf_t p, struct fetch_function_closure *ffc,
 		    int allow_mime)
 {
   if (strcasecmp (p->token, "HEADER") == 0)
     {
       /* "HEADER" / "HEADER.FIELDS" [".NOT"] SP header-list  */
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       if (p->token[0] == '.')
 	{
-	  parsebuf_next (p, 1);
+	  imap4d_parsebuf_next (p, 1);
 	  if (strcasecmp (p->token, "FIELDS"))
-	    parsebuf_exit (p, "Expected FIELDS");
+	    imap4d_parsebuf_exit (p, "Expected FIELDS");
 	  ffc->fun = _frt_header_fields;
-	  parsebuf_next (p, 1);
+	  imap4d_parsebuf_next (p, 1);
 	  if (p->token[0] == '.')
 	    {
-	      parsebuf_next (p, 1);
+	      imap4d_parsebuf_next (p, 1);
 	      if (strcasecmp (p->token, "NOT") == 0)
 		{
 		  ffc->not = 1;
-		  parsebuf_next (p, 1);
+		  imap4d_parsebuf_next (p, 1);
 		}
 	      else
-		parsebuf_exit (p, "Expected NOT");
+		imap4d_parsebuf_exit (p, "Expected NOT");
 	    }
 	  parse_header_list (p, ffc);
 	}
@@ -1317,12 +1292,12 @@ parse_section_text (struct parsebuf *p, struct fetch_function_closure *ffc,
     }
   else if (strcasecmp (p->token, "TEXT") == 0)
     {
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       ffc->fun = _frt_body_text;
     }
   else if (allow_mime && strcasecmp (p->token, "MIME") == 0)
     {
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       ffc->fun = _frt_mime;
     }
   else
@@ -1331,13 +1306,13 @@ parse_section_text (struct parsebuf *p, struct fetch_function_closure *ffc,
 }
 
 static size_t
-parsebuf_get_number (struct parsebuf *p)
+parsebuf_get_number (imap4d_parsebuf_t p)
 {
   char *cp;
   unsigned n = strtoul (p->token, &cp, 10);
 
   if (*cp)
-    parsebuf_exit (p, "Syntax error: expected number");
+    imap4d_parsebuf_exit (p, "Syntax error: expected number");
   return n;
 }
     
@@ -1346,7 +1321,7 @@ section-part    = nz-number *("." nz-number)
                     ; body part nesting
 */  
 static void
-parse_section_part (struct parsebuf *p, struct fetch_function_closure *ffc)
+parse_section_part (imap4d_parsebuf_t p, struct fetch_function_closure *ffc)
 {
   size_t *parts;
   size_t nmax = 0;
@@ -1373,10 +1348,12 @@ parse_section_part (struct parsebuf *p, struct fetch_function_closure *ffc)
 	}
       parts[ncur++] = n;
 
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
+      
       if (p->token[0] == '.'
-	  && (cp = parsebuf_peek (p)) && isascii (*cp) && isdigit (cp[0]))
-	parsebuf_next (p, 1);
+	  && (cp = imap4d_parsebuf_peek (p))
+	  && isascii (*cp) && isdigit (*cp))
+	imap4d_parsebuf_next (p, 1);
       else
 	break;
     }
@@ -1389,14 +1366,14 @@ section         = "[" [section-spec] "]"
 section-spec    = section-msgtext / (section-part ["." section-text])
 */  
 static int
-parse_section (struct parsebuf *p, struct fetch_function_closure *ffc)
+parse_section (imap4d_parsebuf_t p, struct fetch_function_closure *ffc)
 {
   if (p->token[0] != '[')
     return 1;
   ffc_init (ffc);
   ffc->name = NULL;
   ffc->fun = _frt_body;
-  parsebuf_next (p, 1);
+  imap4d_parsebuf_next (p, 1);
   if (parse_section_text (p, ffc, 0))
     {
       if (p->token[0] == ']')
@@ -1406,98 +1383,102 @@ parse_section (struct parsebuf *p, struct fetch_function_closure *ffc)
 	  parse_section_part (p, ffc);
 	  if (p->token[0] == '.')
 	    {
-	      parsebuf_next (p, 1);
+	      imap4d_parsebuf_next (p, 1);
 	      parse_section_text (p, ffc, 1);
 	    }
 	}
       else
-	parsebuf_exit (p, "Syntax error");
+	imap4d_parsebuf_exit (p, "Syntax error");
     }
   if (p->token[0] != ']')
-    parsebuf_exit (p, "Syntax error: missing ]");
-  parsebuf_next (p, 0);
+    imap4d_parsebuf_exit (p, "Syntax error: missing ]");
+  imap4d_parsebuf_next (p, 0);
   return 0;
 }
 
 static void
-parse_substring (struct parsebuf *p, struct fetch_function_closure *ffc)
+parse_substring (imap4d_parsebuf_t p, struct fetch_function_closure *ffc)
 {
   if (p->token && p->token[0] == '<')
     {
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       ffc->start = parsebuf_get_number (p);
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       if (p->token[0] != '.')
-	parsebuf_exit (p, "Syntax error: expected .");
-      parsebuf_next (p, 1);
+	imap4d_parsebuf_exit (p, "Syntax error: expected .");
+      imap4d_parsebuf_next (p, 1);
       ffc->size = parsebuf_get_number (p);
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       if (p->token[0] != '>')
-	parsebuf_exit (p, "Syntax error: expected >");
-      parsebuf_next (p, 0);
+	imap4d_parsebuf_exit (p, "Syntax error: expected >");
+      imap4d_parsebuf_next (p, 0);
     }
 }
 	
 /* section ["<" number "." nz-number ">"]  */
 static int
-parse_body_args (struct parsebuf *p, int peek)
+parse_body_args (imap4d_parsebuf_t p, int peek)
 {
   struct fetch_function_closure ffc;
   if (parse_section (p, &ffc) == 0)
     {
       parse_substring (p, &ffc);
       ffc.peek = peek;
-      append_ffc (p, &ffc);
+      append_ffc (imap4d_parsebuf_data (p), &ffc);
       return 0;
     }
   return 1;
 }
 
 static void
-parse_body_peek (struct parsebuf *p)
+parse_body_peek (imap4d_parsebuf_t p)
 {
-  parsebuf_next (p, 1);
+  imap4d_parsebuf_next (p, 1);
   if (strcasecmp (p->token, "PEEK") == 0)
     {
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       if (parse_body_args (p, 1))
-	parsebuf_exit (p, "Syntax error");
+	imap4d_parsebuf_exit (p, "Syntax error");
     }
   else
-    parsebuf_exit (p, "Syntax error: expected PEEK");
+    imap4d_parsebuf_exit (p, "Syntax error: expected PEEK");
 }
 
 /*  "BODY" ["STRUCTURE"] / 
     "BODY" section ["<" number "." nz-number ">"] /
     "BODY.PEEK" section ["<" number "." nz-number ">"] */
 static void
-parse_fetch_body (struct parsebuf *p)
+parse_fetch_body (imap4d_parsebuf_t p)
 {
-  if (parsebuf_next (p, 0) == NULL || p->token[0] == ')')
-    append_simple_function (p, "BODY", _frt_bodystructure0);
+  if (imap4d_parsebuf_next (p, 0) == NULL || p->token[0] == ')')
+    append_simple_function (imap4d_parsebuf_data (p),
+			    "BODY", _frt_bodystructure0);
   else if (p->token[0] == '.')
     parse_body_peek (p);
   else if (strcasecmp (p->token, "STRUCTURE") == 0)
     {
       /* For compatibility with previous versions */
-      append_simple_function (p, "BODYSTRUCTURE", _frt_bodystructure);
-      parsebuf_next (p, 0);
+      append_simple_function (imap4d_parsebuf_data (p),
+			      "BODYSTRUCTURE", _frt_bodystructure);
+      imap4d_parsebuf_next (p, 0);
     }
   else if (parse_body_args (p, 0))
-    append_simple_function (p, "BODY", _frt_bodystructure0);
+    append_simple_function (imap4d_parsebuf_data (p),
+			    "BODY", _frt_bodystructure0);
 }
 
 static int
-parse_fetch_att (struct parsebuf *p)
+parse_fetch_att (imap4d_parsebuf_t p)
 {
   struct fetch_att_tab *ent;
-
+  struct fetch_parse_closure *pclos = imap4d_parsebuf_data (p);
+  
   ent = find_fetch_att_tab (p->token);
   if (ent)
     {
-      if (!(ent->fun == _frt_uid && p->isuid))
-	append_simple_function (p, ent->name, ent->fun);
-      parsebuf_next (p, 0);
+      if (!(ent->fun == _frt_uid && pclos->isuid))
+	append_simple_function (pclos, ent->name, ent->fun);
+      imap4d_parsebuf_next (p, 0);
     }
   else if (strcasecmp (p->token, "RFC822") == 0)
     parse_fetch_rfc822 (p);
@@ -1505,8 +1486,8 @@ parse_fetch_att (struct parsebuf *p)
     parse_fetch_body (p);
   else if (strcasecmp (p->token, "BODYSTRUCTURE") == 0)
     {
-      append_simple_function (p, "BODYSTRUCTURE", _frt_bodystructure);
-      parsebuf_next (p, 0);
+      append_simple_function (pclos, "BODYSTRUCTURE", _frt_bodystructure);
+      imap4d_parsebuf_next (p, 0);
     }
   else
     return 1;
@@ -1515,7 +1496,7 @@ parse_fetch_att (struct parsebuf *p)
 
 /* fetch-att *(SP fetch-att) */
 static void
-parse_fetch_att_list (struct parsebuf *p)
+parse_fetch_att_list (imap4d_parsebuf_t p)
 {
   while (p->token && parse_fetch_att (p) == 0)
     ;
@@ -1523,17 +1504,17 @@ parse_fetch_att_list (struct parsebuf *p)
 
 /* "ALL" / "FULL" / "FAST" / fetch-att / "(" */
 static void
-parse_macro (struct parsebuf *p)
+parse_macro (imap4d_parsebuf_t p)
 {  
   char *exp;
   
-  parsebuf_next (p, 1);
+  imap4d_parsebuf_next (p, 1);
   if (p->token[0] == '(')
     {
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       parse_fetch_att_list (p);
       if (!(p->token && p->token[0] == ')'))
-	parsebuf_exit (p, "Unknown token or missing closing parenthesis");
+	imap4d_parsebuf_exit (p, "Unknown token or missing closing parenthesis");
     }
   else if ((exp = find_macro (p->token))) 
     {
@@ -1541,63 +1522,43 @@ parse_macro (struct parsebuf *p)
       int save_arg = p->arg;
       p->tok = imap4d_tokbuf_from_string (exp);
       p->arg = 0;
-      parsebuf_next (p, 1);
+      imap4d_parsebuf_next (p, 1);
       parse_fetch_att_list (p);
       imap4d_tokbuf_destroy (&p->tok);
   
       p->arg = save_arg;
       p->tok = save_tok;
 
-      if (parsebuf_peek (p))
-	parsebuf_exit (p, "Too many arguments");
+      if (imap4d_parsebuf_peek (p))
+	imap4d_parsebuf_exit (p, "Too many arguments");
     }     
   else
     {
       parse_fetch_att (p);
       if (p->token)
-	parsebuf_exit (p, "Too many arguments");
+	imap4d_parsebuf_exit (p, "Too many arguments");
     }
 }
     
-/* Where the real implementation is.  It is here since UID command also
-   calls FETCH.  */
-int
-imap4d_fetch0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
+
+static int
+fetch_thunk (imap4d_parsebuf_t pb)
 {
-  int rc = RESP_OK;
-  char *msgset;
-  size_t *set = NULL;
-  int n = 0;
-  int i;
   int status;
-  struct fetch_runtime_closure frc;
-  struct parsebuf pb;
-
-  if (imap4d_tokbuf_argc (tok) - (IMAP4_ARG_1 + isuid) < 2)
-    {
-      *err_text = "Invalid arguments";
-      return 1;
-    }
-  
-  pb.tok = tok;
-  pb.arg = IMAP4_ARG_1 + isuid;
-  pb.isuid = isuid;
-  pb.err_text = "Syntax error";
-  mu_list_create (&pb.fnlist);
-  mu_list_set_destroy_item (pb.fnlist, _free_ffc);
-  if (setjmp (pb.errjmp))
-    {
-      *err_text = pb.err_text;
-      mu_list_destroy (&pb.fnlist);
-      return RESP_BAD;
-    }
+  char *msgset;
+  struct fetch_parse_closure *pclos = imap4d_parsebuf_data (pb);
   
-  msgset = parsebuf_next (&pb, 1);
+  msgset = imap4d_parsebuf_next (pb, 1);
 
   /* Get the message numbers in set[].  */
-  status = util_msgset (msgset, &set, &n, isuid);
-  if (status != 0)
+  status = util_msgset (msgset, &pclos->set, &pclos->count, pclos->isuid);
+  switch (status)
     {
+    case 0:
+      /* Very good! */
+      break;
+      
+    case EINVAL:
       /* RFC3501, section 6.4.8.
 	 
 	 A non-existent unique identifier is ignored without any error
@@ -1609,8 +1570,12 @@ imap4d_fetch0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
 	 as well, although I did not find any explicit mention thereof
 	 in the RFC. */
       
-      *err_text = "Completed";
+      pb->err_text = "Completed";
       return RESP_OK;
+
+    default:
+      pb->err_text = "Failed to parse message set";
+      return RESP_NO;
     }
 
   /* Compile the expression */
@@ -1619,33 +1584,67 @@ imap4d_fetch0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
      include the UID message data item as part of any FETCH
      response caused by a UID command, regardless of whether
      a UID was specified as a message data item to the FETCH. */
-  if (isuid)
-    append_simple_function (&pb, "UID", _frt_uid);
+  if (pclos->isuid)
+    append_simple_function (pclos, "UID", _frt_uid);
 
-  parse_macro (&pb);
-  
-  /* Prepare status code. It will be replaced if an error occurs in the
-     loop below */
-  frc.err_text = "Completed";
+  parse_macro (pb);
+  return RESP_OK;
+}
+
+/* Where the real implementation is.  It is here since UID command also
+   calls FETCH.  */
+int
+imap4d_fetch0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
+{
+  int rc;
+  struct fetch_parse_closure pclos;
   
-  for (i = 0; i < n && rc == RESP_OK; i++)
+  if (imap4d_tokbuf_argc (tok) - (IMAP4_ARG_1 + isuid) < 2)
     {
-      frc.msgno = (isuid) ? uid_to_msgno (set[i]) : set[i];
+      *err_text = "Invalid arguments";
+      return 1;
+    }
+
+  memset (&pclos, 0, sizeof (pclos));
+  pclos.isuid = isuid;
+  mu_list_create (&pclos.fnlist);
+  mu_list_set_destroy_item (pclos.fnlist, _free_ffc);
+  
+  rc = imap4d_with_parsebuf (tok, IMAP4_ARG_1 + isuid,
+			     ".[]<>",
+			     fetch_thunk, &pclos,
+			     err_text);
 
-      if (frc.msgno && mu_mailbox_get_message (mbox, frc.msgno, &frc.msg) == 0)
+  if (rc == RESP_OK)
+    {
+      size_t i;
+      struct fetch_runtime_closure frc;
+      
+      /* Prepare status code. It will be replaced if an error occurs in the
+	 loop below */
+      frc.err_text = "Completed";
+  
+      for (i = 0; i < pclos.count && rc == RESP_OK; i++)
 	{
-	  util_send ("* %lu FETCH (", (unsigned long) frc.msgno);
-	  frc.eltno = 0;
-	  rc = mu_list_do (pb.fnlist, _do_fetch, &frc);
-	  util_send (")\r\n");
+	  frc.msgno = (isuid) ? uid_to_msgno (pclos.set[i]) : pclos.set[i];
+	  
+	  if (frc.msgno &&
+	      mu_mailbox_get_message (mbox, frc.msgno, &frc.msg) == 0)
+	    {
+	      util_send ("* %lu FETCH (", (unsigned long) frc.msgno);
+	      frc.eltno = 0;
+	      rc = mu_list_do (pclos.fnlist, _do_fetch, &frc);
+	      util_send (")\r\n");
+	    }
 	}
-    }
+      }
   
-  mu_list_destroy (&pb.fnlist);
-  free (set);
+  mu_list_destroy (&pclos.fnlist);
+  free (pclos.set);
   return rc;
 }
 
+
 /*
 6.4.5.  FETCH Command
 
diff --git a/imap4d/imap4d.h b/imap4d/imap4d.h
index c054884..c2705e3 100644
--- a/imap4d/imap4d.h
+++ b/imap4d/imap4d.h
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2001, 2002, 2003, 2004, 
-   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -218,7 +218,35 @@ int imap4d_getline (char **pbuf, size_t *psize, size_t *pnbytes);
 #define IMAP4_ARG_2       3
 #define IMAP4_ARG_3       4
 #define IMAP4_ARG_4       5
+
+  /* Specialized buffer parsing */
+struct imap4d_parsebuf
+{
+  imap4d_tokbuf_t tok;
+  int arg;            /* Argument number in tok */
+  char *tokptr;       /* Current token */
+  size_t tokoff;      /* Offset of next delimiter in tokptr */
+  int save_char;      /* Character saved from tokptr[tokoff] */
+  char *token;        /* Pointer to the current token */
+  const char *delim;  /* Array of delimiters */
+  char *peek_ptr;     /* Peeked token */
+  jmp_buf errjmp;
+  char *err_text;
+  void *data;
+};
+
+typedef struct imap4d_parsebuf *imap4d_parsebuf_t;
   
+void imap4d_parsebuf_exit (imap4d_parsebuf_t pb, char *text);
+char *imap4d_parsebuf_peek (imap4d_parsebuf_t pb);
+char *imap4d_parsebuf_next (imap4d_parsebuf_t pb, int req);
+int imap4d_with_parsebuf (imap4d_tokbuf_t tok, int arg,
+			  const char *delim,
+			  int (*thunk) (imap4d_parsebuf_t), void *data,
+			  char **err_text);
+#define imap4d_parsebuf_token(p) ((p)->token)
+#define imap4d_parsebuf_data(p) ((p)->data)
+
   /* Imap4 commands */
 extern int  imap4d_append (struct imap4d_command *, imap4d_tokbuf_t);
 extern int  imap4d_authenticate (struct imap4d_command *, imap4d_tokbuf_t);
diff --git a/imap4d/parsebuf.c b/imap4d/parsebuf.c
new file mode 100644
index 0000000..f43d68a
--- /dev/null
+++ b/imap4d/parsebuf.c
@@ -0,0 +1,175 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   GNU Mailutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GNU Mailutils is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Mailutils; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301 USA */
+
+#include "imap4d.h"
+
+static void
+parsebuf_free (struct imap4d_parsebuf *p)
+{
+  if (p->peek_ptr)
+    free (p->peek_ptr);
+}
+  
+void
+imap4d_parsebuf_exit (struct imap4d_parsebuf *p, char *text)
+{
+  p->err_text = text;
+  longjmp (p->errjmp, 1);
+}
+
+static char *
+pbcopy (const char *str, size_t len)
+{
+  char *p = malloc (len + 1);
+  if (!p)
+    imap4d_bye (ERR_NO_MEM);
+  memcpy (p, str, len);
+  p[len] = 0;
+  return p;
+}
+
+static char *
+pbcopy_char (int c)
+{
+  char ch = c;
+  return pbcopy (&ch, 1);
+}
+
+char *
+imap4d_parsebuf_peek (struct imap4d_parsebuf *p)
+{
+  if (!p->peek_ptr)
+    {
+      if (!p->tokptr || p->save_char == 0)
+ 	{
+	  char *token = imap4d_tokbuf_getarg (p->tok, p->arg);
+	  if (!token)
+	    return NULL;
+	  if (p->delim)
+	    {
+	      if (strchr (p->delim, token[0]))
+		p->peek_ptr = pbcopy_char (token[0]);
+	      else
+		p->peek_ptr = pbcopy (token, strcspn (token, p->delim));
+	    }
+	  else
+	    p->peek_ptr = pbcopy (token, strlen (token));
+	}
+      else
+	{
+	  char *token = p->token + p->tokoff;
+
+	  if (strchr (p->delim, p->save_char))
+	    p->peek_ptr = pbcopy_char (p->save_char);
+	  else
+	    {
+	      size_t off = strcspn (token + 1, p->delim);
+	      p->peek_ptr = pbcopy (token, off + 1);
+	      p->peek_ptr[0] = p->save_char;
+	    }
+	}
+    }
+  return p->peek_ptr;
+}
+
+char *
+imap4d_parsebuf_next (struct imap4d_parsebuf *p, int req)
+{
+  if (p->peek_ptr)
+    {
+      free (p->peek_ptr);
+      p->peek_ptr = NULL;
+    }
+
+  if (!p->tokptr || p->save_char == 0)
+    {
+      p->tokptr = imap4d_tokbuf_getarg (p->tok, p->arg++);
+      p->token = p->tokptr;
+      p->tokoff = 0;
+      if (!p->token)
+	{
+	  if (req)
+	    imap4d_parsebuf_exit (p, "Too few arguments");
+	  return NULL;
+	}
+      if (p->delim)
+	{
+	  if (strchr (p->delim, p->token[0]))
+	    {
+	      p->save_char = p->token[1];
+	      p->tokoff = 1;
+	      p->token[1] = 0;
+	    }
+	  else
+	    {
+	      p->tokoff = strcspn (p->token, p->delim);
+	      if ((p->save_char = p->token[p->tokoff]))
+		p->token[p->tokoff] = 0;
+	    }
+	}
+      else
+	p->save_char = 0;
+    }
+  else
+    {
+      p->token[p->tokoff] = p->save_char;
+      p->token += p->tokoff;
+      if (strchr (p->delim, p->save_char))
+	{
+	  p->save_char = p->token[1];
+	  p->token[1] = 0;
+	  p->tokoff = 1;
+	}
+      else
+	{
+	  p->tokoff = strcspn (p->token, p->delim);
+	  if ((p->save_char = p->token[p->tokoff]))
+	    p->token[p->tokoff] = 0;
+	}
+    }
+  
+  return p->token;
+}
+
+int
+imap4d_with_parsebuf (imap4d_tokbuf_t tok, int arg, const char *delim,
+		      int (*thunk) (imap4d_parsebuf_t), void *data,
+		      char **err_text)
+{
+  struct imap4d_parsebuf pbuf;
+  int rc;
+  
+  memset (&pbuf, 0, sizeof pbuf);
+  pbuf.tok = tok;
+  pbuf.arg = arg;
+  pbuf.delim = delim;
+  pbuf.data = data;
+  pbuf.err_text = "Syntax error";
+  pbuf.data = data;
+  
+  if (setjmp (pbuf.errjmp))
+    {
+      *err_text = pbuf.err_text;
+      parsebuf_free (&pbuf);
+      return RESP_BAD;
+    }
+
+  rc = thunk (&pbuf);
+  parsebuf_free (&pbuf);
+  return rc;
+}
diff --git a/imap4d/store.c b/imap4d/store.c
index 5f3af09..c47c482 100644
--- a/imap4d/store.c
+++ b/imap4d/store.c
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2001, 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001, 2005, 2007, 2008,
+   2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -18,165 +19,165 @@
 
 #include "imap4d.h"
 
-/*
- * Now you're messing with a sumbitch
- */
+enum value_type { STORE_SET, STORE_ADD, STORE_UNSET };
 
-int
-imap4d_store (struct imap4d_command *command, imap4d_tokbuf_t tok)
+struct store_parse_closure
 {
-  int rc;
-  char *err_text;
-  
-  rc = imap4d_store0 (tok, 0, &err_text);
-  return util_finish (command, rc, "%s", err_text);
-}
-
-struct parsebuf
-{
-  char *token;
-  imap4d_tokbuf_t tok;
-  int arg;
-  jmp_buf errjmp;
-  char *err_text;
+  enum value_type how;
+  int ack;
+  int type;
+  int isuid;
+  size_t *set;
+  size_t count;
 };
-
-static void
-parsebuf_exit (struct parsebuf *p, char *text)
-{
-  p->err_text = text;
-  longjmp (p->errjmp, 1);
-}
-
-static char *
-parsebuf_next (struct parsebuf *p, int req)
-{
-  p->token = imap4d_tokbuf_getarg (p->tok, p->arg++);
-  if (!p->token && req)
-    parsebuf_exit (p, "Too few arguments");
-  return p->token;
-}
-
-int
-imap4d_store0 (imap4d_tokbuf_t tok, int isuid, char **ptext)
+  
+static int
+store_thunk (imap4d_parsebuf_t p)
 {
+  struct store_parse_closure *pclos = imap4d_parsebuf_data (p);
   char *msgset;
-  int status;
-  int ack = 1;
-  size_t i;
-  int n = 0;
-  size_t *set = NULL;
-  enum value_type { STORE_SET, STORE_ADD, STORE_UNSET } how;
-  struct parsebuf pb;
   char *data;
-  int type = 0;
+  int status;
   
-  pb.tok = tok;
-  pb.arg = IMAP4_ARG_1 + !!isuid;
-  pb.err_text = NULL;
-  if (setjmp (pb.errjmp))
-    {
-      *ptext = pb.err_text;
-      free (set);
-      return RESP_BAD;
-    }
-      
-  msgset = parsebuf_next (&pb, 1);
-  data = parsebuf_next (&pb, 1);
+  msgset = imap4d_parsebuf_next (p, 1);
+  data = imap4d_parsebuf_next (p, 1);
 
   if (*data == '+')
     {
-      how = STORE_ADD;
+      pclos->how = STORE_ADD;
       data++;
     }
   else if (*data == '-')
     {
-      how = STORE_UNSET;
+      pclos->how = STORE_UNSET;
       data++;
     }
   else
-    how = STORE_SET;
+    pclos->how = STORE_SET;
   
   if (strcasecmp (data, "FLAGS"))
-    parsebuf_exit (&pb, "Bogus data item");
-  data = parsebuf_next (&pb, 1);
+    imap4d_parsebuf_exit (p, "Bogus data item");
+  data = imap4d_parsebuf_next (p, 1);
 
   if (*data == '.')
     {
-      data = parsebuf_next (&pb, 1);
+      data = imap4d_parsebuf_next (p, 1);
       if (strcasecmp (data, "SILENT") == 0)
 	{
-	  ack = 0;
-	  parsebuf_next (&pb, 1);
+	  pclos->ack = 0;
+	  imap4d_parsebuf_next (p, 1);
 	}
       else
-	parsebuf_exit (&pb, "Bogus data suffix");
+	imap4d_parsebuf_exit (p, "Bogus data suffix");
     }
 
   /* Get the message numbers in set[].  */
-  status = util_msgset (msgset, &set, &n, isuid);
-  if (status != 0)
+  status = util_msgset (msgset, &pclos->set, &pclos->count, pclos->isuid);
+  switch (status)
     {
+    case 0:
+      break;
+
+    case EINVAL:
       /* See RFC 3501, section 6.4.8, and a comment to the equivalent code
 	 in fetch.c */
-      *ptext = "Completed";
+      p->err_text = "Completed";
       return RESP_OK;
+
+    default:
+      p->err_text = "Failed to parse message set";
+      return RESP_NO;
     }      
 
-  if (pb.token[0] != '(')
-    parsebuf_exit (&pb, "Syntax error");
-  parsebuf_next (&pb, 1);
+  if (p->token[0] != '(')
+    imap4d_parsebuf_exit (p, "Syntax error");
+  imap4d_parsebuf_next (p, 1);
   
   do
     {
       int t;
-      if (!util_attribute_to_type (pb.token, &t))
-	type |= t;
+      if (!util_attribute_to_type (p->token, &t))
+	pclos->type |= t;
     }
-  while (parsebuf_next (&pb, 1) && pb.token[0] != ')');
+  while (imap4d_parsebuf_next (p, 1) && p->token[0] != ')');
+  return RESP_OK;
+}
+
+int
+imap4d_store0 (imap4d_tokbuf_t tok, int isuid, char **ptext)
+{
+  int rc;
+  struct store_parse_closure pclos;
 
-  for (i = 0; i < n; i++)
+  memset (&pclos, 0, sizeof pclos);
+  pclos.ack = 1;
+  pclos.isuid = isuid;
+  
+  rc = imap4d_with_parsebuf (tok,
+			     IMAP4_ARG_1 + !!isuid,
+			     ".",
+			     store_thunk, &pclos,
+			     ptext);
+  if (rc == RESP_OK)
     {
-      mu_message_t msg = NULL;
-      mu_attribute_t attr = NULL;
-      size_t msgno = isuid ? uid_to_msgno (set[i]) : set[i];
+      size_t i;
       
-      if (msgno)
+      for (i = 0; i < pclos.count; i++)
 	{
-	  mu_mailbox_get_message (mbox, msgno, &msg);
-	  mu_message_get_attribute (msg, &attr);
-
-	  switch (how)
-	    {
-	    case STORE_ADD:
-	      mu_attribute_set_flags (attr, type);
-	      break;
+	  mu_message_t msg = NULL;
+	  mu_attribute_t attr = NULL;
+	  size_t msgno = isuid ? uid_to_msgno (pclos.set[i]) : pclos.set[i];
       
-	    case STORE_UNSET:
-	      mu_attribute_unset_flags (attr, type);
-	      break;
+	  if (msgno)
+	    {
+	      mu_mailbox_get_message (mbox, msgno, &msg);
+	      mu_message_get_attribute (msg, &attr);
+	      
+	      switch (pclos.how)
+		{
+		case STORE_ADD:
+		  mu_attribute_set_flags (attr, pclos.type);
+		  break;
+		  
+		case STORE_UNSET:
+		  mu_attribute_unset_flags (attr, pclos.type);
+		  break;
       
-	    case STORE_SET:
-	      mu_attribute_unset_flags (attr, 0xffffffff); /* FIXME */
-	      mu_attribute_set_flags (attr, type);
+		case STORE_SET:
+		  mu_attribute_unset_flags (attr, 0xffffffff); /* FIXME */
+		  mu_attribute_set_flags (attr, pclos.type);
+		}
+	    }
+	  
+	  if (pclos.ack)
+	    {
+	      util_send ("* %d FETCH (", msgno);
+	      
+	      if (isuid)
+		util_send ("UID %lu ", (unsigned long) msgno);
+	      util_send ("FLAGS (");
+	      util_print_flags (attr);
+	      util_send ("))\r\n");
 	    }
+	  /* Update the flags of uid table.  */
+	  imap4d_sync_flags (pclos.set[i]);
 	}
 
-      if (ack)
-	{
-	  util_send ("* %d FETCH (", msgno);
-
-	  if (isuid)
-	    util_send ("UID %lu ", (unsigned long) msgno);
-	  util_send ("FLAGS (");
-	  util_print_flags (attr);
-	  util_send ("))\r\n");
-	}
-      /* Update the flags of uid table.  */
-      imap4d_sync_flags (set[i]);
+      *ptext = "Completed";
     }
-  free (set);
-  *ptext = "Completed";
-  return RESP_OK;
+
+  free (pclos.set);
+  
+  return rc;
+}
+
+int
+imap4d_store (struct imap4d_command *command, imap4d_tokbuf_t tok)
+{
+  int rc;
+  char *err_text;
+  
+  rc = imap4d_store0 (tok, 0, &err_text);
+  return util_finish (command, rc, "%s", err_text);
 }
 
diff --git a/imap4d/util.c b/imap4d/util.c
index 47b1f08..f63fc90 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2001, 2002, 2003, 2004, 
-   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -121,6 +121,7 @@ util_msgset (char *s, size_t ** set, int *n, int isuid)
 	      {
 		if (*set)
 		  free (*set);
+		*set = NULL;
 		*n = 0;
 		return EINVAL;
 	      }
@@ -133,6 +134,7 @@ util_msgset (char *s, size_t ** set, int *n, int isuid)
 		  }
 		if (*set)
 		  free (*set);
+		*set = NULL;
 		*n = 0;
 		return EINVAL;
 	      }
@@ -147,6 +149,7 @@ util_msgset (char *s, size_t ** set, int *n, int isuid)
 		    if (tmp < 0 || val == 0)
 		      {
 			free (*set);
+			*set = NULL;
 			*n = 0;
 			return EINVAL;
 		      }
@@ -206,6 +209,7 @@ util_msgset (char *s, size_t ** set, int *n, int isuid)
 	  done = 1;
 	  if (*set)
 	    free (*set);
+	  *set = NULL;
 	  *n = 0;
 	  return EINVAL;
 
@@ -238,6 +242,7 @@ util_msgset (char *s, size_t ** set, int *n, int isuid)
 	  if (tmp < 0 || val == 0)
 	    {
 	      free (*set);
+	      *set = NULL;
 	      *n = 0;
 	      return EINVAL;
 	    }
@@ -1221,7 +1226,7 @@ imap4d_tokbuf_expand (struct imap4d_tokbuf *tok, size_t size)
     }
 }
 
-#define ISDELIM(c) (strchr (".()[]<>", (c)) != NULL)
+#define ISDELIM(c) (strchr ("()", (c)) != NULL)
 #define ISWS(c) (c == ' ' || c == '\t')
 
 int
@@ -1257,7 +1262,7 @@ gettok (struct imap4d_tokbuf *tok, size_t off)
 	tok->argmax = 16;
       else
 	tok->argmax *= 2;
-      tok->argp = realloc(tok->argp, tok->argmax * sizeof (tok->argp[0]));
+      tok->argp = realloc (tok->argp, tok->argmax * sizeof (tok->argp[0]));
       if (!tok->argp)
 	imap4d_bye (ERR_NO_MEM);
     }
@@ -1278,7 +1283,7 @@ gettok (struct imap4d_tokbuf *tok, size_t off)
 	{
 	  size_t len;
 	  off++;
-	  len  = unquote(buf + off, p - (buf + off));
+	  len  = unquote (buf + off, p - (buf + off));
 	  buf[off + len] = 0;
 	  tok->argp[tok->argc++] = off;
 	  return p - buf + 1;
diff --git a/include/mailutils/guile.h b/include/mailutils/guile.h
index ad03dcf..cdc9c09 100644
--- a/include/mailutils/guile.h
+++ b/include/mailutils/guile.h
@@ -69,10 +69,20 @@ extern SCM mu_port_make_from_stream (SCM msg, mu_stream_t stream, long mode);
 extern void mu_scm_mime_init (void);
 extern void mu_scm_message_add_owner (SCM MESG, SCM owner);
 
+extern void mu_scm_mutil_init (void);
+
 extern void mu_process_mailbox (int argc, char *argv[], mu_guimb_param_t *param);
 
-extern void mu_scm_mutil_init (void);
+extern void mu_guile_init (int debug);
+extern int mu_guile_load (char *filename, int argc, char **argv);
+extern int mu_guile_eval (const char *string);
+extern int mu_guile_mailbox_apply (mu_mailbox_t mbx, char *funcname);
+extern int mu_guile_message_apply (mu_message_t msg, char *funcname);
 
+extern int mu_guile_safe_exec (SCM (*handler) (void *data), void *data,
+			       SCM *result);
+extern int mu_guile_safe_proc_call (SCM proc, SCM arglist, SCM *presult);
+  
 #ifdef __cplusplus
 }
 #endif
diff --git a/libmu_scm/Makefile.am b/libmu_scm/Makefile.am
index 4a4ecb2..282d262 100644
--- a/libmu_scm/Makefile.am
+++ b/libmu_scm/Makefile.am
@@ -26,6 +26,7 @@ EXTRA_LTLIBRARIES=libmu_scm.la
 C_SRCS=\
  mu_address.c\
  mu_body.c\
+ mu_guile.c\
  mu_guimb.c\
  mu_mailbox.c\
  mu_message.c\
diff --git a/libmu_scm/mu_guile.c b/libmu_scm/mu_guile.c
new file mode 100644
index 0000000..f6b6caa
--- /dev/null
+++ b/libmu_scm/mu_guile.c
@@ -0,0 +1,199 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General
+   Public License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA */
+
+#include "mu_scm.h"
+
+static SCM
+eval_catch_body (void *list)
+{
+  return scm_primitive_eval ((SCM)list);
+}
+
+static SCM
+eval_catch_handler (void *data, SCM tag, SCM throw_args)
+{
+  scm_handle_by_message_noexit ("mailutils", tag, throw_args);
+  longjmp (*(jmp_buf*)data, 1);
+}
+
+struct scheme_exec_data
+{
+  SCM (*handler) (void *data);
+  void *data;
+  SCM result;
+};
+
+static SCM
+scheme_safe_exec_body (void *data)
+{
+  struct scheme_exec_data *ed = data;
+  ed->result = ed->handler (ed->data);
+  return SCM_BOOL_F;
+}
+
+int
+mu_guile_safe_exec (SCM (*handler) (void *data), void *data, SCM *result)
+{
+  jmp_buf jmp_env;
+  struct scheme_exec_data ed;
+	
+  if (setjmp (jmp_env))
+    return 1;
+  ed.handler = handler;
+  ed.data = data;
+  scm_internal_lazy_catch (SCM_BOOL_T,
+			   scheme_safe_exec_body, (void*)&ed,
+			   eval_catch_handler, &jmp_env);
+  if (result)
+    *result = ed.result;
+  return 0;
+}
+
+
+
+SCM
+lookup_handler (void *data)
+{
+  const char *symbol = (const char *)data;
+  return MU_SCM_SYMBOL_VALUE (symbol);
+}
+
+int
+mu_guile_sym_lookup (const char *symbol, SCM *result)
+{
+  return mu_guile_safe_exec (lookup_handler, (void*) symbol, result);
+}
+
+
+int
+mu_guile_safe_proc_call (SCM proc, SCM arglist, SCM *presult)
+{
+  jmp_buf jmp_env;
+  SCM cell, result;
+    
+  if (setjmp (jmp_env))
+    return 1;
+    
+  cell = scm_cons (proc, arglist);
+  result = scm_internal_lazy_catch (SCM_BOOL_T,
+				    eval_catch_body, cell,
+				    eval_catch_handler, &jmp_env);
+  if (presult)
+    *presult = result;
+  return 0;
+}
+
+
+
+void
+mu_guile_init (int debug)
+{
+  scm_init_guile ();
+  scm_load_goops ();
+
+  if (debug)
+    {
+      SCM_DEVAL_P = 1;
+      SCM_BACKTRACE_P = 1;
+      SCM_RECORD_POSITIONS_P = 1;
+      SCM_RESET_DEBUG_MODE;
+    }
+  mu_scm_init ();
+}
+
+
+struct load_closure
+{
+  char *filename;
+  int argc;
+  char **argv;
+};
+
+static SCM
+load_path_handler (void *data)
+{
+  struct load_closure *lp = data;
+    
+  scm_set_program_arguments (lp->argc, lp->argv, lp->filename);
+  scm_primitive_load (scm_makfrom0str (lp->filename));
+  return SCM_UNDEFINED;
+}
+
+int
+mu_guile_load (char *filename, int argc, char **argv)
+{
+  struct load_closure lc;
+  lc.filename = filename;
+  lc.argc = argc;
+  lc.argv = argv;
+  return mu_guile_safe_exec (load_path_handler, &lc, NULL);
+}
+
+static SCM
+eval_handler (void *data)
+{
+  const char *string = data;
+  scm_c_eval_string (string);
+  return SCM_UNDEFINED;
+}
+
+int
+mu_guile_eval (const char *string)
+{
+  return mu_guile_safe_exec (eval_handler, (void*) string, NULL);
+}
+
+
+/* See comment on this function in mu_mailbox.c */
+extern SCM mu_scm_mailbox_create0 (mu_mailbox_t mbox, int noclose);
+  
+int
+mu_guile_mailbox_apply (mu_mailbox_t mbx, char *funcname)
+{
+  SCM proc;
+
+  if (mu_guile_sym_lookup (funcname, &proc))
+    return MU_ERR_NOENT;
+  if (scm_procedure_p (proc) != SCM_BOOL_T)
+    return EINVAL;
+
+  if (mu_guile_safe_proc_call (proc,
+			       scm_list_1 (mu_scm_mailbox_create0 (mbx, 1)),
+			       NULL))
+    return MU_ERR_FAILURE;
+
+  return 0;
+}
+
+int
+mu_guile_message_apply (mu_message_t msg, char *funcname)
+{
+  SCM proc;
+
+  if (mu_guile_sym_lookup (funcname, &proc))
+    return MU_ERR_NOENT;
+  if (scm_procedure_p (proc) != SCM_BOOL_T)
+    return EINVAL;
+
+  if (mu_guile_safe_proc_call (proc,
+		       scm_list_1 (mu_scm_message_create (SCM_BOOL_F, msg)),
+			   NULL))
+    return MU_ERR_FAILURE;
+
+  return 0;
+}
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index 6fb611a..e0a3e47 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -25,6 +25,7 @@ long mailbox_tag;
 struct mu_mailbox
 {
   mu_mailbox_t mbox;       /* Mailbox */
+  int noclose;
 };
 
 /* SMOB functions: */
@@ -38,8 +39,11 @@ static scm_sizet
 mu_scm_mailbox_free (SCM mailbox_smob)
 {
   struct mu_mailbox *mum = (struct mu_mailbox *) SCM_CDR (mailbox_smob);
-  mu_mailbox_close (mum->mbox);
-  mu_mailbox_destroy (&mum->mbox);
+  if (!mum->noclose)
+    {
+      mu_mailbox_close (mum->mbox);
+      mu_mailbox_destroy (&mum->mbox);
+    }
   free (mum);
   /* NOTE: Currently there is no way for this function to return the
      amount of memory *actually freed* by mu_mailbox_destroy */
@@ -85,16 +89,38 @@ mu_scm_mailbox_print (SCM mailbox_smob, SCM port, scm_print_state * pstate)
 
 /* Internal functions */
 
+/* There are two C interfaces for creating mailboxes in Scheme.
+   The first one, mu_scm_mailbox_create0, allows to set `noclose'
+   bit, which disables closing and releasing the underlying mu_mailbox_t
+   after the hosting SCM object is freed. Use this, if this mailbox
+   is referenced elsewhere.
+
+   Another one, mu_scm_mailbox_create, always create an object that
+   will cause closing the mu_mailbox_t object and releasing its memory
+   after the hosting SCM object is swept away by GC. This is the only
+   official one.
+
+   The mu_scm_mailbox_create0 function is a kludge, needed because
+   mu_mailbox_t objects don't have reference counters. When it is fixed in
+   the library, the interface will be removed. */
+
 SCM
-mu_scm_mailbox_create (mu_mailbox_t mbox)
+mu_scm_mailbox_create0 (mu_mailbox_t mbox, int noclose)
 {
   struct mu_mailbox *mum;
 
   mum = scm_gc_malloc (sizeof (struct mu_mailbox), "mailbox");
   mum->mbox = mbox;
+  mum->noclose = noclose;
   SCM_RETURN_NEWSMOB (mailbox_tag, mum);
 }
 
+SCM
+mu_scm_mailbox_create (mu_mailbox_t mbox)
+{
+  return mu_scm_mailbox_create0 (mbox, 0);
+}
+
 int
 mu_scm_is_mailbox (SCM scm)
 {
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index 47f950e..5c73e42 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -103,7 +103,7 @@ mu_scm_message_print (SCM message_smob, SCM port, scm_print_state * pstate)
       else
 	scm_puts ("UNKNOWN", port);
       
-      if (mu_envelope_sget_date (env, &buffer) == 0
+      if (mu_envelope_sget_date (env, &p) == 0
           && mu_parse_ctime_date_time (&p, &tm, &tz) == 0)
 	{
 	  strftime (datebuf, sizeof (datebuf), "%a %b %e %H:%M", &tm);
diff --git a/libmu_scm/mu_scm.h b/libmu_scm/mu_scm.h
index 92b7b1a..8f04bf5 100644
--- a/libmu_scm/mu_scm.h
+++ b/libmu_scm/mu_scm.h
@@ -49,4 +49,3 @@
 
 #include <mailutils/guile.h>
 
-
diff --git a/maidag/Makefile.am b/maidag/Makefile.am
index 7b5eca2..c19ffc4 100644
--- a/maidag/Makefile.am
+++ b/maidag/Makefile.am
@@ -21,11 +21,13 @@ sbin_PROGRAMS=maidag
 maidag_SOURCES=\
  deliver.c\
  forward.c\
+ guile.c\
  lmtp.c\
  maidag.c\
  maidag.h\
  mailtmp.c\
  mailquota.c\
+ sieve.c\
  script.c\
  util.c
 
diff --git a/maidag/deliver.c b/maidag/deliver.c
index 1c6ae79..e8a5b07 100644
--- a/maidag/deliver.c
+++ b/maidag/deliver.c
@@ -72,19 +72,6 @@ maidag_stdio_delivery (int argc, char **argv)
   if (multiple_delivery)
     multiple_delivery = argc > 1;
 
-#ifdef WITH_GUILE
-  if (progfile_pattern)
-    {
-      struct mda_data mda_data;
-      
-      memset (&mda_data, 0, sizeof mda_data);
-      mda_data.mbox = mbox;
-      mda_data.argv = argv;
-      mda_data.progfile_pattern = progfile_pattern;
-      return prog_mda (&mda_data);
-    }
-#endif
-  
   for (; *argv; argv++)
     mda (mbox, *argv);
   return exit_code;
@@ -322,8 +309,8 @@ deliver_url (mu_url_t url, mu_message_t msg, const char *name, char **errp)
 
       if (current_uid)
 	auth->change_uid = 0;
-  
-      if (!sieve_test (auth, msg))
+
+      if (script_apply (msg, auth))
 	{
 	  exit_code = EX_OK;
 	  mu_auth_data_free (auth);
diff --git a/mail/cd.c b/maidag/guile.c
similarity index 63%
copy from mail/cd.c
copy to maidag/guile.c
index b88f46e..9e2b193 100644
--- a/mail/cd.c
+++ b/maidag/guile.c
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2005,
+   2007, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -16,29 +17,27 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    MA 02110-1301 USA */
 
-#include "mail.h"
+#include "maidag.h"
 
-/*
- * cd [directory]
- * ch[dir] [directory]
- */
+#ifdef WITH_GUILE
+#include <mailutils/guile.h>
+
+int debug_guile;
+static int initialized;
 
 int
-mail_cd (int argc, char **argv)
+scheme_check_msg (mu_message_t msg, struct mu_auth_data *auth,
+		  const char *prog)
 {
-  char *dir;
-  
-  if (argc > 2)
-    return 1;
-  else if (argc == 2)
-    dir = argv[1];
-  else 
-    dir = getenv ("HOME");
-
-  if (chdir (dir))
+  if (!initialized)
     {
-      mu_error (_("cannot change to `%s': %s"), dir, mu_strerror (errno));
-      return 1;
+      mu_guile_init (debug_guile);
+      initialized = 1;
     }
+  mu_guile_load (prog, 0, NULL);
+  mu_guile_message_apply (msg, "mailutils-check-message");
   return 0;
 }
+
+#endif
+
diff --git a/maidag/maidag.c b/maidag/maidag.c
index 88bc9ab..94aaa03 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -30,8 +30,10 @@ char *quotadbname = NULL;  /* Name of mailbox quota database */
 char *quota_query = NULL;  /* SQL query to retrieve mailbox quota */
 
 char *sender_address = NULL;       
-char *progfile_pattern = NULL;
-char *sieve_pattern = NULL;
+
+maidag_script_fun script_handler;
+
+mu_list_t script_list;
 
 char *forward_file = NULL;
 int forward_file_checks = FWD_ALL;
@@ -73,28 +75,40 @@ static char args_doc[] = N_("[recipient...]");
 
 static struct argp_option options[] = 
 {
-  { "foreground", FOREGROUND_OPTION, 0, 0, N_("Remain in foreground."), 0 },
-  { "inetd",  'i', 0, 0, N_("Run in inetd mode"), 0 },
+#define GRID 0
+ { NULL, 0, NULL, 0,
+   N_("General options"), GRID },
+      
+  { "foreground", FOREGROUND_OPTION, 0, 0, N_("Remain in foreground."),
+    GRID + 1 },
+  { "inetd",  'i', 0, 0, N_("Run in inetd mode"), GRID + 1 },
   { "daemon", 'd', N_("NUMBER"), OPTION_ARG_OPTIONAL,
-    N_("Runs in daemon mode with a maximum of NUMBER children"), 0 },
-  { "url", URL_OPTION, 0, 0, N_("Deliver to given URLs"), 0 },
+    N_("Runs in daemon mode with a maximum of NUMBER children"), GRID + 1 },
+  { "url", URL_OPTION, 0, 0, N_("Deliver to given URLs"), GRID + 1 },
   { "from", 'f', N_("EMAIL"), 0,
-    N_("Specify the sender's name") },
+    N_("Specify the sender's name"), GRID + 1 },
   { NULL, 'r', NULL, OPTION_ALIAS, NULL },
-  { "sieve", 'S', N_("PATTERN"), 0,
-    N_("Set name pattern for user-defined Sieve mail filters"), 0 },
-  { "message-id-header", MESSAGE_ID_HEADER_OPTION, N_("STRING"), 0,
-    N_("Identify messages by the value of this header when logging Sieve actions"), 0 },
-#ifdef WITH_GUILE
-  { "source", 's', N_("PATTERN"), 0,
-    N_("Set name pattern for user-defined Scheme mail filters"), 0 },
-#endif
   { "lmtp", LMTP_OPTION, N_("URL"), OPTION_ARG_OPTIONAL,
-    N_("Operate in LMTP mode"), 0 },
+    N_("Operate in LMTP mode"), GRID + 1 },
   { "debug", 'x', N_("FLAGS"), 0,
-    N_("Enable debugging"), 0 },
+    N_("Enable debugging"), GRID + 1 },
   { "stderr", STDERR_OPTION, NULL, 0,
-    N_("Log to standard error"), 0 },
+    N_("Log to standard error"), GRID + 1 },
+#undef GRID
+
+#define GRID 2
+ { NULL, 0, NULL, 0,
+   N_("Scripting options"), GRID },
+ 
+  { "language", 'l', N_("STRING"), 0,
+    N_("Define scripting language for the next --script option"),
+    GRID + 1 },
+  { "script", 's', N_("PATTERN"), 0,
+    N_("Set name pattern for user-defined mail filter"), GRID + 1 },
+  { "message-id-header", MESSAGE_ID_HEADER_OPTION, N_("STRING"), 0,
+    N_("Use this header to identify messages when logging Sieve actions"),
+    GRID + 1 },
+#undef GRID
   { NULL,      0, NULL, 0, NULL, 0 }
 };
 
@@ -201,21 +215,30 @@ parse_opt (int key, char *arg, struct argp_state *state)
     case 'r':
     case 'f':
       if (sender_address != NULL)
-	{
-	  argp_error (state, _("Multiple --from options"));
-	  return EX_USAGE;
-	}
+	argp_error (state, _("Multiple --from options"));
       sender_address = arg;
       break;
       
-#ifdef WITH_GUILE	
-    case 's':
-      mu_argp_node_list_new (&lst, "guile-filter", arg);
+    case 'l':
+      script_handler = script_lang_handler (arg);
+      if (!script_handler)
+	argp_error (state, _("Unknown or unsupported language: %s"),
+		    arg);
       break;
-#endif
+      
+    case 's':
+      switch (script_register (arg))
+	{
+	case 0:
+	  break;
 
-    case 'S':
-      mu_argp_node_list_new (&lst, "sieve-filter", arg);
+	case EINVAL:
+	  argp_error (state, _("%s has unknown file suffix"), arg);
+	  break;
+
+	default:
+	  argp_error (state, _("error registering script"));
+	}
       break;
       
     case 'x':
@@ -329,6 +352,54 @@ cb_forward_file_checks (mu_debug_t debug, void *data, mu_config_value_t *arg)
   return mu_cfg_string_value_cb (debug, arg, cb2_forward_file_checks, data);
 }
 
+static int
+cb_script_language (mu_debug_t debug, void *data, mu_config_value_t *val)
+{
+  if (mu_cfg_assert_value_type (val, MU_CFG_STRING, debug))
+    return 1;
+  script_handler = script_lang_handler (val->v.string);
+  if (!script_handler)
+    {
+      mu_cfg_format_error (debug, MU_DEBUG_ERROR,
+			   _("Unsupported language: %s"),
+			   val->v.string);
+      return 1;
+    }
+  return 0;
+}
+
+static int
+cb_script_pattern (mu_debug_t debug, void *data, mu_config_value_t *val)
+{
+  if (mu_cfg_assert_value_type (val, MU_CFG_STRING, debug))
+    return 1;
+  
+  switch (script_register (val->v.string))
+    {
+    case 0:
+      break;
+
+    case EINVAL:
+      mu_cfg_format_error (debug, MU_DEBUG_ERROR,
+			   _("%s has unknown file suffix"),
+			   val->v.string);
+      break;
+
+    default:
+      mu_cfg_format_error (debug, MU_DEBUG_ERROR,
+			   _("error registering script"));
+    }
+  return 0;
+}
+
+struct mu_cfg_param filter_cfg_param[] = {
+  { "language", mu_cfg_callback, NULL, 0, cb_script_language,
+    N_("Set script language.") },
+  { "pattern", mu_cfg_callback, NULL, 0, cb_script_pattern,
+    N_("Set script pattern.") },
+  { NULL }
+};
+    
 struct mu_cfg_param maidag_cfg_param[] = {
   { "exit-multiple-delivery-success", mu_cfg_bool, &multiple_delivery, 0, NULL,
     N_("In case of multiple delivery, exit with code 0 if at least one "
@@ -347,18 +418,10 @@ struct mu_cfg_param maidag_cfg_param[] = {
        "sql { ... } instead."),
     N_("query") },
 #endif
-  { "sieve-filter", mu_cfg_string, &sieve_pattern, 0, NULL,
-    N_("File name or name pattern for Sieve filter file."),
-    N_("file-or-pattern") },
   { "message-id-header", mu_cfg_string, &message_id_header, 0, NULL,
     N_("When logging Sieve actions, identify messages by the value of "
        "this header."),
     N_("name") },
-#ifdef WITH_GUILE
-  { "guile-filter", mu_cfg_string, &progfile_pattern, 0, NULL,
-    N_("File name or name pattern for Guile filter file."),
-    N_("file-or-pattern") },
-#endif
   { "debug", mu_cfg_callback, NULL, 0, cb_debug,
     N_("Set maidag debug level.  Debug level consists of one or more "
        "of the following letters:\n"
@@ -388,138 +451,23 @@ struct mu_cfg_param maidag_cfg_param[] = {
     N_("url") },
   { "reuse-address", mu_cfg_bool, &reuse_lmtp_address, 0, NULL,
     N_("Reuse existing address (LMTP mode).  Default is \"yes\".") },
+  { "filter", mu_cfg_section, NULL, 0, NULL,
+    N_("Add a message filter") },
   { ".server", mu_cfg_section, NULL, 0, NULL,
     N_("LMTP server configuration.") },
   TCP_WRAPPERS_CONFIG
   { NULL }
 };
 
-
-/* Logging */
-
-static int
-_sieve_debug_printer (void *unused, const char *fmt, va_list ap)
-{
-  mu_diag_vprintf (MU_DIAG_DEBUG, fmt, ap);
-  return 0;
-}
-
 static void
-_sieve_action_log (void *user_name,
-		   const mu_sieve_locus_t *locus, size_t msgno,
-		   mu_message_t msg,
-		   const char *action, const char *fmt, va_list ap)
-{
-  int pfx = 0;
-  mu_debug_t debug;
-
-  mu_diag_get_debug (&debug);
-  mu_debug_set_locus (debug, locus->source_file, locus->source_line);
-  
-  mu_diag_printf (MU_DIAG_NOTICE, _("(user %s) "), (char*) user_name);
-  if (message_id_header)
-    {
-      mu_header_t hdr = NULL;
-      char *val = NULL;
-      mu_message_get_header (msg, &hdr);
-      if (mu_header_aget_value (hdr, message_id_header, &val) == 0
-	  || mu_header_aget_value (hdr, MU_HEADER_MESSAGE_ID, &val) == 0)
-	{
-	  pfx = 1;
-	  mu_diag_printf (MU_DIAG_NOTICE, _("%s on msg %s"), action, val);
-	  free (val);
-	}
-    }
-  
-  if (!pfx)
-    {
-      size_t uid = 0;
-      mu_message_get_uid (msg, &uid);
-      mu_diag_printf (MU_DIAG_NOTICE, _("%s on msg uid %d"), action, uid);
-    }
-  
-  if (fmt && strlen (fmt))
-    {
-      mu_diag_printf (MU_DIAG_NOTICE, "; ");
-      mu_diag_vprintf (MU_DIAG_NOTICE, fmt, ap);
-    }
-  mu_diag_printf (MU_DIAG_NOTICE, "\n");
-  mu_debug_set_locus (debug, NULL, 0);
-}
-
-static int
-_sieve_parse_error (void *user_name, const char *filename, int lineno,
-		    const char *fmt, va_list ap)
-{
-  mu_debug_t debug;
-
-  mu_diag_get_debug (&debug);
-  if (filename)
-    mu_debug_set_locus (debug, filename, lineno);
-
-  mu_diag_printf (MU_DIAG_ERROR, _("(user %s) "), (char*) user_name);
-  mu_diag_vprintf (MU_DIAG_ERROR, fmt, ap);
-  mu_diag_printf (MU_DIAG_ERROR, "\n");
-  mu_debug_set_locus (debug, NULL, 0);
-  return 0;
-}
-
-int
-sieve_test (struct mu_auth_data *auth, mu_message_t msg)
+maidag_cfg_init ()
 {
-  int rc = 1;
-  char *progfile;
-    
-  if (!sieve_pattern)
-    return 1;
-
-  progfile = mu_expand_path_pattern (sieve_pattern, auth->name);
-  if (access (progfile, R_OK))
-    {
-      if (debug_level > 2)
-	mu_diag_output (MU_DIAG_DEBUG, _("Access to %s failed: %m"), progfile);
-    }
-  else
+  struct mu_cfg_section *section;
+  if (mu_create_canned_section ("filter", &section) == 0)
     {
-      mu_sieve_machine_t mach;
-      rc = mu_sieve_machine_init (&mach, auth->name);
-      if (rc)
-	{
-	  mu_error (_("Cannot initialize sieve machine: %s"),
-		    mu_strerror (rc));
-	}
-      else
-	{
-	  mu_sieve_set_debug (mach, _sieve_debug_printer);
-	  mu_sieve_set_debug_level (mach, sieve_debug_flags);
-	  mu_sieve_set_parse_error (mach, _sieve_parse_error);
-	  if (sieve_enable_log)
-	    mu_sieve_set_logger (mach, _sieve_action_log);
-	  
-	  rc = mu_sieve_compile (mach, progfile);
-	  if (rc == 0)
-	    {
-	      mu_attribute_t attr;
-
-	      mu_message_get_attribute (msg, &attr);
-	      mu_attribute_unset_deleted (attr);
-	      if (switch_user_id (auth, 1) == 0)
-		{
-		  chdir (auth->dir);
-		
-		  rc = mu_sieve_message (mach, msg);
-		  if (rc == 0)
-		    rc = mu_attribute_is_deleted (attr) == 0;
-
-		  switch_user_id (auth, 0);
-		  chdir ("/");
-		}
-	      mu_sieve_machine_destroy (&mach);
-	    }
-	}
+      section->docstring = N_("Add new message filter.");
+      mu_cfg_section_add_params (section, filter_cfg_param);
     }
-  free (progfile);
-  return rc;
 }
 
 
@@ -557,6 +505,7 @@ main (int argc, char *argv[])
   mu_tcpwrapper_cfg_init ();
   mu_acl_cfg_init ();
   mu_m_server_cfg_init ();
+  maidag_cfg_init ();
   
   /* Parse command line */
   mu_argp_init (program_version, NULL);
diff --git a/maidag/maidag.h b/maidag/maidag.h
index d5806ff..30c6b2b 100644
--- a/maidag/maidag.h
+++ b/maidag/maidag.h
@@ -129,8 +129,10 @@ extern char *forward_file;
 extern int forward_file_checks;
 
 extern char *sender_address;       
-extern char *progfile_pattern;
-extern char *sieve_pattern;
+extern mu_list_t script_list;
+extern char *message_id_header;
+extern int sieve_debug_flags; 
+extern int sieve_enable_log;  
 
 extern mu_m_server_t server;
 extern int lmtp_mode;
@@ -157,20 +159,6 @@ int deliver (mu_message_t msg, char *name, char **errp);
 int sieve_test (struct mu_auth_data *auth, mu_message_t msg);
 int check_quota (struct mu_auth_data *auth, mu_off_t size, mu_off_t *rest);
 
-#ifdef WITH_GUILE
-struct mda_data
-{
-  mu_mailbox_t mbox;
-  char *progfile;
-  char *progfile_pattern;
-  char **argv;
-};
-
-int prog_mda (struct mda_data *data);
-
-extern int debug_guile;
-#endif
-
 struct mail_tmp;
 int mail_tmp_begin (struct mail_tmp **pmtmp, const char *from);
 int mail_tmp_add_line (struct mail_tmp *mtmp, char *buf, size_t buflen);
@@ -188,3 +176,31 @@ enum maidag_forward_result
 enum maidag_forward_result maidag_forward (mu_message_t msg,
 					   struct mu_auth_data *auth,
 					   char *fwfile);
+
+/* Scripting support */
+typedef int (*maidag_script_fun) (mu_message_t msg,
+				  struct mu_auth_data *auth,
+				  const char *prog);
+
+extern maidag_script_fun script_handler;
+
+struct maidag_script
+{
+  maidag_script_fun fun;   /* Handler function */
+  const char *pat;         /* Script name pattern */
+};
+
+maidag_script_fun script_lang_handler (const char *lang);
+maidag_script_fun script_suffix_handler (const char *name);
+int script_register (const char *pattern);
+int script_apply (mu_message_t msg, struct mu_auth_data *auth);
+
+/* guile.c */
+extern int debug_guile;
+int scheme_check_msg (mu_message_t msg, struct mu_auth_data *auth,
+		      const char *prog);
+
+/* sieve.c */
+int sieve_check_msg (mu_message_t msg, struct mu_auth_data *auth,
+		     const char *prog);
+
diff --git a/maidag/script.c b/maidag/script.c
index c193a60..a5d5d89 100644
--- a/maidag/script.c
+++ b/maidag/script.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2005,
-   2007 Free Software Foundation, Inc.
+   2007, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -19,129 +19,149 @@
 
 #include "maidag.h"
 
+struct script_tab
+{
+  char *lang;
+  char *suf;
+  maidag_script_fun fun;
+};
+
+struct script_tab script_tab[] = {
+  { "sieve",  "sv\0siv\0sieve\0", sieve_check_msg },
 #ifdef WITH_GUILE
-#include <mailutils/guile.h>
+  { "scheme", "scm\0", scheme_check_msg },
+#endif
+  { NULL }
+};
 
-int debug_guile;
+maidag_script_fun
+script_lang_handler (const char *lang)
+{
+  struct script_tab *p;
 
-SCM mda_catch_body (void *data, mu_mailbox_t mbox);
-SCM mda_catch_handler (void *unused, SCM tag, SCM throw_args);
-int mda_next (void *data, mu_mailbox_t mbox);
-int mda_exit (void *data, mu_mailbox_t mbox);
-int mda_init (void *data);
+  for (p = script_tab; p->lang; p++)
+    if (strcmp (p->lang, lang) == 0)
+      return p->fun;
+  return NULL;
+}
 
-int
-prog_mda (struct mda_data *data)
+maidag_script_fun
+script_suffix_handler (const char *name)
 {
-  char *x_argv[2];
-  mu_guimb_param_t param;
+  struct script_tab *p;
+  char *suf;
   
-  x_argv[0] = "maidag";
-  x_argv[1] = NULL;
-
-  param.debug_guile = debug_guile;
-  param.mbox = data->mbox;
-  param.user_name = NULL;
-  param.init = mda_init;
-  param.catch_body = mda_catch_body;
-  param.catch_handler = mda_catch_handler;
-  param.next = mda_next;
-  param.exit = mda_exit;
-  param.data = data;
+  suf = strrchr (name, '.');
+  if (!suf)
+    return NULL;
+  suf++;
   
-  mu_process_mailbox (1, x_argv, &param);
-  return EX_UNAVAILABLE;
-}
+  for (p = script_tab; p->lang; p++)
+    {
+      char *s;
 
-int
-mda_init (void *data)
-{
-  struct mda_data *md = data;
-  md->progfile = mu_expand_path_pattern (md->progfile_pattern, md->argv[0]);
-  return 0;
+      for (s = p->suf; *s; s += strlen (s) + 1)
+	if (strcmp (s, suf) == 0)
+	  return p->fun;
+    }
+  return NULL;
 }
 
-static void
-mda_switch_to_user (struct mda_data *md)
+
+
+int
+script_register (const char *pattern)
 {
-  struct mu_auth_data *auth = NULL;
+  maidag_script_fun fun;
+  struct maidag_script *scr;
   
-  if (md && *md->argv != NULL)
-    auth = mu_get_auth_by_name (*md->argv);
-
-  if (auth)
+  if (script_handler)
+    fun = script_handler;
+  else
     {
-      switch_user_id (auth, 1);
-      chdir (auth->dir);
-      mu_auth_data_free (auth);
+      fun = script_suffix_handler (pattern);
+      if (!fun)
+	return EINVAL;
     }
-  else
+
+  scr = malloc (sizeof (*scr));
+  if (!scr)
+    return MU_ERR_FAILURE;
+  
+  scr->fun = fun;
+  scr->pat = pattern;
+
+  if (!script_list)
     {
-      switch_user_id (auth, 0);
-      chdir ("/");
+      if (mu_list_create (&script_list))
+	return MU_ERR_FAILURE;
     }
+
+  if (mu_list_append (script_list, scr))
+    return MU_ERR_FAILURE;
+
+  return 0;
 }
 
-SCM
-mda_catch_body (void *data, mu_mailbox_t mbox)
+
+struct apply_script_closure
 {
-  struct mda_data *md = data;
-  mu_message_t mesg = NULL;
-  mu_attribute_t attr = NULL;
+  struct mu_auth_data *auth;
+  mu_message_t msg;
+};
 
-  if (access (md->progfile, R_OK))
+static int
+apply_script (void *item, void *data)
+{
+  struct maidag_script *scr = item;
+  struct apply_script_closure *clos = data;
+  char *progfile;
+  int rc;
+  
+  progfile = mu_expand_path_pattern (scr->pat, clos->auth->name);
+  if (access (progfile, R_OK))
     {
       if (debug_level > 2)
-	mu_diag_output (MU_DIAG_DEBUG, _("Access to %s failed: %m"), md->progfile);
+	mu_diag_output (MU_DIAG_DEBUG, _("Access to %s failed: %m"), progfile);
+      free (progfile);
+      return 0;
     }
-  else
+
+  rc = scr->fun (clos->msg, clos->auth, progfile);
+  free (progfile);
+
+  if (rc == 0)
     {
-      mda_switch_to_user (md);
-      scm_primitive_load (scm_makfrom0str (md->progfile));
+      mu_attribute_t attr;
+      mu_message_get_attribute (clos->msg, &attr);
+      rc = mu_attribute_is_deleted (attr);
     }
   
-  mu_mailbox_get_message (mbox, 1, &mesg);
-  mu_message_get_attribute (mesg, &attr);
-  if (mu_attribute_is_deleted (attr))
-    return SCM_BOOL_F;
-
-  mda_switch_to_user (NULL);
-  mda (md->mbox, md->argv[0]);
-  return SCM_BOOL_F;
-}
-
-SCM
-mda_catch_handler (void *data, SCM tag, SCM throw_args)
-{
-  exit_code = EX_TEMPFAIL;
-  return scm_handle_by_message_noexit ("mail.local", tag, throw_args);
+  return rc;
 }
-
-int
-mda_next (void *data, mu_mailbox_t mbox)
-{
-  struct mda_data *md = data;
-  mu_message_t mesg = NULL;
-  mu_attribute_t attr = NULL;
-
-  md->argv++;
-  if (*md->argv == NULL)
-    return 0;
-  if (md->progfile)
-    free (md->progfile);
-  md->progfile = mu_expand_path_pattern (md->progfile_pattern, *md->argv);
-
-  mu_mailbox_get_message (mbox, 1, &mesg);
-  mu_message_get_attribute (mesg, &attr);
-  mu_attribute_unset_deleted (attr);
   
-  return md->progfile != NULL;
-}
-
 int
-mda_exit (void *data, mu_mailbox_t mbox)
+script_apply (mu_message_t msg, struct mu_auth_data *auth)
 {
-  return exit_code;
+  int rc = 0;
+  
+  if (script_list)
+    {
+      mu_attribute_t attr;
+      struct apply_script_closure clos;
+
+      clos.auth = auth;
+      clos.msg = msg;
+
+      mu_message_get_attribute (msg, &attr);
+      mu_attribute_unset_deleted (attr);
+      if (switch_user_id (auth, 1) == 0)
+	{
+	  chdir (auth->dir);
+	  rc = mu_list_do (script_list, apply_script, &clos);
+	  chdir ("/");
+	  switch_user_id (auth, 0);
+	}
+    }
+  return rc;
 }
-
-#endif
diff --git a/maidag/sieve.c b/maidag/sieve.c
new file mode 100644
index 0000000..92d2443
--- /dev/null
+++ b/maidag/sieve.c
@@ -0,0 +1,115 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 1999, 2000, 2001, 2002, 2005,
+   2007, 2009 Free Software Foundation, Inc.
+
+   GNU Mailutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GNU Mailutils is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Mailutils; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+   MA 02110-1301 USA */
+
+#include "maidag.h"
+
+static int
+_sieve_debug_printer (void *unused, const char *fmt, va_list ap)
+{
+  mu_diag_vprintf (MU_DIAG_DEBUG, fmt, ap);
+  return 0;
+}
+
+static void
+_sieve_action_log (void *user_name,
+		   const mu_sieve_locus_t *locus, size_t msgno,
+		   mu_message_t msg,
+		   const char *action, const char *fmt, va_list ap)
+{
+  int pfx = 0;
+  mu_debug_t debug;
+
+  mu_diag_get_debug (&debug);
+  mu_debug_set_locus (debug, locus->source_file, locus->source_line);
+  
+  mu_diag_printf (MU_DIAG_NOTICE, _("(user %s) "), (char*) user_name);
+  if (message_id_header)
+    {
+      mu_header_t hdr = NULL;
+      char *val = NULL;
+      mu_message_get_header (msg, &hdr);
+      if (mu_header_aget_value (hdr, message_id_header, &val) == 0
+	  || mu_header_aget_value (hdr, MU_HEADER_MESSAGE_ID, &val) == 0)
+	{
+	  pfx = 1;
+	  mu_diag_printf (MU_DIAG_NOTICE, _("%s on msg %s"), action, val);
+	  free (val);
+	}
+    }
+  
+  if (!pfx)
+    {
+      size_t uid = 0;
+      mu_message_get_uid (msg, &uid);
+      mu_diag_printf (MU_DIAG_NOTICE, _("%s on msg uid %d"), action, uid);
+    }
+  
+  if (fmt && strlen (fmt))
+    {
+      mu_diag_printf (MU_DIAG_NOTICE, "; ");
+      mu_diag_vprintf (MU_DIAG_NOTICE, fmt, ap);
+    }
+  mu_diag_printf (MU_DIAG_NOTICE, "\n");
+  mu_debug_set_locus (debug, NULL, 0);
+}
+
+static int
+_sieve_parse_error (void *user_name, const char *filename, int lineno,
+		    const char *fmt, va_list ap)
+{
+  mu_debug_t debug;
+
+  mu_diag_get_debug (&debug);
+  if (filename)
+    mu_debug_set_locus (debug, filename, lineno);
+
+  mu_diag_printf (MU_DIAG_ERROR, _("(user %s) "), (char*) user_name);
+  mu_diag_vprintf (MU_DIAG_ERROR, fmt, ap);
+  mu_diag_printf (MU_DIAG_ERROR, "\n");
+  mu_debug_set_locus (debug, NULL, 0);
+  return 0;
+}
+
+int
+sieve_check_msg (mu_message_t msg, struct mu_auth_data *auth, const char *prog)
+{
+  int rc;
+  mu_sieve_machine_t mach;
+
+  rc = mu_sieve_machine_init (&mach, auth->name);
+  if (rc)
+    {
+      mu_error (_("Cannot initialize sieve machine: %s"),
+		mu_strerror (rc));
+    }
+  else
+    {
+      mu_sieve_set_debug (mach, _sieve_debug_printer);
+      mu_sieve_set_debug_level (mach, sieve_debug_flags);
+      mu_sieve_set_parse_error (mach, _sieve_parse_error);
+      if (sieve_enable_log)
+	mu_sieve_set_logger (mach, _sieve_action_log);
+	  
+      rc = mu_sieve_compile (mach, prog);
+      if (rc == 0)
+	mu_sieve_message (mach, msg);
+    }
+  return 0;
+}
+


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Wed Mar 25 05:20:56 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LmPI8-0006QX-G0
	for mharc-commit-mailutils@gnu.org; Wed, 25 Mar 2009 05:20:56 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LmPI7-0006QG-Fs
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 05:20:55 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LmPI6-0006Px-SF
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 05:20:55 -0400
Received: from [199.232.76.173] (port=42737 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LmPI6-0006Pt-Oh
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 05:20:54 -0400
Received: from savannah.gnu.org ([199.232.41.3]:46246 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LmPI6-0002Q3-9b
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 05:20:54 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LmPI4-00027I-NB
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 09:20:52 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LmPI2-00024w-RR
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 09:20:52 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 8b0317ffca0594d8769f277062a0b7eb55687add
X-Git-Newrev: c5a62c646c7d60187273ff826aec37d774b391e8
Message-Id: <E1LmPI2-00024w-RR@cvs.savannah.gnu.org>
Date: Wed, 25 Mar 2009 09:20:50 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-249-gc5a62c6
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Mar 2009 09:20:55 -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=c5a62c646c7d60187273ff826aec37d774b391e8

The branch, master has been updated
       via  c5a62c646c7d60187273ff826aec37d774b391e8 (commit)
      from  8b0317ffca0594d8769f277062a0b7eb55687add (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 c5a62c646c7d60187273ff826aec37d774b391e8
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Mar 25 11:20:40 2009 +0200

    Remove vestiges of scripts/ in Makefiles

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

Summary of changes:
 Makefile.am             |   51 ++++++++++++++++++++++------------------------
 doc/texinfo/Makefile.am |    4 +-
 2 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index d22df6d..7a6dc2e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,35 +59,32 @@ SUBDIRS = \
 
 EXTRA_DIST = COPYING.LESSER
 
-.PHONY: make-ChangeLog
-make-ChangeLog: 
-	if test -d .git; then                                           \
-	  $(top_srcdir)/scripts/gitlog-to-changelog |                   \
-            sed '/<unknown>$$/d' | fmt -s > $(distdir)/cl-t;            \
-	  echo "" >> $(distdir)/cl-t;                                 \
-	  echo "Local Variables:" >> $(distdir)/cl-t;                   \
-	  echo "mode: change-log" >> $(distdir)/cl-t;                   \
-	  echo "version-control: never"  >> $(distdir)/cl-t;            \
-	  echo "buffer-read-only: t" >> $(distdir)/cl-t;                \
-	  echo "End:" >> $(distdir)/cl-t;                               \
-	  rm -f $(distdir)/ChangeLog;                                   \
-	  mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
-	fi
-
-dist-hook: make-ChangeLog
+gen_start_date = 
+prev_change_log = 
 
 .PHONY: ChangeLog
-ChangeLog: 
-	if test -d .git; then                                           \
-	  $(top_srcdir)/scripts/gitlog-to-changelog |                   \
-            sed '/<unknown>$$/d' | fmt -s > ChangeLog;                  \
-	  echo "" >> ChangeLog;                                       \
-	  echo "Local Variables:" >> ChangeLog;                         \
-	  echo "mode: change-log" >> ChangeLog;                         \
-	  echo "version-control: never"  >> ChangeLog;                  \
-	  echo "buffer-read-only: t" >> ChangeLog;                      \
-	  echo "End:" >> ChangeLog;                                     \
-        fi
+ChangeLog:
+	@if test -d .git; then                                             \
+	  cmd=$(top_srcdir)/build-aux/gitlog-to-changelog;                 \
+	  if test -n "$(gen_start_date)"; then                             \
+	    cmd="$$cmd --since=\"$(gen_start_date)\"";                     \
+	  fi;                                                              \
+	  $$cmd |                                                          \
+            sed '/<unknown>$$/d' | fmt -s > cl-t;                          \
+          if test -n "$(prev_change_log)" && test -f "$(prev_change_log)"; \
+	  then                                                             \
+	    echo "" >> cl-t;                                               \
+	    cat "$(prev_change_log)" |                                     \
+	      sed '/^Local Variables:/,/^End:/d' >> cl-t;                  \
+	  fi;                                                              \
+	  echo "Local Variables:" >> cl-t;                                 \
+	  echo "mode: change-log" >> cl-t;                                 \
+	  echo "version-control: never"  >> cl-t;                          \
+	  echo "buffer-read-only: t" >> cl-t;                              \
+	  echo "End:" >> cl-t;                                             \
+	  rm -f ChangeLog;                                                 \
+	  mv cl-t ChangeLog;                                               \
+	fi
 
 alpha:
 	$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"`
diff --git a/doc/texinfo/Makefile.am b/doc/texinfo/Makefile.am
index b647205..2695b98 100644
--- a/doc/texinfo/Makefile.am
+++ b/doc/texinfo/Makefile.am
@@ -100,10 +100,10 @@ TEXI2DVI=texi2dvi -t '@set $(RENDITION)' -E
 # Make sure you set TEXINPUTS.
 # TEXINPUTS=/usr/share/texmf/pdftex/plain/misc/ is ok for most distributions
 
-TEXINPUTS=$(srcdir):$(top_srcdir)/scripts:$$TEXINPUTS
+TEXINPUTS=$(srcdir):$(top_srcdir)/build-aux:$$TEXINPUTS
 
 manual:
-	 TEXINPUTS=$(srcdir):$(top_srcdir)/scripts:$(TEXINPUTS) \
+	 TEXINPUTS=$(srcdir):$(top_srcdir)/build-aux:$(TEXINPUTS) \
 	 MAKEINFO="$(MAKEINFO) $(MAKEINFOFLAGS)" \
 	 TEXI2DVI="$(TEXI2DVI) -t @finalout" \
 	$(GENDOCS) $(PACKAGE) '$(PACKAGE_NAME) manual'


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Wed Mar 25 16:18:43 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LmZYh-0000wP-Jx
	for mharc-commit-mailutils@gnu.org; Wed, 25 Mar 2009 16:18:43 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LmZYg-0000wK-60
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 16:18:42 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LmZYe-0000w8-Kj
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 16:18:40 -0400
Received: from [199.232.76.173] (port=40824 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LmZYe-0000w5-G8
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 16:18:40 -0400
Received: from savannah.gnu.org ([199.232.41.3]:49799 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LmZYe-0004jw-6T
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 16:18:40 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LmZYd-0000do-3A
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 20:18:39 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LmZYa-0000dE-Kx
	for commit-mailutils@gnu.org; Wed, 25 Mar 2009 20:18:38 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 52284527e761d8b6ffa8c15196edc18e8b061356
X-Git-Newrev: 4d8141cf92b2efa977ea0f214663b79e58ba0e1b
Message-Id: <E1LmZYa-0000dE-Kx@cvs.savannah.gnu.org>
Date: Wed, 25 Mar 2009 20:18:37 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-253-g4d8141c
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 25 Mar 2009 20:18:42 -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=4d8141cf92b2efa977ea0f214663b79e58ba0e1b

The branch, master has been updated
       via  4d8141cf92b2efa977ea0f214663b79e58ba0e1b (commit)
      from  52284527e761d8b6ffa8c15196edc18e8b061356 (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 4d8141cf92b2efa977ea0f214663b79e58ba0e1b
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Mar 25 22:17:21 2009 +0200

    Remove mail.local and mail.remote, Maidag should be used instead.
    
    * mail.local: Remove.
    * mail.remote: Remove.
    * Makefile.am, configure.ac: Update.
    * doc/texinfo/mailutils.texi: Rebuild master menu.
    * doc/texinfo/programs.texi: Update.

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

Summary of changes:
 Makefile.am                |    2 -
 configure.ac               |    4 -
 doc/texinfo/mailutils.texi |    7 --
 doc/texinfo/programs.texi  |  232 +-------------------------------------------
 4 files changed, 1 insertions(+), 244 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 012eec2..9850eed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,8 +50,6 @@ SUBDIRS = \
  messages\
  comsat\
  readmsg\
- mail.local\
- mail.remote\
  dotlock\
  mh\
  movemail\
diff --git a/configure.ac b/configure.ac
index 393e5d5..453e537 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1312,10 +1312,6 @@ AC_CONFIG_FILES([Makefile
  maidag/Makefile
  mail/Makefile
  mail/testsuite/Makefile
- mail.local/Makefile
- mail.local/testsuite/Makefile
- mail.remote/Makefile
- mail.remote/testsuite/Makefile
  mailbox/Makefile
  mailbox/testsuite/Makefile
  messages/Makefile
diff --git a/doc/texinfo/mailutils.texi b/doc/texinfo/mailutils.texi
index 80f75cc..6654b91 100644
--- a/doc/texinfo/mailutils.texi
+++ b/doc/texinfo/mailutils.texi
@@ -137,8 +137,6 @@ Mailutils Programs
 * guimb::             Mailbox Scanning and Processing Language.
 
 * maidag::            General-purpose Mail Delivery Agent.
-* mail.local::        Deliver Mail to the Local Mailbox.
-* mail.remote::       Pseudo-Sendmail Interface for Mail Delivery.
 
 * mimeview::          Universal File Viewer.
 
@@ -283,11 +281,6 @@ Maidag Scripting
 * Sieve Maidag Filters::
 * Scheme Maidag Filters::
 
-@command{mail.local} --- Deliver Mail to the Local UNIX Mailbox
-
-* Invocation::     Mail.local options
-* Mail.local Config::
-
 mimeview
 
 * Mimeview Invocation::
diff --git a/doc/texinfo/programs.texi b/doc/texinfo/programs.texi
index aa3758a..b18e5fa 100644
--- a/doc/texinfo/programs.texi
+++ b/doc/texinfo/programs.texi
@@ -33,8 +33,6 @@ syntax.
 * guimb::             Mailbox Scanning and Processing Language.
 
 * maidag::            General-purpose Mail Delivery Agent.
-* mail.local::        Deliver Mail to the Local Mailbox.
-* mail.remote::       Pseudo-Sendmail Interface for Mail Delivery.
 
 * mimeview::          Universal File Viewer.
 
@@ -4667,7 +4665,7 @@ Set debugging level
 @end table            
 
 The Scheme programs produced by @command{sieve.scm} can be used with
-@command{guimb} or @command{mail.local}.
+@command{guimb} or @command{maidag}.
 
 @c ***********************************************************************
 
@@ -5441,234 +5439,6 @@ Reuse existing address (@acronym{LMTP} mode). Default is @samp{yes}.
 @end deffn
 
 @page
-@node mail.local
-@section @command{mail.local} --- Deliver Mail to the Local UNIX Mailbox
-@pindex mail.local
-
-@command{Mail.local} reads the standard input up to an end-of-file
-and appends the received data to the local mailboxes in @acronym{UNIX}
-mailbox format. This program is superseded by @command{maidag}
-(@pxref{maidag}) and will be decommissioned in future releases.
-
-@menu
-* Invocation::     Mail.local options
-* Mail.local Config::
-@end menu
-
-@node Invocation
-@subsection Invoking @command{mail.local}
-
-General usage of @command{mail.local} program is:
-
-@smallexample
-      mail.local [@var{option}...] @var{recipient} [@var{recipient} ...]
-@end smallexample
-
-@noindent
-If recipient part is a FQDN, @command{mail.local} will attempt to
-deliver to a virtual host. 
-
-@table @option
-@item -f @var{addr}
-@itemx --from @var{addr}
-Specify the sender's name. This option forces @command{mail.local} to
-add @samp{From } envelope to the beginning of the message. If it is
-not specified, @command{mail.local} first looks into the first line
-from the standard input. If it starts with @samp{From }, it is assumed
-to contain a valid envelope. If it does not, @command{mail.local}
-creates the envelope by using current user name and date.
-@item -q
-@itemx --quota-db @var{file}
-Specify path to DBM mailbox quota database (@pxref{Mailbox Quotas}). 
-
-@item --quota-query
-Specify SQL query that should be used to obtain user mailbox
-quotas from the SQL database (@pxref{Mailbox Quotas}).
-
-@item -s @var{pattern}
-@itemx --source @var{pattern}
-Set name pattern for user-defined mail filters written in Scheme. The
-metacharacters @samp{%u} and @samp{%h} in the pattern are expanded to
-the current recipient user name and home directory correspondingly.
-
-This option is available only if the package has been configured to
-use Guile extension language.
-@item -S @var{pattern}
-@itemx --sieve @var{pattern}
-Set name pattern for user-defined mail filters written is Sieve. The
-metacharacters @samp{%u} and @samp{%h} in the pattern are expanded to
-the current recipient user name and home directory correspondingly.
-@item -t @var{number}
-@itemx --timeout @var{number}
-Wait @var{number} seconds for acquiring the lockfile. If it doesn't
-become available after that amount of time, return failure. The timeout
-defaults to 5 minutes.
-@item -x @var{flags}
-@itemx --debug @var{flags}
-Enable debugging. The debugging information will be output using syslog.
-The @var{flags} is a string consisting of the following flags:
-Debug flags are:
-
-@table @samp
-@item g
-Start with guile debugging evaluator and backtraces. This is convenient
-for debugging user-defined filters.
-
-@item T
-Enable libmailutil traces (@code{MU_DEBUG_TRACE}).
-
-@item P
-Enable network protocol traces (@code{MU_DEBUG_PROT})
-
-@item t
-Enable sieve trace (@code{MU_SIEVE_DEBUG_TRACE})
-
-@item l
-Enable sieve action logs
-@end table
-
-The digits in the range @samp{0} -- @samp{9} used in @var{flags} set
-@command{mail.local} debugging level.
-@item -v
-@itemx --version
-Display program version and exit.
-@item --ex-multiple-delivery-success
-Don't return errors when delivering to multiple recipients.
-@item --ex-quota-tempfail
-Return temporary failure if disk or mailbox quota is exceeded. By
-default, 'service unavailable' is returned if the message exceeds
-the mailbox quota.
-@end table
-
-@node Mail.local Config
-@subsection Mail.local Configuration
-
-The behavior of mail.local is affected by the following configuration
-statements:
-
-@multitable @columnfractions 0.3 0.6
-@headitem Statement @tab Reference
-@item debug         @tab @xref{Debug Statement}.
-@item mailbox       @tab @xref{Mailbox Statement}.
-@item locking       @tab @xref{Locking Statement}.
-@item pam           @tab @xref{PAM Statement}.
-@item sql           @tab @xref{SQL Statement}.
-@item virtdomain    @tab @xref{Virtdomain Statement}.
-@item radius        @tab @xref{Radius Statement}.
-@item ldap          @tab @xref{LDAP Statement}.
-@item auth          @tab @xref{Auth Statement}.
-@item mailer        @tab @xref{Mailer Statement}.
-@end multitable
-
-Additionally, @command{mail.local} defines the following configuration
-statements for its use:
-
-@deffn {Mail.local Config} ex-multiple-delivery-success @var{bool}
-In case of multiple delivery, exit with code 0 if at least one
-delivery has succeeded.
-@end deffn
-
-@deffn {Mail.local Config} ex-quota-tempfail @var{bool}
-Indicate temporary failure if the recipient is over his mail quota.
-By default, permanent failure is returned.
-@end deffn
-
-@deffn {Mail.local Config} quota-db @var{file}
-Set the name of DBM quota database file.
-@end deffn
-
-@deffn {Mail.local Config} sieve-filter @var{pattern}
-Set file name or name pattern of the Sieve filter file.
-
-The following meta-sequences are expanded in @var{pattern}:
-
-@table @asis
-@item ~
-@itemx %h
-Expands to the recipient home directory.
-
-@item %u
-Expands to the recipient user name.
-@end table
-@end deffn
-
-@deffn {Mail.local Config} message-id-header @var{name}
-When logging Sieve actions, identify messages by the value of this
-header.
-@end deffn
-
-@deffn {Mail.local Config} guile-filter @var{pattern}
-File name or name pattern for Guile filter file. See
-@code{sieve-filter} above, for the description if @var{pattern}.
-@end deffn
-
-@deffn {Mail.local Config} debug @var{flags}
-Set additional debugging flags. Valid flags are:
-
-@table @asis
-@item g
-Print @command{guimb} stack traces.
-
-@item t
-Enable @command{sieve} trace (@code{MU_SIEVE_DEBUG_TRACE}).
-
-@item i
-Enable @command{sieve} instructions trace
-(@code{MU_SIEVE_DEBUG_INSTR}).
-
-@item l
-Log executed Sieve actions.
-@end table
-@end deffn
-
-
-@page
-@node mail.remote
-@section @command{mail.remote} --- Pseudo-Sendmail Interface for Mail Delivery
-@pindex mail.remote
-The @command{mail.remote} utility reads the standard input, which must
-be formatted as an RFC-2822 email message, and forwards it to the
-specified remote @acronym{SMTP} server. This utility is superseded by
-@command{maidag} and will be decommissioned in future releases. For a
-description of how to use @command{maidag} for remote delivery,
-@ref{Remote Mailbox Delivery}.
-
-This section provides a short overview of the @command{mail.remote}
-utility.
-
-@smallexample
-$ mail.remote [@var{option}...] @var{rcpt} [@var{rcpt}...]
-@end smallexample
-
-Options are:
-
-@table @option
-@item -b @var{arg}
-Ignored, for compatibility with @command{sendmail}.
-
-@item -d
-@itemx --debug
-Print envelope commands in @acronym{SMTP} protocol transaction. If
-specified more than once, the data part of the protocol transaction
-is also printed.
-
-@item -f @var{addr}
-@itemx --from=@var{addr}
-Override the default from address.
-
-@item -i
-@itemx -o @var{arg}
-Ignored, for for compatibility with @command{sendmail}.
-
-@item -t
-@itemx --read-recipients
-Read recipient addresses from the message headers.
-
-@item --debug-auth
-Debug authentication functions.
-@end table
-
-@page
 @node mimeview
 @section mimeview
 @pindex mimeview


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Fri Mar 27 05:05:55 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ln80g-0008Cc-PD
	for mharc-commit-mailutils@gnu.org; Fri, 27 Mar 2009 05:05:54 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ln80e-00089i-1p
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 05:05:52 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ln80a-00084b-JH
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 05:05:51 -0400
Received: from [199.232.76.173] (port=51967 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ln80a-00084J-6P
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 05:05:48 -0400
Received: from savannah.gnu.org ([199.232.41.3]:47380 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ln80Y-0005Bk-V6
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 05:05:47 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ln80Y-0002AE-Ci
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 09:05:46 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ln80W-00029k-9T
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 09:05:46 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4d8141cf92b2efa977ea0f214663b79e58ba0e1b
X-Git-Newrev: 40fffffb6c6b5b10642428408f49bec401668f68
Message-Id: <E1Ln80W-00029k-9T@cvs.savannah.gnu.org>
Date: Fri, 27 Mar 2009 09:05:45 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-254-g40fffff
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Mar 2009 09:05:52 -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=40fffffb6c6b5b10642428408f49bec401668f68

The branch, master has been updated
       via  40fffffb6c6b5b10642428408f49bec401668f68 (commit)
      from  4d8141cf92b2efa977ea0f214663b79e58ba0e1b (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 40fffffb6c6b5b10642428408f49bec401668f68
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Mar 27 10:40:42 2009 +0200

    Finish removing mail.local and mail.remote

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

Summary of changes:
 README                                      |    2 +-
 doc/texinfo/mailutils.texi                  |    2 -
 guimb/scm/README                            |    4 +-
 mail.local/.gitignore                       |    6 -
 mail.local/Makefile.am                      |   47 --
 mail.local/mail.local.h                     |  129 ---
 mail.local/mailquota.c                      |  298 -------
 mail.local/main.c                           | 1113 ---------------------------
 mail.local/script.c                         |  147 ----
 mail.local/testsuite/.gitignore             |    7 -
 mail.local/testsuite/Data                   |   45 --
 mail.local/testsuite/Makefile.am            |   90 ---
 mail.local/testsuite/lib/DISTFILES          |    1 -
 mail.local/testsuite/lib/mail.local.exp     |   99 ---
 mail.local/testsuite/mail.local/DISTFILES   |    1 -
 mail.local/testsuite/mail.local/deliver.exp |   97 ---
 mail.remote/.gitignore                      |   10 -
 mail.remote/Makefile.am                     |   35 -
 mail.remote/mail.remote.c                   |  294 -------
 mail.remote/testsuite/.gitignore            |    7 -
 mail.remote/testsuite/Data                  |  205 -----
 mail.remote/testsuite/Makefile.am           |   91 ---
 mail.remote/testsuite/lib/DISTFILES         |    1 -
 mail.remote/testsuite/lib/mail.remote.exp   |  104 ---
 mail.remote/testsuite/mail.remote/DISTFILES |    1 -
 mail.remote/testsuite/mail.remote/send.exp  |   93 ---
 mu-aux/mailutils.spec.in                    |    4 +-
 po/POTFILES.in                              |    6 -
 28 files changed, 5 insertions(+), 2934 deletions(-)
 delete mode 100644 mail.local/.gitignore
 delete mode 100644 mail.local/Makefile.am
 delete mode 100644 mail.local/mail.local.h
 delete mode 100644 mail.local/mailquota.c
 delete mode 100644 mail.local/main.c
 delete mode 100644 mail.local/script.c
 delete mode 100644 mail.local/testsuite/.gitignore
 delete mode 100644 mail.local/testsuite/Data
 delete mode 100644 mail.local/testsuite/Makefile.am
 delete mode 100644 mail.local/testsuite/lib/DISTFILES
 delete mode 100644 mail.local/testsuite/lib/mail.local.exp
 delete mode 100644 mail.local/testsuite/mail.local/DISTFILES
 delete mode 100644 mail.local/testsuite/mail.local/deliver.exp
 delete mode 100644 mail.remote/.gitignore
 delete mode 100644 mail.remote/Makefile.am
 delete mode 100644 mail.remote/mail.remote.c
 delete mode 100644 mail.remote/testsuite/.gitignore
 delete mode 100644 mail.remote/testsuite/Data
 delete mode 100644 mail.remote/testsuite/Makefile.am
 delete mode 100644 mail.remote/testsuite/lib/DISTFILES
 delete mode 100644 mail.remote/testsuite/lib/mail.remote.exp
 delete mode 100644 mail.remote/testsuite/mail.remote/DISTFILES
 delete mode 100644 mail.remote/testsuite/mail.remote/send.exp

diff --git a/README b/README
index fe4649d..d774bd5 100644
--- a/README
+++ b/README
@@ -244,7 +244,7 @@ mailutils-specific configuration options:
 
 The following options enable DBM support in Mailutils. DBM support is
 necessary if you wish to use APOP authentication in POP3 daemon or to
-use DBM-based mail box quotas with mail.local.
+use DBM-based mail box quotas with maildag.
 
     --with-gdbm
 
diff --git a/doc/texinfo/mailutils.texi b/doc/texinfo/mailutils.texi
index 6654b91..d86ede3 100644
--- a/doc/texinfo/mailutils.texi
+++ b/doc/texinfo/mailutils.texi
@@ -42,8 +42,6 @@
 * sieve: (mailutils)sieve.              Mail Filtering Utility.
 * mimeview: (mailutils)mimeview.        View MIME Messages.
 * mailutils-config: (mailutils)mailutils-config. List Information about Mailutils.
-* mail.local: (mailutils)mail.local.    Deliver Mail to UNIX Mailboxes.
-* mail.remote: (mailutils)mail.remote. Forward Mail to Remote Machine.
 @end direntry
 @end ifinfo
 
diff --git a/guimb/scm/README b/guimb/scm/README
index 9de7cfa..2544657 100644
--- a/guimb/scm/README
+++ b/guimb/scm/README
@@ -12,8 +12,8 @@ mailbox.
   To invoke the script directly by its name, add executable bit to its 
 permissions. 
 
-  The same script may be used by mail.local to sieve the incoming mail upon
-its arrival, see node "Programs -> mail.local" in the accompanying 
+  The same script may be used by maidag to sieve the incoming mail upon
+its arrival, see node "Programs -> maidag" in the accompanying 
 documentation for more information on this.
 
   To execute the sieve script directly, without saving the produced Scheme
diff --git a/mail.local/.gitignore b/mail.local/.gitignore
deleted file mode 100644
index 53674be..0000000
--- a/mail.local/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-mail.local
-.deps
-.libs
-.gdbinit
diff --git a/mail.local/Makefile.am b/mail.local/Makefile.am
deleted file mode 100644
index a3250e3..0000000
--- a/mail.local/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-## Process this file with GNU Automake to create Makefile.in
-
-##   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
-##
-##   GNU Mailutils is free software; you can redistribute it and/or
-##   modify it under the terms of the GNU General Public License as
-##   published by the Free Software Foundation; either version 3, or (at
-##   your option) any later version.
-##
-##   This program is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-##   General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with this program; if not, write to the Free Software
-##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
-##   02110-1301 USA
-
-INCLUDES = -I${top_srcdir} @MU_COMMON_INCLUDES@ @GUILE_INCLUDES@ 
-SUBDIRS = testsuite
-
-libexec_PROGRAMS = mail.local
-mail_local_SOURCES = main.c mailquota.c script.c mail.local.h
-
-mail_local_LDADD = \
- @LIBMU_SCM@ @GUILE_LIBS@\
- @LIBMU_SCM_DEPS@\
- ${MU_APP_LIBRARIES}\
- ${MU_LIB_SIEVE}\
- ${MU_LIB_MBOX}\
- ${MU_LIB_IMAP}\
- ${MU_LIB_POP}\
- ${MU_LIB_NNTP}\
- ${MU_LIB_MH}\
- ${MU_LIB_MAILDIR}\
- ${MU_LIB_AUTH}\
- ${MU_LIB_MAILER}\
- @MU_AUTHLIBS@\
- ${MU_LIB_MAILUTILS} \
- @MU_COMMON_LIBRARIES@
-
-install-exec-hook:
-	for i in $(libexec_PROGRAMS); do\
-		chown root:mail $(DESTDIR)$(libexecdir)/$$i;\
-		chmod 4755 $(DESTDIR)$(libexecdir)/$$i;\
-	done
diff --git a/mail.local/mail.local.h b/mail.local/mail.local.h
deleted file mode 100644
index c53c4fd..0000000
--- a/mail.local/mail.local.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2002, 2005, 
-   2007  Free Software Foundation, Inc.
-
-   GNU Mailutils is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   GNU Mailutils is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GNU Mailutils; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301 USA */
-
-#if defined(HAVE_CONFIG_H)
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <errno.h>
-#include <grp.h>
-#include <netdb.h>
-#include <pwd.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <unistd.h>
-
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-
-#ifdef HAVE_SYSEXITS_H
-# include <sysexits.h>
-#else
-# define EX_OK          0       /* successful termination */
-# define EX__BASE       64      /* base value for error messages */
-# define EX_USAGE       64      /* command line usage error */
-# define EX_DATAERR     65      /* data format error */
-# define EX_NOINPUT     66      /* cannot open input */
-# define EX_NOUSER      67      /* addressee unknown */
-# define EX_NOHOST      68      /* host name unknown */
-# define EX_UNAVAILABLE 69      /* service unavailable */
-# define EX_SOFTWARE    70      /* internal software error */
-# define EX_OSERR       71      /* system error (e.g., can't fork) */
-# define EX_OSFILE      72      /* critical OS file missing */
-# define EX_CANTCREAT   73      /* can't create (user) output file */
-# define EX_IOERR       74      /* input/output error */
-# define EX_TEMPFAIL    75      /* temp failure; user is invited to retry */
-# define EX_PROTOCOL    76      /* remote error in protocol */
-# define EX_NOPERM      77      /* permission denied */
-# define EX_CONFIG      78      /* configuration error */
-# define EX__MAX        78      /* maximum listed value */
-#endif
-
-#ifndef INADDR_LOOPBACK
-# define INADDR_LOOPBAK 0x7f000001
-#endif
-
-#include <mailutils/attribute.h>
-#include <mailutils/errno.h>
-#include <mailutils/error.h>
-#include <mailutils/list.h>
-#include <mailutils/locker.h>
-#include <mailutils/mailbox.h>
-#include <mailutils/message.h>
-#include <mailutils/mutil.h>
-#include <mailutils/registrar.h>
-#include <mailutils/stream.h>
-#include <mailutils/url.h>
-#include <mailutils/mu_auth.h>
-#include <mailutils/sieve.h>
-#include <mailutils/nls.h>
-
-#include <mu_dbm.h>
-#include <mu_asprintf.h>
-
-#if defined (USE_DBM) || defined (USE_SQL)
-# define USE_MAILBOX_QUOTAS 1
-#endif
-
-/* Debug */
-extern int debug_level;
-#define dbg() if (debug_level) debug
-
-/* mailquota settings */
-#define MQUOTA_OK         0
-#define MQUOTA_EXCEEDED   1
-#define MQUOTA_UNLIMITED  2
-
-extern char *quotadbname;
-extern char *quota_query;
-extern int exit_code;
-
-extern void setgroupquota (char *str);
-extern int check_quota (struct mu_auth_data *auth,
-			mu_off_t size, mu_off_t *rest);
-
-int mda (mu_mailbox_t mbx, char *username);
-int switch_user_id (struct mu_auth_data *auth, int user);
-void mailer_err (const char *msg, const char *arg, const char *fmt, ...)
-     MU_PRINTFLIKE(3,4);
-
-#ifdef WITH_GUILE
-struct mda_data
-{
-  mu_mailbox_t mbox;
-  char *progfile;
-  char *progfile_pattern;
-  char **argv;
-};
-
-int prog_mda (struct mda_data *data);
-
-extern int debug_guile;
-#endif
-
diff --git a/mail.local/mailquota.c b/mail.local/mailquota.c
deleted file mode 100644
index 319441c..0000000
--- a/mail.local/mailquota.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2002, 2004,
-   2005, 2007 Free Software Foundation, Inc.
-
-   GNU Mailutils is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   GNU Mailutils is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GNU Mailutils; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301 USA */
-
-#include <mail.local.h>
-
-#if defined (USE_MAILBOX_QUOTAS)
-
-#define DEFRETVAL MQUOTA_UNLIMITED
-
-mu_off_t groupquota = 5*1024*1024UL;
-static int get_size (char *, mu_off_t *, char **);
-
-int
-get_size (char *str, mu_off_t *size, char **endp)
-{
-  mu_off_t s;
-
-  s = strtol (str, &str, 0);
-  switch (*str)
-    {
-    case 0:
-      break;
-      
-    case 'k':
-    case 'K':
-      s *= 1024;
-      break;
-      
-    case 'm':
-    case 'M':
-      s *= 1024*1024;
-      break;
-      
-    default:
-      *endp = str;
-      return -1;
-    }
-  *size = s;
-  return 0;
-}
-
-#define RETR_OK        0
-#define RETR_UNLIMITED -1
-#define RETR_FAILURE   1
-
-int
-fail_retrieve_quota (char *name, mu_off_t *quota)
-{
-  mu_error (_("No quota retrieving mechanism"));
-  return RETR_FAILURE;
-}
-
-#ifdef USE_DBM
-int
-dbm_retrieve_quota (char *name, mu_off_t *quota)
-{
-  DBM_FILE db;
-  DBM_DATUM named, contentd;
-  char buffer[64];
-  int unlimited = 0;
-  int rc;
-
-  if (!quotadbname)
-    return RETR_FAILURE;
-  
-  if (mu_dbm_open (quotadbname, &db, MU_STREAM_READ, 0600))
-    {
-      mu_error (_("Cannot open %s: %s"), quotadbname, mu_strerror (errno));
-      return RETR_FAILURE;
-    }
-  
-  memset (&named, 0, sizeof named);
-  memset (&contentd, 0, sizeof contentd);
-  MU_DATUM_PTR (named) = name;
-  MU_DATUM_SIZE (named) = strlen (name);
-  rc = mu_dbm_fetch (db, named, &contentd);
-  if (rc || !MU_DATUM_PTR (contentd))
-    {
-      /* User not in database, try default quota */
-      memset (&named, 0, sizeof named);
-      MU_DATUM_PTR (named) = "DEFAULT";
-      MU_DATUM_SIZE (named) = strlen ("DEFAULT");
-      rc = mu_dbm_fetch (db, named, &contentd);
-      if (rc)
-	{
-	  /*mu_error (_("can't fetch data: %s"), strerror (rc));*/
-	  return RETR_FAILURE;
-	}
-      if (!MU_DATUM_PTR (contentd))
-	return RETR_FAILURE;
-    }
-
-  if (strncasecmp("none",
-		  MU_DATUM_PTR (contentd),
-		  MU_DATUM_SIZE (contentd)) == 0) 
-      unlimited = 1;
-  else if (MU_DATUM_SIZE (contentd) > sizeof(buffer)-1)
-    {
-      mu_error (ngettext ("Mailbox quota for `%s' is too big: %d digit",
-			  "Mailbox quota for `%s' is too big: %d digits",
-			  MU_DATUM_SIZE (contentd)),
-		name, MU_DATUM_SIZE (contentd));
-      *quota = groupquota;
-    }
-  else
-    {
-      char *p;
-		
-      strncpy(buffer, MU_DATUM_PTR (contentd), MU_DATUM_SIZE (contentd));
-      buffer[MU_DATUM_SIZE (contentd)] = 0;
-      *quota = strtoul (buffer, &p, 0);
-      if (get_size (buffer, quota, &p))
-	{
-	  mu_error (_("Bogus mailbox quota for `%s' (near `%s')"), name, p);
-	  *quota = groupquota;
-	}
-    }
-
-  mu_dbm_close (db);
-  
-  return unlimited ? RETR_UNLIMITED : RETR_OK;
-}
-
-# define default_retrieve_quota dbm_retrieve_quota
-#else
-# define default_retrieve_quota fail_retrieve_quota
-#endif
-
-#ifdef USE_SQL
-#include <mailutils/sql.h>
-
-/* FIXME: defined in libmu_auth/sql.c */
-#include <libmu_auth/sql.h>
-
-int
-sql_retrieve_quota (char *name, mu_off_t *quota)
-{
-  mu_sql_connection_t conn;
-  char *query_str;
-  int rc, status;
-  char *tmp;
-  size_t n;
-  
-  query_str = mu_sql_expand_query (quota_query, name);
-  if (!query_str)
-    return RETR_FAILURE;
-
-  status = mu_sql_connection_init (&conn,
-				   mu_sql_module_config.interface,
-				   mu_sql_module_config.host,
-				   mu_sql_module_config.port,
-				   mu_sql_module_config.user,
-				   mu_sql_module_config.passwd,
-				   mu_sql_module_config.db);
-  
-  if (status)
-    {
-      mu_error ("%s. SQL error: %s",
-		mu_strerror (status), mu_sql_strerror (conn));
-      mu_sql_connection_destroy (&conn);
-      free (query_str);
-      return RETR_FAILURE;
-    }
-
-  status = mu_sql_connect (conn);
-
-  if (status)
-    {
-      mu_error ("%s. SQL error: %s",
-		mu_strerror (status), mu_sql_strerror (conn));
-      mu_sql_connection_destroy (&conn);
-      free (query_str);
-      return  RETR_FAILURE;
-    }
-  
-  status = mu_sql_query (conn, query_str);
-  free (query_str);
-  
-  if (status)
-    {
-      mu_error (_("SQL Query failed: %s"),
-		(status == MU_ERR_SQL) ?  mu_sql_strerror (conn) :
-	 	                          mu_strerror (status));
-      mu_sql_connection_destroy (&conn);
-      return  RETR_FAILURE;
-    }
-
-  status = mu_sql_store_result (conn);
-
-  if (status)
-    {
-      mu_error (_("Cannot store SQL result: %s"),
-		(status == MU_ERR_SQL) ?  mu_sql_strerror (conn) :
-	 	                          mu_strerror (status));
-      mu_sql_connection_destroy (&conn);
-      return RETR_FAILURE;
-    }
-
-  mu_sql_num_tuples (conn, &n);
-  if (n == 0)
-    {
-      rc = RETR_FAILURE;
-    }
-  else
-    {
-      rc = RETR_OK;
-      tmp = NULL;
-      status = mu_sql_get_column (conn, 0, 0, &tmp);
-      if (status)
-	{
-	  mu_error (_("Cannot retrieve mailbox quota from SQL: %s"),
-		    (status == MU_ERR_SQL) ?  mu_sql_strerror (conn) :
-		    mu_strerror (status));
-	  rc = RETR_FAILURE;
-	}
-      else if (tmp == NULL || tmp[0] == 0 || strcasecmp (tmp, "none") == 0)
-	rc = RETR_UNLIMITED;
-      else
-	{
-	  char *p;
-	  
-	  if (get_size (tmp, quota, &p))
-	    {
-	      mu_error (_("Bogus mailbox quota for `%s' (near `%s')"),
-			name, p);
-	      *quota = groupquota;
-	    }
-	}
-    }
-  
-  mu_sql_release_result (conn);
-  mu_sql_disconnect (conn);
-  mu_sql_connection_destroy (&conn);
-  return rc;
-}
-#endif
-
-
-static int
-retrieve_quota (struct mu_auth_data *auth, mu_off_t *quota)
-{
-  if (MU_HAS_QUOTA (auth))
-    {
-      if (auth->quota == 0)
-	return RETR_UNLIMITED;
-      *quota = auth->quota;
-      return RETR_OK;
-    }
-  
-#ifdef USE_SQL
-  if (quota_query)
-    return sql_retrieve_quota (auth->name, quota);
-#endif
-  return default_retrieve_quota (auth->name, quota);
-}
-
-int
-check_quota (struct mu_auth_data *auth, mu_off_t size, mu_off_t *rest)
-{
-  mu_off_t quota;
-  
-  switch (retrieve_quota (auth, &quota))
-    {
-    case RETR_FAILURE:
-      return DEFRETVAL;
-      
-    case RETR_UNLIMITED:
-      return MQUOTA_UNLIMITED;
-
-    case RETR_OK:
-      if (quota < size)  /* Mailbox full */
-	return MQUOTA_EXCEEDED;
-	
-      if (rest)
-	*rest = quota - size;
-    }
-  
-  return MQUOTA_OK;
-      
-}
-  
-#endif /* USE_MAIL_QUOTA */
diff --git a/mail.local/main.c b/mail.local/main.c
deleted file mode 100644
index f263e89..0000000
--- a/mail.local/main.c
+++ /dev/null
@@ -1,1113 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2002, 2005, 
-   2007, 2008 Free Software Foundation, Inc.
-
-   GNU Mailutils is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   GNU Mailutils is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GNU Mailutils; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301 USA */
-
-#include <mail.local.h>
-#include "mailutils/libargp.h"
-
-int multiple_delivery;     /* Don't return errors when delivering to multiple
-			      recipients */
-int ex_quota_tempfail;     /* Return temporary failure if mailbox quota is
-			      exceeded. If this variable is not set, mail.local
-			      will return "service unavailable" */
-int exit_code = EX_OK;     /* Exit code to be used */
-uid_t uid;                 /* Current user id */
-char *quotadbname = NULL;  /* Name of mailbox quota database */
-char *quota_query = NULL;  /* SQL query to retrieve mailbox quota */
-
-/* Debuggig options */
-int debug_level;           /* General debugging level */ 
-int debug_flags;           /* Mailutils debugging flags */
-int sieve_debug_flags;     /* Sieve debugging flags */
-int sieve_enable_log;      /* Enables logging of executed Sieve actions */
-char *message_id_header;   /* Use the value of this header as message
-			      identifier when logging Sieve actions */
-mu_debug_t mudebug;        /* Mailutils debugging object */
-
-
-#define MAXFD 64
-#define EX_QUOTA() (ex_quota_tempfail ? EX_TEMPFAIL : EX_UNAVAILABLE)
-
-void close_fds (void);
-int make_tmp (const char *from, mu_mailbox_t *mbx);
-void deliver (mu_mailbox_t msg, char *name);
-void guess_retval (int ec);
-void notify_biff (mu_mailbox_t mbox, char *name, size_t size);
-
-const char *program_version = "mail.local (" PACKAGE_STRING ")";
-static char doc[] =
-N_("GNU mail.local -- the local MDA")
-"\v"
-N_("Debug flags are:\n\
-  g - guimb stack traces\n\
-  T - mailutils traces (MU_DEBUG_TRACE0-MU_DEBUG_TRACE9)\n\
-  P - network protocols (MU_DEBUG_PROT)\n\
-  t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n\
-  i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR)\n\
-  l - sieve action logs\n\
-  0-9 - Set mail.local debugging level\n");
-
-static char args_doc[] = N_("recipient [recipient ...]");
-
-#define ARG_MULTIPLE_DELIVERY 1
-#define ARG_QUOTA_TEMPFAIL    2
-#define ARG_MESSAGE_ID_HEADER 3
-#define ARG_QUOTA_QUERY       4
-
-static struct argp_option options[] = 
-{
-  { "ex-multiple-delivery-success", ARG_MULTIPLE_DELIVERY, NULL, 0,
-    N_("Do not return errors when delivering to multiple recipients"), 0 },
-  { "ex-quota-tempfail", ARG_QUOTA_TEMPFAIL, NULL, 0,
-    N_("Return temporary failure if disk or mailbox quota is exceeded"), 0 },
-  { "from", 'f', N_("EMAIL"), 0,
-    N_("Specify the sender's name") },
-  { NULL, 'r', NULL, OPTION_ALIAS, NULL },
-#ifdef USE_DBM
-  { "quota-db", 'q', N_("FILE"), 0,
-    N_("Specify path to quota DBM database"), 0 },
-#endif
-#ifdef USE_SQL
-  { "quota-query", ARG_QUOTA_QUERY, N_("STRING"), 0,
-    N_("SQL query to retrieve mailbox quota"), 0 },
-#endif
-  { "sieve", 'S', N_("PATTERN"), 0,
-    N_("Set name pattern for user-defined Sieve mail filters"), 0 },
-  { "message-id-header", ARG_MESSAGE_ID_HEADER, N_("STRING"), 0,
-    N_("Identify messages by the value of this header when logging Sieve actions"), 0 },
-#ifdef WITH_GUILE
-  { "source", 's', N_("PATTERN"), 0,
-    N_("Set name pattern for user-defined Scheme mail filters"), 0 },
-#endif
-  { "debug", 'x', N_("FLAGS"), 0,
-    N_("Enable debugging"), 0 },
-  { NULL,      0, NULL, 0, NULL, 0 }
-};
-
-static error_t parse_opt (int key, char *arg, struct argp_state *state);
-
-static struct argp argp = {
-  options,
-  parse_opt,
-  args_doc, 
-  doc,
-  NULL,
-  NULL, NULL
-};
-
-static const char *argp_capa[] = {
-  "auth",
-  "common",
-  "debug",
-  "license",
-  "logging",
-  "mailbox",
-  "locking",
-  "mailer",
-  NULL
-};
-
-char *from = NULL;
-char *progfile_pattern = NULL;
-char *sieve_pattern = NULL;
-char *saved_envelope;  /* A hack to spare mu_envelope_ calls */
-
-#define D_DEFAULT "9s"
-
-static void
-set_debug_flags (mu_debug_t debug, const char *arg)
-{
-  for (; *arg; arg++)
-    {
-      switch (*arg)
-	{
-	case 'g':
-#ifdef WITH_GUILE
-	  debug_guile = 1;
-#endif
-	  break;
-
-	case 't':
-	  sieve_debug_flags |= MU_SIEVE_DEBUG_TRACE;
-	  break;
-	  
-	case 'i':
-	  sieve_debug_flags |= MU_SIEVE_DEBUG_INSTR;
-	  break;
-	  
-	case 'l':
-	  sieve_enable_log = 1;
-	  break;
-	  
-	case 'T':
-	  debug_flags |= MU_DEBUG_LEVEL_UPTO (MU_DEBUG_TRACE7);
-	  break;
-	  
-	case 'P':
-	  debug_flags |= MU_DEBUG_LEVEL_MASK (MU_DEBUG_PROT);
-	  break;
-
-	default:
-	  if (isdigit (*arg))
-	    debug_level = *arg - '0';
-	  else if (debug)
-	    mu_cfg_format_error (debug, MU_DEBUG_ERROR,
-				 _("%c is not a valid debug flag"),
-				 *arg);
-	  else
-	    mu_error (_("%c is not a valid debug flag"), *arg);
-	  break;
-	}
-    }
-}
-
-static error_t
-parse_opt (int key, char *arg, struct argp_state *state)
-{
-  static struct mu_argp_node_list lst;
-
-  switch (key)
-    {
-    case ARG_MULTIPLE_DELIVERY:
-      mu_argp_node_list_new (&lst, "ex-multiple-delivery-success", "yes");
-      break;
-
-    case ARG_QUOTA_TEMPFAIL:
-      mu_argp_node_list_new (&lst, "ex-quota-tempfail", "yes");
-      break;
-
-    case ARG_MESSAGE_ID_HEADER:
-      mu_argp_node_list_new (&lst, "message-id-header", arg);
-      break;
-
-    case ARG_QUOTA_QUERY:
-      mu_argp_node_list_new (&lst, "quota-query", arg);
-      break;
-      
-    case 'r':
-    case 'f':
-      if (from != NULL)
-	{
-	  argp_error (state, _("Multiple --from options"));
-	  return EX_USAGE;
-	}
-      from = arg;
-      break;
-      
-#ifdef USE_DBM
-    case 'q':
-      mu_argp_node_list_new (&lst, "quota-db", arg);
-      break;
-#endif
-
-#ifdef WITH_GUILE	
-    case 's':
-      mu_argp_node_list_new (&lst, "source", arg);
-      break;
-#endif
-
-    case 'S':
-      mu_argp_node_list_new (&lst, "sieve-filter", arg);
-      
-      break;
-      
-    case 'x':
-      mu_argp_node_list_new (&lst, "debug", arg ? arg : D_DEFAULT);
-      break;
-      
-    case ARGP_KEY_INIT:
-      mu_argp_node_list_init (&lst);
-      break;
-      
-    case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
-      break;
-      
-    default:
-      return ARGP_ERR_UNKNOWN;
-
-    case ARGP_KEY_ERROR:
-      exit (EX_USAGE);
-    }
-  return 0;
-}
-
-
-static int
-cb_debug (mu_debug_t debug, void *data, mu_config_value_t *val)
-{
-  if (mu_cfg_assert_value_type (val, MU_CFG_STRING, debug))
-    return 1;
-  set_debug_flags (debug, val->v.string);
-  return 0;
-}
-
-struct mu_cfg_param mail_local_cfg_param[] = {
-  { "ex-multiple-delivery-success", mu_cfg_bool, &multiple_delivery, 0, NULL,
-    N_("In case of multiple delivery, exit with code 0 if at least one "
-       "delivery succeeded.") },
-  { "ex-quota-tempfail", mu_cfg_bool, &ex_quota_tempfail, 0, NULL,
-    N_("Indicate temporary failure if the recipient is over his mail quota.")
-  },
-#ifdef USE_DBM
-  { "quota-db", mu_cfg_string, &quotadbname, 0, NULL,
-    N_("Name of DBM quota database file."),
-    N_("file") },
-#endif
-#ifdef USE_SQL
-  { "quota-query", mu_cfg_string, &quota_query, 0, NULL,
-    N_("SQL query to retrieve mailbox quota.  This is deprecated, use "
-       "sql { ... } instead."),
-    N_("query") },
-#endif
-  { "sieve-filter", mu_cfg_string, &sieve_pattern, 0, NULL,
-    N_("File name or name pattern for Sieve filter file."),
-    N_("file-or-pattern") },
-  { "message-id-header", mu_cfg_string, &message_id_header, 0, NULL,
-    N_("When logging Sieve actions, identify messages by the value of "
-       "this header."),
-    N_("name") },
-#ifdef WITH_GUILE
-  { "guile-filter", mu_cfg_string, &progfile_pattern, 0, NULL,
-    N_("File name or name pattern for Guile filter file."),
-    N_("file-or-pattern") },
-#endif
-  { "debug", mu_cfg_callback, NULL, 0, cb_debug,
-    N_("Set mail.local debug level.  Debug level consists of one or more "
-       "of the following letters:\n"
-       "  g - guimb stack traces\n"
-       "  t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n"
-       "  i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR)\n"
-       "  l - sieve action logs\n") },
-  { NULL }
-};
-
-
-
-static int
-_sieve_debug_printer (void *unused, const char *fmt, va_list ap)
-{
-  mu_diag_vprintf (MU_DIAG_DEBUG, fmt, ap);
-  return 0;
-}
-
-static void
-_sieve_action_log (void *user_name,
-		   const mu_sieve_locus_t *locus, size_t msgno,
-		   mu_message_t msg,
-		   const char *action, const char *fmt, va_list ap)
-{
-  int pfx = 0;
-  mu_debug_t debug;
-
-  mu_diag_get_debug (&debug);
-  mu_debug_set_locus (debug, locus->source_file, locus->source_line);
-  
-  mu_diag_printf (MU_DIAG_NOTICE, _("(user %s) "), (char*) user_name);
-  if (message_id_header)
-    {
-      mu_header_t hdr = NULL;
-      char *val = NULL;
-      mu_message_get_header (msg, &hdr);
-      if (mu_header_aget_value (hdr, message_id_header, &val) == 0
-	  || mu_header_aget_value (hdr, MU_HEADER_MESSAGE_ID, &val) == 0)
-	{
-	  pfx = 1;
-	  mu_diag_printf (MU_DIAG_NOTICE, _("%s on msg %s"), action, val);
-	  free (val);
-	}
-    }
-  
-  if (!pfx)
-    {
-      size_t uid = 0;
-      mu_message_get_uid (msg, &uid);
-      mu_diag_printf (MU_DIAG_NOTICE, _("%s on msg uid %d"), action, uid);
-    }
-  
-  if (fmt && strlen (fmt))
-    {
-      mu_diag_printf (MU_DIAG_NOTICE, "; ");
-      mu_diag_vprintf (MU_DIAG_NOTICE, fmt, ap);
-    }
-  mu_diag_printf (MU_DIAG_NOTICE, "\n");
-  mu_debug_set_locus (debug, NULL, 0);
-}
-
-static int
-_sieve_parse_error (void *user_name, const char *filename, int lineno,
-		    const char *fmt, va_list ap)
-{
-  mu_debug_t debug;
-
-  mu_diag_get_debug (&debug);
-  if (filename)
-    mu_debug_set_locus (debug, filename, lineno);
-
-  mu_diag_printf (MU_DIAG_NOTICE, _("(user %s) "), (char*) user_name);
-  mu_diag_vprintf (MU_DIAG_NOTICE, fmt, ap);
-  mu_diag_printf (MU_DIAG_NOTICE, "\n");
-  mu_debug_set_locus (debug, NULL, 0);
-  return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
-  mu_mailbox_t mbox = NULL;
-  int arg_index;
-  
-  /* Preparative work: close inherited fds, force a reasonable umask
-     and prepare a logging. */
-  close_fds ();
-  umask (0077);
-
-  /* Native Language Support */
-  MU_APP_INIT_NLS ();
-
-  /* Default locker settings */
-  mu_locker_set_default_flags (MU_LOCKER_PID|MU_LOCKER_RETRY,
-			       mu_locker_assign);
-  mu_locker_set_default_retry_timeout (1);
-  mu_locker_set_default_retry_count (300);
-
-  /* Register needed modules */
-  MU_AUTH_REGISTER_ALL_MODULES();
-  /* Parse command line */
-  mu_gocs_register ("sieve", mu_sieve_module_init);
-  mu_argp_init (program_version, NULL);
-  if (mu_app_init (&argp, argp_capa, mail_local_cfg_param,
-		   argc, argv, 0, &arg_index, NULL))
-    exit (EX_CONFIG);
-
-  uid = getuid ();
-
-  if (uid == 0)
-    {
-      mu_debug_t debug;
-      openlog (MU_LOG_TAG (), LOG_PID, mu_log_facility);
-      mu_diag_get_debug (&debug);
-      mu_debug_set_print (debug, mu_diag_syslog_printer, NULL);
-    }
-  
-  if (debug_flags)
-    {
-      int rc;
-      
-      if ((rc = mu_debug_create (&mudebug, NULL)))
-	{
-	  mu_error (_("mu_debug_create failed: %s\n"), mu_strerror (rc));
-	  exit (EX_TEMPFAIL);
-	}
-      if ((rc = mu_debug_set_level (mudebug, debug_flags)))
-	{
-	  mu_error (_("mu_debug_set_level failed: %s\n"),
-		    mu_strerror (rc));
-	  exit (EX_TEMPFAIL);
-	}
-    }
-  
-  argc -= arg_index;
-  argv += arg_index;
-
-  if (!argc)
-    {
-      if (uid)
-	{
-	  static char *s_argv[2];
-	  struct mu_auth_data *auth = mu_get_auth_by_uid (uid);
-
-	  if (!uid)
-	    {
-	      mu_error (_("Cannot get username"));
-	      return EX_UNAVAILABLE;
-	    }
-	    
-	  s_argv[0] = auth->name;
-	  argv = s_argv;
-	  argc = 1;
-	}
-      else
-	{
-	  mu_error (_("Missing arguments. Try --help for more info."));
-	  return EX_USAGE;
-	}
-    }
-
-  mu_register_all_formats ();
-  /* Possible supported mailers.  */
-  mu_registrar_record (mu_sendmail_record);
-  mu_registrar_record (mu_smtp_record);
-
-  if (make_tmp (from, &mbox))
-    exit (exit_code);
-  
-  if (multiple_delivery)
-    multiple_delivery = argc > 1;
-
-#ifdef WITH_GUILE
-  if (progfile_pattern)
-    {
-      struct mda_data mda_data;
-      
-      memset (&mda_data, 0, sizeof mda_data);
-      mda_data.mbox = mbox;
-      mda_data.argv = argv;
-      mda_data.progfile_pattern = progfile_pattern;
-      return prog_mda (&mda_data);
-    }
-#endif
-  
-  for (; *argv; argv++)
-    mda (mbox, *argv);
-  return exit_code;
-}
-
-int
-sieve_test (struct mu_auth_data *auth, mu_mailbox_t mbx)
-{
-  int rc = 1;
-  char *progfile;
-    
-  if (!sieve_pattern)
-    return 1;
-
-  progfile = mu_expand_path_pattern (sieve_pattern, auth->name);
-  if (access (progfile, R_OK))
-    {
-      if (debug_level > 2)
-	mu_diag_output (MU_DIAG_DEBUG, _("Access to %s failed: %m"), progfile);
-    }
-  else
-    {
-      mu_sieve_machine_t mach;
-      rc = mu_sieve_machine_init (&mach, auth->name);
-      if (rc)
-	{
-	  mu_error (_("Cannot initialize sieve machine: %s"),
-		    mu_strerror (rc));
-	}
-      else
-	{
-	  mu_sieve_set_debug (mach, _sieve_debug_printer);
-	  mu_sieve_set_debug_object (mach, mudebug);
-	  mu_sieve_set_debug_level (mach, sieve_debug_flags);
-	  mu_sieve_set_parse_error (mach, _sieve_parse_error);
-	  if (sieve_enable_log)
-	    mu_sieve_set_logger (mach, _sieve_action_log);
-	  
-	  rc = mu_sieve_compile (mach, progfile);
-	  if (rc == 0)
-	    {
-	      mu_attribute_t attr;
-	      mu_message_t msg = NULL;
-		
-	      mu_mailbox_get_message (mbx, 1, &msg);
-	      mu_message_get_attribute (msg, &attr);
-	      mu_attribute_unset_deleted (attr);
-	      if (switch_user_id (auth, 1) == 0)
-		{
-		  chdir (auth->dir);
-		
-		  rc = mu_sieve_message (mach, msg);
- 		  if (rc == 0)
-		    rc = mu_attribute_is_deleted (attr) == 0;
-
-		  switch_user_id (auth, 0);
-		  chdir ("/");
-		}
-	      mu_sieve_machine_destroy (&mach);
-	    }
-	}
-    }
-  free (progfile);
-  return rc;
-}
-
-int
-mda (mu_mailbox_t mbx, char *username)
-{
-  deliver (mbx, username);
-
-  if (multiple_delivery)
-    exit_code = EX_OK;
-
-  return exit_code;
-}
-
-void
-close_fds ()
-{
-  int i;
-  long fdlimit = MAXFD;
-
-#if defined (HAVE_SYSCONF) && defined (_SC_OPEN_MAX)
-  fdlimit = sysconf (_SC_OPEN_MAX);
-#elif defined (HAVE_GETDTABLESIZE)
-  fdlimit = getdtablesize ();
-#endif
-
-  for (i = 3; i < fdlimit; i++)
-    close (i);
-}
-
-int
-switch_user_id (struct mu_auth_data *auth, int user)
-{
-  int rc;
-  uid_t uid;
-  
-  if (!auth || auth->change_uid == 0)
-    return 0;
-  
-  if (user)
-    uid = auth->uid;
-  else
-    uid = 0;
-  
-#if defined(HAVE_SETREUID)
-  rc = setreuid (0, uid);
-#elif defined(HAVE_SETRESUID)
-  rc = setresuid (-1, uid, -1);
-#elif defined(HAVE_SETEUID)
-  rc = seteuid (uid);
-#else
-# error "No way to reset user privileges?"
-#endif
-  if (rc < 0)
-    mailer_err ("cannot set user priviledes", auth->name,
-		"setreuid(0, %d): %s (r=%d, e=%d)",
-		uid, strerror (errno), getuid (), geteuid ());
-  return rc;
-}
-
-static int
-tmp_write (mu_stream_t stream, mu_off_t *poffset, char *buf, size_t len)
-{
-  size_t n = 0;
-  int status = mu_stream_write (stream, buf, len, *poffset, &n);
-  if (status == 0 && n != len)
-    status = EIO;
-  *poffset += n;
-  return status;
-}
-
-int
-make_tmp (const char *from, mu_mailbox_t *mbox)
-{
-  mu_stream_t stream;
-  char *buf = NULL;
-  size_t n = 0;
-  mu_off_t offset = 0;
-  size_t line;
-  int status;
-  static char *newline = "\n";
-  char *tempfile;
-  
-  tempfile = mu_tempname (NULL);
-  if ((status = mu_file_stream_create (&stream, tempfile, MU_STREAM_RDWR)))
-    {
-      mailer_err ("Temporary failure", NULL,
-		  _("Unable to open temporary file: %s"),
-		  mu_strerror (status));
-      exit (exit_code);
-    }
-
-  if ((status = mu_stream_open (stream)))
-    {
-      mailer_err ("Temporary failure", NULL,
-		  _("unable to open temporary file: %s"), mu_strerror (status));
-      exit (exit_code);
-    }
-  
-  line = 0;
-  while (getline (&buf, &n, stdin) > 0)
-    {
-      line++;
-      if (line == 1)
-	{
-	  if (memcmp (buf, "From ", 5))
-	    {
-	      struct mu_auth_data *auth = NULL;
-	      if (!from)
-		{
-		  auth = mu_get_auth_by_uid (uid);
-		  if (auth)
-		    from = auth->name;
-		}
-	      if (from)
-		{
-		  time_t t;
-		  
-		  time (&t);
-		  asprintf (&saved_envelope, "From %s %s", from, ctime (&t));
-		  status = tmp_write (stream, &offset, saved_envelope,
-				      strlen (saved_envelope));
-		}
-	      else
-		{
-		  mailer_err ("Cannot determine sender address", NULL,
-			      _("Cannot determine sender address"));
-		  exit (EX_UNAVAILABLE);
-		}
-	      if (auth)
-		mu_auth_data_free (auth);
-	    }
-	  else
-	    {
-	      saved_envelope = strdup (buf);
-	      if (!saved_envelope)
-		status = ENOMEM;
-	    }
-	}
-      else if (!memcmp (buf, "From ", 5))
-	{
-	  static char *escape = ">";
-	  status = tmp_write (stream, &offset, escape, 1);
-	}
-
-      if (!status)
-	status = tmp_write (stream, &offset, buf, strlen (buf));
-      
-      if (status)
-	{
-	  mailer_err ("Temporary failure", NULL,
-		      _("Error writing temporary file: %s"),
-		      mu_strerror (status));
-	  mu_stream_destroy (&stream, mu_stream_get_owner (stream));
-	  return status;
-	}
-    }
-  
-  if (buf && strchr (buf, '\n') == NULL)
-    status = tmp_write (stream, &offset, newline, 1);
-
-  status = tmp_write (stream, &offset, newline, 1);
-  free (buf);
-  unlink (tempfile);
-  free (tempfile);
-  
-  if (status)
-    {
-      errno = status;
-      mailer_err ("Error writing temporary file", NULL,
-		  _("Error writing temporary file: %s"), mu_strerror (status));
-      mu_stream_destroy (&stream, mu_stream_get_owner (stream));
-      return status;
-    }
-
-  mu_stream_flush (stream);
-  if ((status = mu_mailbox_create (mbox, "/dev/null")) 
-      || (status = mu_mailbox_open (*mbox, MU_STREAM_READ))
-      || (status = mu_mailbox_set_stream (*mbox, stream)))
-    {
-      mailer_err ("Error opening temporary file", NULL,
-		  _("Error opening temporary file: %s"),
-		  mu_strerror (status));
-      mu_stream_destroy (&stream, mu_stream_get_owner (stream));
-      return status;
-    }
-
-  status = mu_mailbox_messages_count (*mbox, &n);
-  if (status)
-    {
-      errno = status;
-      mailer_err ("Error collecting message", NULL,
-		  _("Error creating temporary message: %s"),
-		  mu_strerror (status));
-      mu_stream_destroy (&stream, mu_stream_get_owner (stream));
-      return status;
-    }
-
-  return status;
-}
-
-void
-deliver (mu_mailbox_t imbx, char *name)
-{
-  mu_mailbox_t mbox;
-  mu_message_t msg;
-  char *path;
-  mu_url_t url = NULL;
-  mu_locker_t lock;
-  struct mu_auth_data *auth;
-  int status;
-  mu_stream_t istream, ostream;
-  mu_off_t size;
-  int failed = 0;
-  
-  auth = mu_get_auth_by_name (name);
-  if (!auth)
-    {
-      mailer_err ("no such user", name,
-		  _("%s: no such user"), name);
-      exit_code = EX_UNAVAILABLE;
-      return;
-    }
-  if (uid)
-    auth->change_uid = 0;
-  
-  if (!sieve_test (auth, imbx))
-    {
-      exit_code = EX_OK;
-      mu_auth_data_free (auth);
-      return;
-    }
-
-  if ((status = mu_mailbox_get_message (imbx, 1, &msg)) != 0)
-    {
-      mailer_err ("cannot read message", name,
-		  _("Cannot get message from the temporary mailbox: %s"),
-		  mu_strerror (status));
-      mu_auth_data_free (auth);
-      return;
-    }
-
-  if ((status = mu_message_get_stream (msg, &istream)) != 0)
-    {
-      mailer_err ("cannot read message", name,
-		  _("Cannot get input message stream: %s"),
-		  mu_strerror (status));
-      mu_auth_data_free (auth);
-      return;
-    }
-  
-  if ((status = mu_mailbox_create (&mbox, auth->mailbox)) != 0)
-    {
-      mailer_err ("cannot read message", name,
-		  _("Cannot open mailbox %s: %s"),
-		  auth->mailbox, mu_strerror (status));
-      mu_auth_data_free (auth);
-      return;
-    }
-
-  mu_mailbox_get_url (mbox, &url);
-  path = (char*) mu_url_to_string (url);
-
-  /* Actually open the mailbox. Switch to the user's euid to make
-     sure the maildrop file will have right privileges, in case it
-     will be created */
-  if (switch_user_id (auth, 1))
-    return;
-  status = mu_mailbox_open (mbox, MU_STREAM_RDWR|MU_STREAM_CREAT);
-  if (switch_user_id (auth, 0))
-    return;
-  if (status != 0)
-    {
-      mailer_err ("cannot open mailbox", name,
-		  _("Cannot open mailbox %s: %s"), path, mu_strerror (status));
-      mu_mailbox_destroy (&mbox);
-      return;
-    }
-  
-  mu_mailbox_get_locker (mbox, &lock);
-
-  status = mu_locker_lock (lock);
-
-  if (status)
-    {
-      mailer_err ("cannot lock mailbox", name,
-		  _("Cannot lock mailbox `%s': %s"), path,
-		  mu_strerror (status));
-      mu_mailbox_destroy (&mbox);
-      exit_code = EX_TEMPFAIL;
-      return;
-    }
-
-  if ((status = mu_mailbox_get_stream (mbox, &ostream)))
-    {
-      mailer_err ("cannot access mailbox", name,
-		  _("Cannot get stream for mailbox %s: %s"),
-		  path, mu_strerror (status));
-      mu_mailbox_destroy (&mbox);
-      return;
-    }
-
-  if ((status = mu_stream_size (ostream, &size)))
-    {
-      mailer_err ("cannot access mailbox", name,
-		  _("Cannot get stream size (mailbox %s): %s"),
-		  path, mu_strerror (status));
-      mu_mailbox_destroy (&mbox);
-      return;
-    }
-
-#if defined(USE_MAILBOX_QUOTAS)
-  {
-    mu_off_t n;
-    mu_off_t isize;
-
-    switch (check_quota (auth, size, &n))
-      {
-      case MQUOTA_EXCEEDED:
-	mailer_err ("mailbox quota exceeded for this recipient", name,
-		    _("%s: mailbox quota exceeded for this recipient"), name);
-	exit_code = EX_QUOTA();
-	failed++;
-	break;
-	
-      case MQUOTA_UNLIMITED:
-	break;
-	
-      default:
-	if ((status = mu_stream_size (istream, &isize)))
-	  {
-	    mailer_err ("cannot access mailbox", name,
-			_("Cannot get stream size (input message %s): %s"),
-			path, mu_strerror (status));
-	    exit_code = EX_UNAVAILABLE;
-	    failed++;
-	  }
-	else if (isize > n)
-	  {
-	    mailer_err ("message would exceed maximum mailbox size for this recipient",
-			name,
-			_("%s: message would exceed maximum mailbox size for this recipient"),
-			name);
-	    exit_code = EX_QUOTA();
-	    failed++;
-	  }
-	break;
-      }
-  }
-#endif
-  
-  if (!failed && switch_user_id (auth, 1) == 0)
-    {
-      size_t nrd;
-      char *buf = NULL;
-      mu_off_t bufsize = 1024;
-
-      mu_stream_size (istream, &bufsize);
-      for (; (buf = malloc (bufsize)) == NULL && bufsize > 1; bufsize /= 2)
-	;
-      
-      if (!buf)
-	{
-	  status = errno = ENOMEM;
-	  failed++;
-	}
-      else if ((status = mu_stream_seek (ostream, size, SEEK_SET)) != 0
-	       || (status = mu_stream_seek (istream, 0, SEEK_SET) != 0))
-	/* nothing: the error will be reported later */;
-      else
-	{
-	  status = mu_stream_sequential_write (ostream, saved_envelope,
-					       strlen (saved_envelope));
-	  if (status == 0)
-	    {
-	      while ((status = mu_stream_sequential_read (istream,
-							  buf, bufsize,
-							  &nrd))
-		     == 0
-		     && nrd > 0)
-		{
-		  status = mu_stream_sequential_write (ostream, buf, nrd);
-		  if (status)
-		    break;
-		}
-	  
-	      free (buf);
-	    }
-	}
-      
-      switch_user_id (auth, 0);
-
-      if (status)
-	{
-	  /* Undo the delivery by truncating the mailbox back to its
-	     original size */
-	  int rc = mu_stream_truncate (ostream, size);
-	  if (rc)
-	    mailer_err ("write error", name,
-			_("Error writing to mailbox: %s. Mailbox NOT truncated: %s"),
-			mu_strerror (status), mu_strerror (rc));
-	  else  
-	    mailer_err ("write error", name,
-			_("Error writing to mailbox: %s"),
-	  	        mu_strerror (status));
-	}
-    }
-
-  if (!failed)
-    notify_biff (mbox, name, size);
-
-  mu_locker_unlock (lock);
-
-  mu_auth_data_free (auth);
-  mu_mailbox_close (mbox);
-  mu_mailbox_destroy (&mbox);
-}
-
-void
-notify_biff (mu_mailbox_t mbox, char *name, size_t size)
-{
-  static int fd = -1;
-  mu_url_t url = NULL;
-  char *buf = NULL;
-  static struct sockaddr_in inaddr;
-    
-  if (fd == -1)
-    {
-      struct servent *sp;
-      
-      if ((sp = getservbyname ("biff", "udp")) == NULL)
-	return;
-
-      inaddr.sin_family = AF_INET;
-      inaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
-      inaddr.sin_port = sp->s_port;
-      
-      fd = socket (PF_INET, SOCK_DGRAM, 0);
-      if (fd < 0)
-	fd = -2; /* Mark failed initialization */
-    }
-
-  if (fd < 0)
-    return;
-  
-  mu_mailbox_get_url (mbox, &url);
-  asprintf (&buf, "%s@%lu:%s", name,
-	    (unsigned long) size, mu_url_to_string (url));
-  if (buf)
-    {
-      sendto (fd, buf, strlen (buf), 0, (struct sockaddr *)&inaddr,
-	      sizeof inaddr);
-      free (buf);
-    }
-}
-
-void
-mailer_err (const char *msg, const char *arg, const char *fmt, ...)
-{
-  va_list ap;
-
-  guess_retval (errno);
-  if (arg)
-    fprintf (stderr, "<%s>: %s", arg, msg);
-  else
-    fputs (msg, stderr);
-  fputc ('\n', stderr);
-  if (fmt)
-    {
-      va_start (ap, fmt);
-      mu_verror (fmt, ap);
-      va_end (ap);
-    }
-}
-
-int temp_errors[] = {
-#ifdef EAGAIN
-  EAGAIN, /* Try again */
-#endif
-#ifdef EBUSY
-  EBUSY, /* Device or resource busy */
-#endif
-#ifdef EPROCLIM
-  EPROCLIM, /* Too many processes */
-#endif
-#ifdef EUSERS
-  EUSERS, /* Too many users */
-#endif
-#ifdef ECONNABORTED
-  ECONNABORTED, /* Software caused connection abort */
-#endif
-#ifdef ECONNREFUSED
-  ECONNREFUSED, /* Connection refused */
-#endif
-#ifdef ECONNRESET
-  ECONNRESET, /* Connection reset by peer */
-#endif
-#ifdef EDEADLK
-  EDEADLK, /* Resource deadlock would occur */
-#endif
-#ifdef EDEADLOCK
-  EDEADLOCK, /* Resource deadlock would occur */
-#endif
-#ifdef EFBIG
-  EFBIG, /* File too large */
-#endif
-#ifdef EHOSTDOWN
-  EHOSTDOWN, /* Host is down */
-#endif
-#ifdef EHOSTUNREACH
-  EHOSTUNREACH, /* No route to host */
-#endif
-#ifdef EMFILE
-  EMFILE, /* Too many open files */
-#endif
-#ifdef ENETDOWN
-  ENETDOWN, /* Network is down */
-#endif
-#ifdef ENETUNREACH
-  ENETUNREACH, /* Network is unreachable */
-#endif
-#ifdef ENETRESET
-  ENETRESET, /* Network dropped connection because of reset */
-#endif
-#ifdef ENFILE
-  ENFILE, /* File table overflow */
-#endif
-#ifdef ENOBUFS
-  ENOBUFS, /* No buffer space available */
-#endif
-#ifdef ENOMEM
-  ENOMEM, /* Out of memory */
-#endif
-#ifdef ENOSPC
-  ENOSPC, /* No space left on device */
-#endif
-#ifdef EROFS
-  EROFS, /* Read-only file system */
-#endif
-#ifdef ESTALE
-  ESTALE, /* Stale NFS file handle */
-#endif
-#ifdef ETIMEDOUT
-  ETIMEDOUT,  /* Connection timed out */
-#endif
-#ifdef EWOULDBLOCK
-  EWOULDBLOCK, /* Operation would block */
-#endif
-};
-  
-
-void
-guess_retval (int ec)
-{
-  int i;
-  /* Temporary failures override hard errors. */
-  if (exit_code == EX_TEMPFAIL)
-    return;
-#ifdef EDQUOT
-  if (ec == EDQUOT)
-    {
-      exit_code = EX_QUOTA();
-      return;
-    }
-#endif
-
-  for (i = 0; i < sizeof (temp_errors)/sizeof (temp_errors[0]); i++)
-    if (temp_errors[i] == ec)
-      {
-	exit_code = EX_TEMPFAIL;
-	return;
-      }
-  exit_code = EX_UNAVAILABLE;
-}
-
diff --git a/mail.local/script.c b/mail.local/script.c
deleted file mode 100644
index e22cc02..0000000
--- a/mail.local/script.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2002, 2005,
-   2007 Free Software Foundation, Inc.
-
-   GNU Mailutils is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   GNU Mailutils is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GNU Mailutils; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301 USA */
-
-#include <mail.local.h>
-
-#ifdef WITH_GUILE
-#include <mailutils/guile.h>
-
-int debug_guile;
-
-SCM mda_catch_body (void *data, mu_mailbox_t mbox);
-SCM mda_catch_handler (void *unused, SCM tag, SCM throw_args);
-int mda_next (void *data, mu_mailbox_t mbox);
-int mda_exit (void *data, mu_mailbox_t mbox);
-int mda_init (void *data);
-
-int
-prog_mda (struct mda_data *data)
-{
-  char *x_argv[2];
-  mu_guimb_param_t param;
-  
-  x_argv[0] = "mail.local";
-  x_argv[1] = NULL;
-
-  param.debug_guile = debug_guile;
-  param.mbox = data->mbox;
-  param.user_name = NULL;
-  param.init = mda_init;
-  param.catch_body = mda_catch_body;
-  param.catch_handler = mda_catch_handler;
-  param.next = mda_next;
-  param.exit = mda_exit;
-  param.data = data;
-  
-  mu_process_mailbox (1, x_argv, &param);
-  return EX_UNAVAILABLE;
-}
-
-int
-mda_init (void *data)
-{
-  struct mda_data *md = data;
-  md->progfile = mu_expand_path_pattern (md->progfile_pattern, md->argv[0]);
-  return 0;
-}
-
-static void
-mda_switch_to_user (struct mda_data *md)
-{
-  struct mu_auth_data *auth = NULL;
-  
-  if (md && *md->argv != NULL)
-    auth = mu_get_auth_by_name (*md->argv);
-
-  if (auth)
-    {
-      switch_user_id (auth, 1);
-      chdir (auth->dir);
-      mu_auth_data_free (auth);
-    }
-  else
-    {
-      switch_user_id (auth, 0);
-      chdir ("/");
-    }
-}
-
-SCM
-mda_catch_body (void *data, mu_mailbox_t mbox)
-{
-  struct mda_data *md = data;
-  mu_message_t mesg = NULL;
-  mu_attribute_t attr = NULL;
-
-  if (access (md->progfile, R_OK))
-    {
-      if (debug_level > 2)
-	mu_diag_output (MU_DIAG_DEBUG, _("Access to %s failed: %m"), md->progfile);
-    }
-  else
-    {
-      mda_switch_to_user (md);
-      scm_primitive_load (scm_makfrom0str (md->progfile));
-    }
-  
-  mu_mailbox_get_message (mbox, 1, &mesg);
-  mu_message_get_attribute (mesg, &attr);
-  if (mu_attribute_is_deleted (attr))
-    return SCM_BOOL_F;
-
-  mda_switch_to_user (NULL);
-  mda (md->mbox, md->argv[0]);
-  return SCM_BOOL_F;
-}
-
-SCM
-mda_catch_handler (void *data, SCM tag, SCM throw_args)
-{
-  exit_code = EX_TEMPFAIL;
-  return scm_handle_by_message_noexit ("mail.local", tag, throw_args);
-}
-
-int
-mda_next (void *data, mu_mailbox_t mbox)
-{
-  struct mda_data *md = data;
-  mu_message_t mesg = NULL;
-  mu_attribute_t attr = NULL;
-
-  md->argv++;
-  if (*md->argv == NULL)
-    return 0;
-  if (md->progfile)
-    free (md->progfile);
-  md->progfile = mu_expand_path_pattern (md->progfile_pattern, *md->argv);
-
-  mu_mailbox_get_message (mbox, 1, &mesg);
-  mu_message_get_attribute (mesg, &attr);
-  mu_attribute_unset_deleted (attr);
-  
-  return md->progfile != NULL;
-}
-
-int
-mda_exit (void *data, mu_mailbox_t mbox)
-{
-  return exit_code;
-}
-
-#endif
diff --git a/mail.local/testsuite/.gitignore b/mail.local/testsuite/.gitignore
deleted file mode 100644
index 989f590..0000000
--- a/mail.local/testsuite/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-*.log
-*.sum
-site.exp
-remote.exp
-data
diff --git a/mail.local/testsuite/Data b/mail.local/testsuite/Data
deleted file mode 100644
index 6c21bd8..0000000
--- a/mail.local/testsuite/Data
+++ /dev/null
@@ -1,45 +0,0 @@
-# This file is part of Mailutils testsuite.
-# Copyright (C) 2002, 2007 Free Software Foundation
-#  
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#   
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#  
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
-#
-
-MESSAGE Simple mail
-FROM gray@gnu.org
-TO user
-BODY BEGIN
-From: gray@gnu.org
-To: bug-mailutils@gnu.org
-Subject: Simple mail
-
-This is a simple mail.
-Data goes here.
-BODY END
-MESSAGE END
-
-MESSAGE Second mail
-FROM gray@runasimi.org
-TO user
-BODY BEGIN
-From: gray@runasimi.org
-To: bug-mailutils@gnu.org
-Subject: Simple mail
-
-This is a simple mail.
-Data goes here.
-BODY END
-MESSAGE END
-
-# end of data
diff --git a/mail.local/testsuite/Makefile.am b/mail.local/testsuite/Makefile.am
deleted file mode 100644
index 801c6ae..0000000
--- a/mail.local/testsuite/Makefile.am
+++ /dev/null
@@ -1,90 +0,0 @@
-## Process this file with GNU Automake to create Makefile.in
-
-##   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
-##
-##   GNU Mailutils is free software; you can redistribute it and/or
-##   modify it under the terms of the GNU General Public License as
-##   published by the Free Software Foundation; either version 3, or (at
-##   your option) any later version.
-##
-##   This program is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-##   General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with this program; if not, write to the Free Software
-##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
-##   02110-1301 USA
-
-AUTOMAKE_OPTIONS = dejagnu
-DEJATOOL = mail.local
-RUNTESTFLAGS = 
-CLEANFILES = *.log
-test_dirs = lib mail.local
-EXTRA_DIST = Data
-
-dist-hook:
-	here=`cd $(top_builddir)/$(subdir) && pwd`; \
-	srcdir=`cd $(srcdir) && pwd`; \
-	distdir=`cd $(distdir) && pwd`; \
-	for dir in $(test_dirs); \
-	do \
-            cd $$srcdir;\
-            mkdir $$distdir/$$dir;\
-	    cd $$dir;\
-	    for file in DISTFILES `cat DISTFILES`; do \
-	        d=$$srcdir/$$dir; \
-	        if test -d $$d/$$file; then \
-                    cp -pr $$d/$$file $$distdir/$$dir/$$file; \
-		else \
-	            test -f $$distdir/$$dir/$$file \
-                        || cp -p $$d/$$file $$distdir/$$dir/$$file || exit; \
-                fi; \
-	    done;\
-        done;\
-	cd $$here
-
-site.exp: Makefile remote.exp
-	@echo 'Making a new site.exp file...'
-	@test ! -f site.bak || rm -f site.bak
-	@echo '## these variables are automatically generated by make ##' > $@-t
-	@echo '# Do not edit here.  If you wish to override these values' >> $@-t
-	@echo '# edit the last section' >> $@-t
-	@echo 'set tool $(DEJATOOL)' >> $@-t
-	@echo "set top_srcdir `cd $(top_srcdir); pwd`" >> $@-t
-	@echo "set srcdir `cd $(srcdir); pwd`" >> $@-t
-	@echo 'set objdir' `pwd` >> $@-t
-	@echo 'set host_alias "$(host_alias)"' >> $@-t
-	@echo 'set host_triplet $(host_triplet)' >> $@-t
-	@echo 'set target_alias "$(target_alias)"' >> $@-t
-	@echo 'set target_triplet $(target_triplet)' >> $@-t
-	@echo 'set build_alias "$(build_alias)"' >> $@-t
-	@echo 'set build_triplet $(build_triplet)' >> $@-t
-	@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
-	@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
-	@test ! -f site.exp || mv site.exp site.bak
-	@mv $@-t site.exp
-
-remote.exp:;
-	@echo 'Making a new remote.exp file...'
-	@test ! -f remote.bak || rm -f remote.bak
-	@echo '## These variables are used to set up for the remote testing.' >> $@-t
-	@echo '## Please, read file README in this directory for instructions' >> $@-t
-	@echo '## on how to use this file' >> $@-t
-	@echo "set host_board `hostname`" >> $@-t
-	@echo 'set board_info($$host_board,connect) rlogin' >> $@-t
-	@echo 'set board_info($$host_board,shell_prompt) "\\$$ "' >> $@-t
-	@echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
-	@echo "set board_info(\$$host_board,srcdir) `cd $(srcdir); pwd`" >> $@-t
-	@echo "set board_info(\$$host_board,objdir) `pwd`" >> $@-t
-	@echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
-	@echo "set board_info(\$$host_board,top_builddir) `cd $(top_builddir); pwd`" >> $@-t
-	@test ! -f remote.exp || mv remote.exp remote.bak
-	@mv $@-t remote.exp
-
-
-DISTCLEANFILES=*.exp *.log *.sum 
-
-distclean-local:
-	-rm -rf	data
diff --git a/mail.local/testsuite/lib/DISTFILES b/mail.local/testsuite/lib/DISTFILES
deleted file mode 100644
index 0904150..0000000
--- a/mail.local/testsuite/lib/DISTFILES
+++ /dev/null
@@ -1 +0,0 @@
-mail.local.exp
diff --git a/mail.local/testsuite/lib/mail.local.exp b/mail.local/testsuite/lib/mail.local.exp
deleted file mode 100644
index 378dad6..0000000
--- a/mail.local/testsuite/lib/mail.local.exp
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- tcl -*-
-# This file is part of Mailutils testsuite.
-# Copyright (C) 2002, 2007, 2008 Free Software Foundation
-#  
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#   
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#  
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 USA.
-
-source $top_srcdir/testsuite/lib/mailutils.exp
-
-mu_init "--authentication generic --authorization virtdomain"
-mu_version
-if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
-    clone_output "WARNING: Support for virtual domains not compiled in"
-    clone_output "WARNING: Skipping tests for mail.local"
-    exit 0
-}
-
-mu_prepare_spools
-
-set ETC_DIR "$MU_DATA_DIR/etc"
-
-mu_makespool "$MU_RC_DIR" "$ETC_DIR"
-append MU_TOOL_FLAGS " --virtual-passwd-dir $ETC_DIR"
-
-set mu_filename "$MU_SPOOL_DIR/INBOX"
-set env(MTA_DIAG) "$mu_filename"
-
-# mail_local_test [-message MESSAGE][-default (FAIL|XFAIL)]
-#            [-input INPUT-LIST]
-#            [-args ARGS][-pattern PATTERN-LIST][PATTERN...]
-# INPUT-LIST - List of input strings for MU_TOOL
-# PATTERN   - Sequence to expect in return. 
-# MESSAGE   - [optional] message to output
-# ARGS      - Additional arguments to MU_TOOL
-proc mail_local_test { args } {
-    global MU_TOOL
-    global top_builddir
-    global verbose
-    global suppress_flag;
-    global mu_filename
-    upvar timeout timeout
-
-    set default ""
-    set message ""
-    set invocation ""
-    set input ""
-    set pattern ""
-    set invocation ""
-    
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set a [lindex $args $i]
-	if {"$a" == "-default"} {
-	    incr i
-	    set default [lindex $args $i]
-	} elseif {"$a" == "-message"} {
-	    incr i
-	    set message [lindex $args $i]
-	} elseif {"$a" == "-pattern"} {
-	    incr i
-	    set pattern [lindex $args $i]
-	} elseif {"$a" == "-input"} {
-	    incr i
-	    set input [lindex $args $i]
-	} elseif {"$a" == "-args"} {
-	    incr i
-	    set a [lindex $args $i]
-	    if {[llength $a] > 0} {
-		append invocation $a
-	    }
-	} else {
-	    set args [lrange $args $i end]
-	    break
-	}
-    }
-
-    if {"$message" == ""}  {
-	set message [lindex $args 0]
-    }
-
-    if $verbose>2 then {
-	send_user "Message is \"$message\"\n"
-    }
-
-    return [mailer_test -default $default -message $message -input $input -pattern $pattern -file $mu_filename -args $invocation]
-}
-
-
diff --git a/mail.local/testsuite/mail.local/DISTFILES b/mail.local/testsuite/mail.local/DISTFILES
deleted file mode 100644
index 926763d..0000000
--- a/mail.local/testsuite/mail.local/DISTFILES
+++ /dev/null
@@ -1 +0,0 @@
-deliver.exp
diff --git a/mail.local/testsuite/mail.local/deliver.exp b/mail.local/testsuite/mail.local/deliver.exp
deleted file mode 100644
index 4fc03c3..0000000
--- a/mail.local/testsuite/mail.local/deliver.exp
+++ /dev/null
@@ -1,97 +0,0 @@
-# -*- tcl -*-
-# This file is part of Mailutils testsuite.
-# Copyright (C) 2002, 2007 Free Software Foundation
-#  
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#   
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#  
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 USA.
-
-set chan [open ${srcdir}/Data r]
-
-# States are:
-#  INITIAL 0
-#  MESSAGE 1
-#  BODY    2
-#  PATTERN 3
-set state 0
-# Current pattern. Notice that it is cumulative (i.e. it is not reset
-# before each test) since the mailbox itself is cumulative too.
-set pattern [list]
-for {gets $chan line} {![eof $chan]} {gets $chan line} {
-    verbose "LINE $line" 1
-    switch -regexp -- "$line" {
-	"^#.*" { }
-	"^MESSAGE END" {
-	    verbose "MAIL FROM $from" 1
-	    verbose "MAIL TO $to" 1
-	    verbose "INPUT $input" 1
-	    verbose "PATTERN $pattern" 1
-	    set args ""
-	    if {$from != ""} {
-		append args " --from $from"
-	    }
-	    if {$to != ""} {
-		append args " ${to}@passwd"
-	    }
-
-	    if {$pattern == ""} {
-		set pattern [concat [list -re "From $from\[^\r\n\]*"] $input]
-	    }
-	    mail_local_test -message $message -input $input \
-		            -pattern $pattern -args $args
-	    lappend pattern ""
-	    set state 0
-	}
-	"^MESSAGE" {
-	    regexp "^MESSAGE (.*)" $line dummy message 
-	    set from ""
-	    set to ""
-	    set input [list]
-	    set state 1
-	}
-	"^FROM" {
-	    regexp "^FROM (.*)" $line dummy from
-	}
-	"^TO" {
-	    regexp "^TO (.*)" $line dummy to
-	}
-	"^BODY BEGIN" {
-	    set state 2
-	}
-	"^BODY END" {
-	    set state 1
-	}
-	"^PATTERN BEGIN" {
-	    set state 3
-	}
-	"^PATTERN END" {
-	    set state 1
-	}
-	"^STOP" {
-	    break
-	}
-	default {
-	    if {$state == 2} {
-		lappend input $line
-	    } elseif {$state == 3} {
-		lappend pattern $line
-	    }
-	}
-    }
-}
-
-close $chan
-
-# End of deliver.exp
-
diff --git a/mail.remote/.gitignore b/mail.remote/.gitignore
deleted file mode 100644
index 67cfada..0000000
--- a/mail.remote/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-Makefile
-Makefile.in
-mail.remote
-out.sendmail
-.gdbinit
-.deps
-.libs
-.*.swp
-_*
-.gdbinit
diff --git a/mail.remote/Makefile.am b/mail.remote/Makefile.am
deleted file mode 100644
index 70a0c96..0000000
--- a/mail.remote/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-## Process this file with GNU Automake to create Makefile.in
-
-##   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
-##
-##   GNU Mailutils is free software; you can redistribute it and/or
-##   modify it under the terms of the GNU General Public License as
-##   published by the Free Software Foundation; either version 3, or (at
-##   your option) any later version.
-##
-##   This program is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-##   General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with this program; if not, write to the Free Software
-##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
-##   02110-1301 USA
-
-INCLUDES = @MU_COMMON_INCLUDES@ 
-
-SUBDIRS = testsuite
-MU_SMTP_PROGRAMS_LIST = mail.remote$(EXEEXT)
-EXTRA_PROGRAMS = mail.remote
-libexec_PROGRAMS = @MU_SMTP_PROGRAMS_BUILD@
-
-mail_remote_SOURCES = mail.remote.c 
-
-mail_remote_LDADD = \
- ${MU_APP_LIBRARIES}\
- ${MU_LIB_AUTH}\
- ${MU_LIB_MAILER}\
- @MU_AUTHLIBS@\
- ${MU_LIB_MAILUTILS}\
- @MU_COMMON_LIBRARIES@
diff --git a/mail.remote/mail.remote.c b/mail.remote/mail.remote.c
deleted file mode 100644
index 44ab66b..0000000
--- a/mail.remote/mail.remote.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2002, 2004, 
-   2005, 2007, 2008 Free Software Foundation, Inc.
-
-   GNU Mailutils is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   GNU Mailutils is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GNU Mailutils; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-   MA 02110-1301 USA */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <mailutils/address.h>
-#include <mailutils/debug.h>
-#include <mailutils/errno.h>
-#include <mailutils/list.h>
-#include <mailutils/mailer.h>
-#include <mailutils/mutil.h>
-#include <mailutils/message.h>
-#include <mailutils/registrar.h>
-#include <mailutils/stream.h>
-#include <mailutils/property.h>
-#include <mailutils/error.h>
-#include <mailutils/nls.h>
-#include <mailutils/mu_auth.h>
-#include "mailutils/libargp.h"
-
-#include "mu_umaxtostr.h"
-
-const char *program_version = "mail.remote (" PACKAGE_STRING ")";
-static char doc[] =
-N_("GNU mail.remote -- pseudo-sendmail interface for mail delivery")
-"\v"
-N_("This is a simple drop-in replacement for sendmail to forward mail directly\n\
-to an SMTP gateway.\n\
-You should always specify your SMTP gateway using --mailer option\n\
-(the best place to do so is in your configuration file).\n\
-\n\
-Examples:\n\
-\n\
-Deliver mail via SMTP gateway at \"mail.example.com\", reading its\n\
-contents for recipients of the message.\n\
-\n\
-   mail.remote --mailer smtp://mail.example.com -t\n\
-\n\
-Deliver mail only to \"devnull@foo.bar\"\n\
-\n\
-   mail.remote --mailer smtp://mail.example.com devnull@foo.bar\n\
-\n\
-Deliver mail to \"devnull@foo.bar\" as well as to the recipients\n\
-specified in the message itself:\n\
-\n\
-   mail.remote --mailer smtp://mail.example.com -t devnull@foo.bar\n");
-
-static struct argp_option options[] = {
-  {"from",  'f', N_("ADDR"), 0, N_("Override the default from address")},
-  {"read-recipients", 't', NULL, 0, N_("Read message for recipients.") },
-  {"debug", 'd', NULL,   0, N_("Print envelope commands in the SMTP protocol transaction. If specified more than once, the data part of the protocol transaction will also be printed.")},
-  { NULL,   'o', N_("OPT"), 0, N_("Ignored for sendmail compatibility")},
-  { NULL,   'b', N_("OPT"), 0, N_("Ignored for sendmail compatibility")},
-  { NULL,   'i', NULL, 0, N_("Ignored for sendmail compatibility")},
-  { NULL }
-};
-
-static int optdebug;
-static const char *optfrom;
-static int read_recipients;  /* Read recipients from the message */
-
-static error_t
-parse_opt (int key, char *arg, struct argp_state *state)
-{
-  static struct mu_argp_node_list lst;
-  static int dbug = 0;
-  
-  switch (key)
-    {
-    case 'f':
-      mu_argp_node_list_new (&lst, "from", arg);
-      break;
-
-    case 'd':
-      dbug++;
-      break;
-
-    case 'o':
-    case 'b':
-    case 'i':
-      break;
-
-    case 't':
-      mu_argp_node_list_new (&lst, "read-recipients", "yes");
-      break;
-      
-    case ARGP_KEY_INIT:
-      mu_argp_node_list_init (&lst);
-      break;
-      
-    case ARGP_KEY_FINI:
-      if (dbug)
-	mu_argp_node_list_new (&lst, "debug", mu_umaxtostr (0, dbug));
-      mu_argp_node_list_finish (&lst, NULL, NULL);
-      break;
-      
-    default: 
-      return ARGP_ERR_UNKNOWN;
-    }
-  return 0;
-}
-
-static struct argp argp = {
-  options,
-  parse_opt,
-  N_("[TO-ADDR]..."),
-  doc,
-};
-
-
-struct mu_cfg_param mail_remote_cfg_param[] = {
-  { "from", mu_cfg_string, &optfrom, 0, NULL,
-    N_("Set sender email address."),
-    N_("email") },
-  { "read-recipients", mu_cfg_string, &read_recipients, 0, NULL,
-    N_("Read recipient addresses from the message.") },
-  { "debug", mu_cfg_int, &optdebug, 0, NULL,
-    N_("Set debug verbosity level.  Level 1 prints envelope commands in "
-       "the SMTP protocol transaction.  Levels 2 and above print the data "
-       "part of the transaction as well.") },
-  { NULL }
-};
-
-
-static const char *capa[] = {
-  "auth",
-  "common",
-  "debug",
-  "mailer",
-  "address",
-  "license",
-  NULL
-};
-
-mu_mailer_t mailer;     /* Mailer object */ 
-mu_address_t from;      /* Sender address */ 
-mu_address_t to;        /* Recipient addresses */
-mu_stream_t in;         /* Input stream */
-
-void
-mr_exit (int status)
-{
-  mu_address_destroy (&from);
-  mu_address_destroy (&to);
-  mu_stream_destroy (&in, NULL);
-  mu_mailer_destroy (&mailer);
-
-  exit (status ? 1 : 0);
-}
-
-int
-main (int argc, char **argv)
-{
-  int status = 0;
-  int optind = 0;
-
-  mu_message_t msg = 0;
-
-  int mailer_flags = 0;
-
-  /* Native Language Support */
-  MU_APP_INIT_NLS ();
-
-  /* Register mailers. */
-  mu_registrar_record (mu_smtp_record);
-
-  MU_AUTH_REGISTER_ALL_MODULES();
-  mu_argp_init (program_version, NULL);
-  if (mu_app_init (&argp, capa, mail_remote_cfg_param, 
-		   argc, argv, 0, &optind, NULL))
-    exit (1);
-  
-  if (optfrom)
-    {
-      if ((status = mu_address_create (&from, optfrom)))
-	{
-	  mu_error (_("Parsing from addresses failed: %s"),
-		    mu_strerror (status));
-	  mr_exit (status);
-	}
-    }
-
-  if (argv[optind])
-    {
-      if ((status = mu_address_createv (&to, (const char **) (argv + optind), -1)))
-	{
-	  mu_error (_("Parsing recipient addresses failed: %s"),
-		    mu_strerror (status));
-	  mr_exit (status);
-	}
-    }
-     
-  if ((status = mu_stdio_stream_create (&in, stdin, MU_STREAM_SEEKABLE)))
-    {
-      mu_error (_("Failed: %s"), mu_strerror (status));
-      mr_exit (status);
-    }
-
-  if ((status = mu_stream_open (in)))
-    {
-      mu_error (_("Opening stdin failed: %s"), mu_strerror (status));
-      mr_exit (status);
-    }
-
-  if ((status = mu_message_create (&msg, NULL)))
-    {
-      mu_error (_("Failed: %s"), mu_strerror (status));
-      mr_exit (status);
-    }
-
-  if ((status = mu_message_set_stream (msg, in, NULL)))
-    {
-      mu_error (_("Failed: %s"), mu_strerror (status));
-      mr_exit (status);
-    }
-
-  if ((status = mu_mailer_create (&mailer, NULL)))
-    {
-      const char *url = NULL;
-      mu_mailer_get_url_default (&url);
-      mu_error (_("Creating mailer `%s' failed: %s"),
-		url, mu_strerror (status));
-      mr_exit (status);
-    }
-
-  if (optdebug)
-    {
-      mu_debug_t debug;
-      mu_mailer_get_debug (mailer, &debug);
-      mu_debug_set_level (debug, MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
-
-      if (optdebug > 1)
-	mailer_flags = MAILER_FLAG_DEBUG_DATA;
-    }
-
-  if (read_recipients)
-    {
-      mu_property_t property = NULL;
-
-      mu_mailer_get_property (mailer, &property);
-      mu_property_set_value (property, "READ_RECIPIENTS", "true", 1);
-    }
-  
-  if ((status = mu_mailer_open (mailer, mailer_flags)))
-    {
-      const char *url = NULL;
-      mu_mailer_get_url_default (&url);
-      mu_error (_("Opening mailer `%s' failed: %s"),
-		url, mu_strerror (status));
-      mr_exit (status);
-    }
-
-  if ((status = mu_mailer_send_message (mailer, msg, from, to)))
-    {
-      mu_error (_("Sending message failed: %s"), mu_strerror (status));
-      mr_exit (status);
-    }
-
-  if ((status = mu_mailer_close (mailer)))
-    {
-      mu_error (_("Closing mailer failed: %s"), mu_strerror (status));
-      mr_exit (status);
-    }
-
-  mr_exit (status);
-}
-
diff --git a/mail.remote/testsuite/.gitignore b/mail.remote/testsuite/.gitignore
deleted file mode 100644
index 989f590..0000000
--- a/mail.remote/testsuite/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-*.log
-*.sum
-site.exp
-remote.exp
-data
diff --git a/mail.remote/testsuite/Data b/mail.remote/testsuite/Data
deleted file mode 100644
index 6dd21a6..0000000
--- a/mail.remote/testsuite/Data
+++ /dev/null
@@ -1,205 +0,0 @@
-# This file is part of Mailutils testsuite.
-# Copyright (C) 2002, 2004, 2007 Free Software Foundation
-#  
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#   
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#  
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
-#
-
-MESSAGE Simple mail
-BODY BEGIN
-From: gray@gnu.org
-To: bug-mailutils@gnu.org
-Subject: Simple mail
-
-This is a simple mail.
-Data goes here.
-BODY END
-
-PATTERN BEGIN
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <bug-mailutils@gnu.org>
-   0: From: gray@gnu.org
-   1: To: bug-mailutils@gnu.org
-   2: Subject: Simple mail
-   3:
-   4: This is a simple mail.
-   5: Data goes here.
-   6:
-END OF MESSAGE
-PATTERN END
-MESSAGE END
-
-MESSAGE Explicit from
-FROM <gray@localhost>
-BODY BEGIN
-From: gray@gnu.org
-To: bug-mailutils@gnu.org
-Subject: Explicit from test.
-
-This is a simple mail.
-Data goes here.
-BODY END
-
-PATTERN BEGIN
-ENVELOPE FROM: <gray@localhost>
-ENVELOPE TO: <bug-mailutils@gnu.org>
-   0: From: gray@gnu.org
-   1: To: bug-mailutils@gnu.org
-   2: Subject: Explicit from test.
-   3:
-   4: This is a simple mail.
-   5: Data goes here.
-   6:
-END OF MESSAGE
-PATTERN END
-MESSAGE END
-
-MESSAGE Explicit To
-TO <alainm@gnu.org> <jbailey@gnu.org>
-BODY BEGIN
-From: gray@gnu.org
-Subject: Expicit destinations
-
-This is a test for working explicit destinations.
-BODY END
-PATTERN BEGIN
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <alainm@gnu.org>,<jbailey@gnu.org>
-   0: To: <alainm@gnu.org>,<jbailey@gnu.org>
-   1: From: gray@gnu.org
-   2: Subject: Expicit destinations
-   3:
-   4: This is a test for working explicit destinations.
-   5:
-END OF MESSAGE
-PATTERN END
-MESSAGE END
-
-MESSAGE CC
-BODY BEGIN
-From: gray@gnu.org
-To: bug-mailutils@gnu.org
-Cc: alainm@gnu.org
-Subject: Carbon copy test
-
-CC works.
-BODY END
-PATTERN BEGIN
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <bug-mailutils@gnu.org>,<alainm@gnu.org>
-   0: From: gray@gnu.org
-   1: To: bug-mailutils@gnu.org
-   2: Cc: alainm@gnu.org
-   3: Subject: Carbon copy test
-   4:
-   5: CC works.
-   6:
-END OF MESSAGE
-PATTERN END
-MESSAGE END
-
-MESSAGE BCC
-BODY BEGIN
-From: gray@gnu.org
-To: alainm@gnu.org
-Bcc: bug-mailutils@gnu.org
-Subject: Blind carbon copy test.
-
-Bcc works too.
-BODY END
-PATTERN BEGIN
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <alainm@gnu.org>
-   0: From: gray@gnu.org
-   1: To: alainm@gnu.org
-   2: Subject: Blind carbon copy test.
-   3:
-   4: Bcc works too.
-   5:
-END OF MESSAGE
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <bug-mailutils@gnu.org>
-   0: Bcc: bug-mailutils@gnu.org
-   1: From: gray@gnu.org
-   2: To: alainm@gnu.org
-   3: Subject: Blind carbon copy test.
-   4:
-   5: Bcc works too.
-   6:
-END OF MESSAGE
-PATTERN END
-MESSAGE END
-
-MESSAGE Complex
-TO <root@localhost>
-BODY BEGIN
-From: gray@gnu.org
-Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
-Bcc: bug-mailutils@gnu.org
-Subject: A complex test
-
-It works?
-BODY END
-PATTERN BEGIN
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <root@localhost>
-   0: To: <root@localhost>
-   1: From: gray@gnu.org
-   2: Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
-   3: Subject: A complex test
-   4:
-   5: It works?
-   6:
-END OF MESSAGE
-PATTERN END
-MESSAGE END
-
-MESSAGE Complex+Read recipients
-OPTIONS -t
-TO <root@localhost>
-BODY BEGIN
-From: gray@gnu.org
-Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
-Bcc: bug-mailutils@gnu.org
-Subject: A complex test
-
-It works?
-BODY END
-PATTERN BEGIN
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <root@localhost>,<alainm@gnu.org>,<jbailey@gnu.org>
-   0: To: <root@localhost>,<alainm@gnu.org>,<jbailey@gnu.org>
-   1: From: gray@gnu.org
-   2: Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
-   3: Subject: A complex test
-   4:
-   5: It works?
-   6:
-END OF MESSAGE
-ENVELOPE FROM: <gray@gnu.org>
-ENVELOPE TO: <bug-mailutils@gnu.org>
-   0: To: <bug-mailutils@gnu.org>
-   1: Bcc: bug-mailutils@gnu.org
-   2: From: gray@gnu.org
-   3: Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
-   4: Subject: A complex test
-   5:
-   6: It works?
-   7:
-END OF MESSAGE
-PATTERN END
-MESSAGE END
-
-
-# End of data
diff --git a/mail.remote/testsuite/Makefile.am b/mail.remote/testsuite/Makefile.am
deleted file mode 100644
index 5444e2d..0000000
--- a/mail.remote/testsuite/Makefile.am
+++ /dev/null
@@ -1,91 +0,0 @@
-## Process this file with GNU Automake to create Makefile.in
-
-##   Copyright (C) 2002, 2007 Free Software Foundation, Inc.
-##
-##   GNU Mailutils is free software; you can redistribute it and/or
-##   modify it under the terms of the GNU General Public License as
-##   published by the Free Software Foundation; either version 3, or (at
-##   your option) any later version.
-##
-##   This program is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-##   General Public License for more details.
-##
-##   You should have received a copy of the GNU General Public License
-##   along with this program; if not, write to the Free Software
-##   Foundation, Inc.  51 Franklin Street, Fifth Floor, Boston, MA
-##   02110-1301 USA
-
-AUTOMAKE_OPTIONS = dejagnu
-SMTP_DEJATOOL = mail.remote
-DEJATOOL = @MU_SMTP_DEJATOOL@
-RUNTESTFLAGS = 
-CLEANFILES = *.log
-test_dirs = lib mail.remote
-EXTRA_DIST = Data
-
-dist-hook:
-	here=`cd $(top_builddir)/$(subdir) && pwd`; \
-	srcdir=`cd $(srcdir) && pwd`; \
-	distdir=`cd $(distdir) && pwd`; \
-	for dir in $(test_dirs); \
-	do \
-            cd $$srcdir;\
-            mkdir $$distdir/$$dir;\
-	    cd $$dir;\
-	    for file in DISTFILES `cat DISTFILES`; do \
-	        d=$$srcdir/$$dir; \
-	        if test -d $$d/$$file; then \
-                    cp -pr $$d/$$file $$distdir/$$dir/$$file; \
-		else \
-	            test -f $$distdir/$$dir/$$file \
-                        || cp -p $$d/$$file $$distdir/$$dir/$$file || exit; \
-                fi; \
-	    done;\
-        done;\
-	cd $$here
-
-site.exp: Makefile remote.exp
-	@echo 'Making a new site.exp file...'
-	@test ! -f site.bak || rm -f site.bak
-	@echo '## these variables are automatically generated by make ##' > $@-t
-	@echo '# Do not edit here.  If you wish to override these values' >> $@-t
-	@echo '# edit the last section' >> $@-t
-	@echo 'set tool $(DEJATOOL)' >> $@-t
-	@echo "set top_srcdir `cd $(top_srcdir); pwd`" >> $@-t
-	@echo "set top_builddir `cd $(top_builddir); pwd`" >> $@-t
-	@echo "set srcdir `cd $(srcdir); pwd`" >> $@-t
-	@echo 'set objdir' `pwd` >> $@-t
-	@echo 'set host_alias "$(host_alias)"' >> $@-t
-	@echo 'set host_triplet $(host_triplet)' >> $@-t
-	@echo 'set target_alias "$(target_alias)"' >> $@-t
-	@echo 'set target_triplet $(target_triplet)' >> $@-t
-	@echo 'set build_alias "$(build_alias)"' >> $@-t
-	@echo 'set build_triplet $(build_triplet)' >> $@-t
-	@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
-	@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
-	@test ! -f site.exp || mv site.exp site.bak
-	@mv $@-t site.exp
-
-remote.exp:;
-	@echo 'Making a new remote.exp file...'
-	@test ! -f remote.bak || rm -f remote.bak
-	@echo '## These variables are used to set up for the remote testing.' >> $@-t
-	@echo '## Please, read file README in this directory for instructions' >> $@-t
-	@echo '## on how to use this file' >> $@-t
-	@echo "set host_board `hostname`" >> $@-t
-	@echo 'set board_info($$host_board,connect) rlogin' >> $@-t
-	@echo 'set board_info($$host_board,shell_prompt) "\\$$ "' >> $@-t
-	@echo "set board_info(\$$host_board,srcdir) `cd $(srcdir); pwd`" >> $@-t
-	@echo "set board_info(\$$host_board,objdir) `pwd`" >> $@-t
-	@echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
-	@echo "set board_info(\$$host_board,top_builddir) `cd $(top_builddir); pwd`" >> $@-t
-	@test ! -f remote.exp || mv remote.exp remote.bak
-	@mv $@-t remote.exp
-
-
-DISTCLEANFILES=*.exp *.log *.sum 
-
-distclean-local:
-	-rm -rf	data
diff --git a/mail.remote/testsuite/lib/DISTFILES b/mail.remote/testsuite/lib/DISTFILES
deleted file mode 100644
index c46b985..0000000
--- a/mail.remote/testsuite/lib/DISTFILES
+++ /dev/null
@@ -1 +0,0 @@
-mail.remote.exp
diff --git a/mail.remote/testsuite/lib/mail.remote.exp b/mail.remote/testsuite/lib/mail.remote.exp
deleted file mode 100644
index 4edd193..0000000
--- a/mail.remote/testsuite/lib/mail.remote.exp
+++ /dev/null
@@ -1,104 +0,0 @@
-# -*- tcl -*-
-# This file is part of Mailutils testsuite.
-# Copyright (C) 2002, 2004, 2007 Free Software Foundation
-#  
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#   
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#  
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 USA.
-
-source $top_srcdir/testsuite/lib/mailutils.exp
-
-mu_init -noflags
-mu_prepare_spools
-set mu_filename "$MU_FOLDER_DIR/mta.diag"
-set env(MTA_DIAG) "$mu_filename"
-
-# mail_remote_test [-message MESSAGE][-default (FAIL|XFAIL)]
-#            [-input INPUT-LIST]
-#            [-args ARGS][-pattern PATTERN-LIST][PATTERN...]
-# INPUT-LIST - List of input strings for MU_TOOL
-# PATTERN   - Sequence to expect in return. 
-# MESSAGE   - [optional] message to output
-# ARGS      - Additional arguments to MU_TOOL
-proc mail_remote_test { args } {
-    global MU_TOOL
-    global top_builddir
-    global verbose
-    global suppress_flag;
-    global mu_filename
-    upvar timeout timeout
-
-    set default ""
-    set message ""
-    set invocation ""
-    set input ""
-    set pattern ""
-    for {set i 0} {$i < [llength $args]} {incr i} {
-	set a [lindex $args $i]
-	if {"$a" == "-default"} {
-	    incr i
-	    set default [lindex $args $i]
-	} elseif {"$a" == "-message"} {
-	    incr i
-	    set message [lindex $args $i]
-	} elseif {"$a" == "-pattern"} {
-	    incr i
-	    set pattern [lindex $args $i]
-	} elseif {"$a" == "-input"} {
-	    incr i
-	    set input [lindex $args $i]
-	} elseif {"$a" == "-args"} {
-	    incr i
-	    set a [lindex $args $i]
-	    if {[llength $a] > 0} {
-		append invocation $a
-	    }
-	} else {
-	    set args [lrange $args $i end]
-	    break
-	}
-    }
-
-    set res [remote_spawn host "${top_builddir}/examples/mta -bd"]
-    if { $res < 0 || $res == "" } {
-	perror "Spawning mta failed."
-	return 1
-    }
-
-    remote_expect host 60 {
-	-re "\[0-9\]\[0-9\]*" {
-	    set port $expect_out(buffer)
-	    set url "smtp://127.0.0.1:$port"
-	    verbose "URL: $url" 1
-	}
-	default {
-	    perror "Spawning mta failed."
-	            return 1
-	}
-    }
-
-    if {"$message" == ""}  {
-	set message [lindex $args 0]
-    }
-
-    if $verbose>2 then {
-	send_user "Message is \"$message\"\n"
-    }
-
-    return [mailer_test -default $default -message $message \
-	                -input $input -pattern $pattern -file \
-			$mu_filename -args "--mailer $url $invocation"]
-}
-
-
diff --git a/mail.remote/testsuite/mail.remote/DISTFILES b/mail.remote/testsuite/mail.remote/DISTFILES
deleted file mode 100644
index 6a29f1d..0000000
--- a/mail.remote/testsuite/mail.remote/DISTFILES
+++ /dev/null
@@ -1 +0,0 @@
-send.exp
diff --git a/mail.remote/testsuite/mail.remote/send.exp b/mail.remote/testsuite/mail.remote/send.exp
deleted file mode 100644
index 5723a0b..0000000
--- a/mail.remote/testsuite/mail.remote/send.exp
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- tcl -*-
-# This file is part of Mailutils testsuite.
-# Copyright (C) 2002, 2004, 2007 Free Software Foundation
-#  
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#   
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#  
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 USA.
-
-set chan [open ${srcdir}/Data r]
-
-set state 0
-set command ""
-for {gets $chan line} {![eof $chan]} {gets $chan line} {
-    verbose "LINE $line" 1
-    switch -regexp -- "$line" {
-	"^#.*" { }
-	"^MESSAGE END" {
-	    verbose "MAIL FROM $from" 1
-	    verbose "MAIL TO $to" 1
-	    verbose "INPUT $input" 1
-	    verbose "OPTIONS $options" 1
-	    verbose "PATTERN $pattern" 1
-	    set args ""
-	    if {$from != ""} {
-		append args " --from $from"
-	    }
-	    if {$options != ""} {
-		append args " $options"
-	    }
-	    if {$to != ""} {
-		append args " $to"
-	    }
-	    mail_remote_test -message $message -input $input \
-		             -pattern $pattern -args $args
-	    set state 0
-	}
-	"^MESSAGE" {
-	    regexp "^MESSAGE (.*)" $line dummy message 
-	    set from ""
-	    set to ""
-	    set options ""
-	    set input [list]
-	    set pattern [list]
-	    set state 1
-	}
-	"^FROM" {
-	    regexp "^FROM (.*)" $line dummy from
-	}
-	"^TO" {
-	    regexp "^TO (.*)" $line dummy to
-	}
-	"^OPTIONS" {
-	    regexp "^OPTIONS (.*)" $line dummy options
-	}
-	"^BODY BEGIN" {
-	    set state 2
-	}
-	"^BODY END" {
-	    set state 1
-	}
-	"^PATTERN BEGIN" {
-	    set state 3
-	}
-	"^PATTERN END" {
-	    set state 1
-	}
-	"^STOP" {
-	    break
-	}
-	default {
-	    if {$state == 2} {
-		lappend input $line
-	    } elseif {$state == 3} {
-		lappend pattern $line
-	    }
-	}
-    }
-}
-
-close $chan
-
-# End of send.exp
diff --git a/mu-aux/mailutils.spec.in b/mu-aux/mailutils.spec.in
index 112dfa8..68b766c 100644
--- a/mu-aux/mailutils.spec.in
+++ b/mu-aux/mailutils.spec.in
@@ -31,8 +31,8 @@ BuildRequires: python
 GNU Mailutils contains a series of useful mail clients, servers, and
 libraries. These are the primary mail utilities of the GNU system.
 This package provides a replacement for /bin/mail(x) conforming to
-the UNIX98 specification for mailx. Provides also mail.local,
-mail.remote, and other tools including guimb, dotlock, movemail,
+the UNIX98 specification for mailx. It provides also a mail delivery
+agent maidag, and other tools including guimb, dotlock, movemail,
 frm.
 
 %package -n libmailutils
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 13382d6..40f4149 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -99,12 +99,6 @@ maidag/mailquota.c
 maidag/mailtmp.c
 maidag/script.c
 
-mail.local/mailquota.c
-mail.local/main.c
-mail.local/script.c
-
-mail.remote/mail.remote.c
-
 mail/alias.c
 mail/alt.c
 mail/cd.c


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Fri Mar 27 10:37:23 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LnDBT-0001bM-PE
	for mharc-commit-mailutils@gnu.org; Fri, 27 Mar 2009 10:37:23 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LnDBS-0001b2-6I
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 10:37:22 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LnDBR-0001am-Hd
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 10:37:21 -0400
Received: from [199.232.76.173] (port=53323 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LnDBR-0001ad-9n
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 10:37:21 -0400
Received: from savannah.gnu.org ([199.232.41.3]:42901 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LnDBQ-0002uK-UB
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 10:37:21 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LnDBQ-0007Am-AX
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 14:37:20 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LnDBL-00079u-91
	for commit-mailutils@gnu.org; Fri, 27 Mar 2009 14:37:20 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 40fffffb6c6b5b10642428408f49bec401668f68
X-Git-Newrev: 88260300b2288f9a2515bbf94339a949fea2c425
Message-Id: <E1LnDBL-00079u-91@cvs.savannah.gnu.org>
Date: Fri, 27 Mar 2009 14:37:16 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-255-g8826030
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Mar 2009 14:37:22 -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=88260300b2288f9a2515bbf94339a949fea2c425

The branch, master has been updated
       via  88260300b2288f9a2515bbf94339a949fea2c425 (commit)
      from  40fffffb6c6b5b10642428408f49bec401668f68 (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 88260300b2288f9a2515bbf94339a949fea2c425
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Mar 27 16:36:52 2009 +0200

    Implement guile output redirection in maidag
    
    * libmu_scm/mu_guimb.c: Remove
    * libmu_scm/mu_dbgport.c: New file.
    * libmu_scm/Makefile.am: Update.
    * include/mailutils/guile.h (mu_process_mailbox): Remove.
    (mu_scm_make_debug_port, mu_scm_debug_port_init): New prototypes.
    * libmu_scm/mu_scm.c (mu_scm_init): Call mu_scm_debug_port_init.
    * maidag/guile.c (scheme_check_msg): Redirect error/output to MU port.
    
    * mailbox/mutil.c (mu_expand_path_pattern): Expand ~.

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

Summary of changes:
 include/mailutils/guile.h |    4 +-
 libmu_scm/Makefile.am     |    4 +-
 libmu_scm/mu_dbgport.c    |  119 +++++++++++++++++++++++++++++++++++++++++++++
 libmu_scm/mu_guimb.c      |   78 -----------------------------
 libmu_scm/mu_scm.c        |    2 +
 maidag/guile.c            |   11 ++++
 mailbox/mutil.c           |   58 ++++++++++++----------
 7 files changed, 167 insertions(+), 109 deletions(-)
 create mode 100644 libmu_scm/mu_dbgport.c
 delete mode 100644 libmu_scm/mu_guimb.c

diff --git a/include/mailutils/guile.h b/include/mailutils/guile.h
index cdc9c09..c9e8972 100644
--- a/include/mailutils/guile.h
+++ b/include/mailutils/guile.h
@@ -71,8 +71,10 @@ extern void mu_scm_message_add_owner (SCM MESG, SCM owner);
 
 extern void mu_scm_mutil_init (void);
 
-extern void mu_process_mailbox (int argc, char *argv[], mu_guimb_param_t *param);
+SCM mu_scm_make_debug_port (mu_debug_t debug, mu_log_level_t level);
+void mu_scm_debug_port_init (void);
 
+  
 extern void mu_guile_init (int debug);
 extern int mu_guile_load (char *filename, int argc, char **argv);
 extern int mu_guile_eval (const char *string);
diff --git a/libmu_scm/Makefile.am b/libmu_scm/Makefile.am
index 282d262..c0ba41f 100644
--- a/libmu_scm/Makefile.am
+++ b/libmu_scm/Makefile.am
@@ -26,8 +26,8 @@ EXTRA_LTLIBRARIES=libmu_scm.la
 C_SRCS=\
  mu_address.c\
  mu_body.c\
+ mu_dbgport.c\
  mu_guile.c\
- mu_guimb.c\
  mu_mailbox.c\
  mu_message.c\
  mu_mime.c\
@@ -61,7 +61,6 @@ site_DATA=@GUILE_SITE_DATA@
 DOT_X_FILES=\
  mu_address.x\
  mu_body.x\
- mu_guimb.x\
  mu_mailbox.x\
  mu_message.x\
  mu_mime.x\
@@ -73,7 +72,6 @@ DOT_X_FILES=\
 DOT_DOC_FILES=\
  mu_address.doc\
  mu_body.doc\
- mu_guimb.doc\
  mu_mailbox.doc\
  mu_message.doc\
  mu_mime.doc\
diff --git a/libmu_scm/mu_dbgport.c b/libmu_scm/mu_dbgport.c
new file mode 100644
index 0000000..0d0ffd7
--- /dev/null
+++ b/libmu_scm/mu_dbgport.c
@@ -0,0 +1,119 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General
+   Public License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA */
+
+#include "mu_scm.h"
+
+struct _mu_debug_port
+{
+  mu_debug_t      debug;
+  mu_log_level_t  level;
+};
+
+static long     scm_tc16_mu_debug_port;
+
+SCM
+mu_scm_make_debug_port (mu_debug_t debug, mu_log_level_t level)
+{
+  struct _mu_debug_port *dp;
+  SCM             port;
+  scm_port       *pt;
+
+  dp = scm_gc_malloc (sizeof (struct _mu_debug_port), "mu-debug-port");
+  dp->debug = debug;
+  dp->level = level;
+  port = scm_cell (scm_tc16_mu_debug_port, 0);
+  pt = scm_add_to_port_table (port);
+  SCM_SETPTAB_ENTRY (port, pt);
+  pt->rw_random = 0;
+  SCM_SET_CELL_TYPE (port,
+		     (scm_tc16_mu_debug_port | SCM_OPN | SCM_WRTNG |
+		      SCM_BUF0));
+  SCM_SETSTREAM (port, dp);
+  return port;
+}
+
+#define MU_DEBUG_PORT(x) ((struct _mu_debug_port *) SCM_STREAM (x))
+
+static SCM
+_mu_debug_port_mark (SCM port)
+{
+  return SCM_BOOL_F;
+}
+
+static void
+_mu_debug_port_flush (SCM port)
+{
+  struct _mu_debug_port *dp = MU_DEBUG_PORT (port);
+
+  /* FIXME: */
+}
+
+static int
+_mu_debug_port_close (SCM port)
+{
+  struct _mu_debug_port *dp = MU_DEBUG_PORT (port);
+
+  if (dp)
+    {
+      _mu_debug_port_flush (port);
+      SCM_SETSTREAM (port, NULL);
+      scm_gc_free (dp, sizeof (struct _mu_debug_port), "mu-debug-port");
+    }
+  return 0;
+}
+
+static scm_sizet
+_mu_debug_port_free (SCM port)
+{
+  _mu_debug_port_close (port);
+  return 0;
+}
+
+static int
+_mu_debug_port_fill_input (SCM port)
+{
+  return EOF;
+}
+
+static void
+_mu_debug_port_write (SCM port, const void *data, size_t size)
+{
+  struct _mu_debug_port *dp = MU_DEBUG_PORT (port);
+
+  mu_debug_printf (dp->debug, dp->level, "%.*s", size, (const char *)data);
+}
+
+static int
+_mu_debug_port_print (SCM exp, SCM port, scm_print_state * pstate)
+{
+  scm_puts ("#<Mailutis debug port>", port);
+  return 1;
+}
+
+void
+mu_scm_debug_port_init ()
+{
+  scm_tc16_mu_debug_port = scm_make_port_type ("mu-debug-port",
+					       _mu_debug_port_fill_input,
+					       _mu_debug_port_write);
+  scm_set_port_mark (scm_tc16_mu_debug_port, _mu_debug_port_mark);
+  scm_set_port_free (scm_tc16_mu_debug_port, _mu_debug_port_free);
+  scm_set_port_print (scm_tc16_mu_debug_port, _mu_debug_port_print);
+  scm_set_port_flush (scm_tc16_mu_debug_port, _mu_debug_port_flush);
+  scm_set_port_close (scm_tc16_mu_debug_port, _mu_debug_port_close);
+}
diff --git a/libmu_scm/mu_guimb.c b/libmu_scm/mu_guimb.c
deleted file mode 100644
index 3d266ed..0000000
--- a/libmu_scm/mu_guimb.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General
-   Public License along with this library; if not, write to the
-   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301 USA */
-
-#include "mu_scm.h"
-
-static void _scheme_main (void *closure, int argc, char **argv);
-
-void
-mu_process_mailbox (int argc, char *argv[], mu_guimb_param_t *param)
-{
-  scm_boot_guile (argc, argv, _scheme_main, param);
-}
-
-SCM _current_mailbox;
-SCM _user_name;
-
-static SCM
-catch_body (void *closure)
-{
-  mu_guimb_param_t *param = closure;
-  return param->catch_body (param->data, param->mbox);
-}
-
-void
-_scheme_main (void *closure, int argc, char **argv)
-{
-  mu_guimb_param_t *param = closure;
-  
-  if (param->debug_guile)
-    {
-      SCM_DEVAL_P = 1;
-      SCM_BACKTRACE_P = 1;
-      SCM_RECORD_POSITIONS_P = 1;
-      SCM_RESET_DEBUG_MODE;
-    }
-
-/* Initialize scheme library */
-  mu_scm_init ();
-
-  /* Provide basic primitives */
-#include <mu_guimb.x>
-
-  _current_mailbox = mu_scm_mailbox_create (param->mbox);
-  mu_set_variable ("current-mailbox", _current_mailbox);
-
-  _user_name = param->user_name ?
-                       scm_makfrom0str (param->user_name) : SCM_BOOL_F;
-  mu_set_variable ("user-name", _user_name);
-
-  if (param->init) 
-    param->init (param->data);
-  
-  do {
-    scm_internal_lazy_catch (SCM_BOOL_T,
-			     catch_body, closure,
-			     param->catch_handler, param->data);
-  } while (param->next && param->next (param->data, param->mbox));
-
-  if (param->exit)
-    exit (param->exit (param->data, param->mbox));
-
-  exit (0);
-}
diff --git a/libmu_scm/mu_scm.c b/libmu_scm/mu_scm.c
index 187d8bc..7cec22a 100644
--- a/libmu_scm/mu_scm.c
+++ b/libmu_scm/mu_scm.c
@@ -217,6 +217,8 @@ mu_scm_init ()
   mu_scm_logger_init ();
   mu_scm_port_init ();
   mu_scm_mime_init ();
+  mu_scm_debug_port_init ();
+  
 #include "mu_scm.x"
 
   mu_registrar_record (MU_DEFAULT_RECORD);
diff --git a/maidag/guile.c b/maidag/guile.c
index 9e2b193..ce374be 100644
--- a/maidag/guile.c
+++ b/maidag/guile.c
@@ -32,6 +32,17 @@ scheme_check_msg (mu_message_t msg, struct mu_auth_data *auth,
   if (!initialized)
     {
       mu_guile_init (debug_guile);
+      if (!log_to_stderr)
+	{
+	  mu_debug_t debug;
+	  SCM port;
+	  
+	  mu_diag_get_debug (&debug);
+	  port = mu_scm_make_debug_port (debug, MU_DIAG_ERROR);
+	  scm_set_current_error_port(port);
+	  port = mu_scm_make_debug_port (debug, MU_DIAG_INFO);
+	  scm_set_current_output_port(port);
+	}
       initialized = 1;
     }
   mu_guile_load (prog, 0, NULL);
diff --git a/mailbox/mutil.c b/mailbox/mutil.c
index 31a5e94..df0b9f7 100644
--- a/mailbox/mutil.c
+++ b/mailbox/mutil.c
@@ -819,10 +819,10 @@ mu_unroll_symlink (char *out, size_t outsz, const char *in)
 char *
 mu_expand_path_pattern (const char *pattern, const char *username)
 {
-  const char *p, *startp;
+  const char *p;
   char *q;
   char *path;
-  int len = 0;
+  size_t len = 0;
   struct mu_auth_data *auth = NULL;
   
   for (p = pattern; *p; p++)
@@ -869,39 +869,43 @@ mu_expand_path_pattern (const char *pattern, const char *username)
   if (!path)
     return NULL;
 
-  startp = pattern;
+  p = pattern;
   q = path;
-  while (*startp && (p = strchr (startp, '%')) != NULL)
+  while (*p)
     {
-      memcpy (q, startp, p - startp);
-      q += p - startp;
-      switch (*++p)
+      size_t off = strcspn (p, "~%");
+      memcpy (q, p, off);
+      q += off;
+      p += off;
+      if (*p == '~')
 	{
-	case 'u':
-	  strcpy (q, username);
-	  q += strlen (username);
-	  break;
-	  
-	case 'h':
 	  strcpy (q, auth->dir);
 	  q += strlen (auth->dir);
-	  break;
+	  p++;
+	}
+      else if (*p)
+	switch (*++p)
+	  {
+	  case 'u':
+	    strcpy (q, username);
+	    q += strlen (username);
+	    break;
+	    
+	  case 'h':
+	    strcpy (q, auth->dir);
+	    q += strlen (auth->dir);
+	    break;
 	  
-	case '%':
-	  *q++ = '%';
-	  break;
+	  case '%':
+	    *q++ = '%';
+	    break;
 	  
-	default:
-	  *q++ = '%';
-	  *q++ = *p;
-	}
-      startp = p + 1;
-    }
-  if (*startp)
-    {
-      strcpy (q, startp);
-      q += strlen (startp);
+	  default:
+	    *q++ = '%';
+	    *q++ = *p;
+	  }
     }
+
   *q = 0;
   if (auth)
     mu_auth_data_free (auth);


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Sat Mar 28 05:47:56 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LnV8t-0005vz-Oz
	for mharc-commit-mailutils@gnu.org; Sat, 28 Mar 2009 05:47:55 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LnV8r-0005uk-QJ
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 05:47:53 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LnV8p-0005tC-N1
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 05:47:52 -0400
Received: from [199.232.76.173] (port=37317 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LnV8p-0005st-E4
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 05:47:51 -0400
Received: from savannah.gnu.org ([199.232.41.3]:49635 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LnV8p-0000AC-2J
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 05:47:51 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LnV8o-0004d7-E3
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 09:47:50 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LnV8n-0004cd-Vd
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 09:47:50 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 88260300b2288f9a2515bbf94339a949fea2c425
X-Git-Newrev: de3516ae5f7e9c792cb2aa93eba98d26ce1b240c
Message-Id: <E1LnV8n-0004cd-Vd@cvs.savannah.gnu.org>
Date: Sat, 28 Mar 2009 09:47:50 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-256-gde3516a
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 28 Mar 2009 09:47:54 -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=de3516ae5f7e9c792cb2aa93eba98d26ce1b240c

The branch, master has been updated
       via  de3516ae5f7e9c792cb2aa93eba98d26ce1b240c (commit)
      from  88260300b2288f9a2515bbf94339a949fea2c425 (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 de3516ae5f7e9c792cb2aa93eba98d26ce1b240c
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Mar 28 11:46:32 2009 +0200

    Bugfixes.
    
    * imap4d/copy.c: Set target mailbox permissions.
    * imap4d/rename.c: Remove useless variable. Add some comments.

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

Summary of changes:
 imap4d/copy.c   |   10 ++++++----
 imap4d/rename.c |   22 ++++++++++++----------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/imap4d/copy.c b/imap4d/copy.c
index eebb3f3..98d1388 100644
--- a/imap4d/copy.c
+++ b/imap4d/copy.c
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2001, 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001, 2005, 2007, 2008,
+   2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -68,6 +69,7 @@ imap4d_copy0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
   int n = 0;
   mu_mailbox_t cmbox = NULL;
   int arg = IMAP4_ARG_1 + !!isuid;
+  int ns;
   
   if (imap4d_tokbuf_argc (tok) != arg + 2)
     {
@@ -87,11 +89,11 @@ imap4d_copy0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
       return RESP_OK;
     }
 
-  mailbox_name = namespace_getfullpath (name, delim, NULL);
+  mailbox_name = namespace_getfullpath (name, delim, &ns);
 
   if (!mailbox_name)
     {
-      *err_text = "NO Create failed.";
+      *err_text = "NO Copy failed.";
       return RESP_NO;
     }
 
@@ -101,7 +103,7 @@ imap4d_copy0 (imap4d_tokbuf_t tok, int isuid, char **err_text)
   if (status == 0)
     {
       /* It SHOULD NOT automatifcllly create the mailbox. */
-      status = mu_mailbox_open (cmbox, MU_STREAM_RDWR);
+      status = mu_mailbox_open (cmbox, MU_STREAM_RDWR | mailbox_mode[ns]);
       if (status == 0)
 	{
 	  size_t i;
diff --git a/imap4d/rename.c b/imap4d/rename.c
index 279d1e6..d6cc9d4 100644
--- a/imap4d/rename.c
+++ b/imap4d/rename.c
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2001, 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001, 2005, 2007, 2008,
+   2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -44,7 +45,8 @@ imap4d_rename (struct imap4d_command *command, imap4d_tokbuf_t tok)
   const char *msg = "Completed";
   struct stat newst;
   const char *delim = "/";
-
+  int ns;
+  
   if (imap4d_tokbuf_argc (tok) != 4)
     return util_finish (command, RESP_BAD, "Invalid arguments");
   
@@ -55,7 +57,7 @@ imap4d_rename (struct imap4d_command *command, imap4d_tokbuf_t tok)
     return util_finish (command, RESP_NO, "Name Inbox is reservered");
 
   /* Allocates memory.  */
-  newname = namespace_getfullpath (newname, delim, NULL);
+  newname = namespace_getfullpath (newname, delim, &ns);
   if (!newname)
     return util_finish (command, RESP_NO, "Permission denied");
 
@@ -77,23 +79,20 @@ imap4d_rename (struct imap4d_command *command, imap4d_tokbuf_t tok)
     {
       mu_mailbox_t newmbox = NULL;
       mu_mailbox_t inbox = NULL;
-      char *name;
 
-      if (S_ISDIR(newst.st_mode))
+      if (S_ISDIR (newst.st_mode))
 	{
 	  free (newname);
 	  return util_finish (command, RESP_NO, "Cannot be a directory");
 	}
-      name = calloc (strlen ("mbox:") + strlen (newname) + 1, 1);
-      sprintf (name, "mbox:%s", newname);
       if (mu_mailbox_create (&newmbox, newname) != 0
-	  || mu_mailbox_open (newmbox, MU_STREAM_CREAT | MU_STREAM_RDWR) != 0)
+	  || mu_mailbox_open (newmbox,
+			      MU_STREAM_CREAT | MU_STREAM_RDWR
+			        | mailbox_mode[ns]) != 0)
 	{
-	  free (name);
 	  free (newname);
 	  return util_finish (command, RESP_NO, "Cannot create new mailbox");
 	}
-      free (name);
       free (newname);
 
       if (mu_mailbox_create_default (&inbox, auth_data->name) == 0 &&
@@ -125,6 +124,9 @@ imap4d_rename (struct imap4d_command *command, imap4d_tokbuf_t tok)
   oldname = namespace_getfullpath (oldname, delim, NULL);
 
   /* It must exist.  */
+  /* FIXME: 1. What if odlname or newname is a remote mailbox?
+            2. If newname is local and is in another namespace, its
+  	       permissions must be fixed */
   if (!oldname || rename (oldname, newname) != 0)
     {
       rc = RESP_NO;


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Sat Mar 28 06:19:47 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LnVdi-0006HU-T3
	for mharc-commit-mailutils@gnu.org; Sat, 28 Mar 2009 06:19:46 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LnVdh-0006HP-7H
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 06:19:45 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LnVdf-0006Go-LT
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 06:19:43 -0400
Received: from [199.232.76.173] (port=34326 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LnVdf-0006Gl-Dl
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 06:19:43 -0400
Received: from savannah.gnu.org ([199.232.41.3]:34332 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LnVdf-0003Ed-6C
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 06:19:43 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LnVde-0000aq-6E
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 10:19:42 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LnVdc-0000aK-ET
	for commit-mailutils@gnu.org; Sat, 28 Mar 2009 10:19:42 +0000
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: de3516ae5f7e9c792cb2aa93eba98d26ce1b240c
X-Git-Newrev: eecafe0fea249cfe78342dfc2bc9e2ef68e60657
Message-Id: <E1LnVdc-0000aK-ET@cvs.savannah.gnu.org>
Date: Sat, 28 Mar 2009 10:19:41 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-257-geecafe0
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 28 Mar 2009 10:19:45 -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=eecafe0fea249cfe78342dfc2bc9e2ef68e60657

The branch, master has been updated
       via  eecafe0fea249cfe78342dfc2bc9e2ef68e60657 (commit)
      from  de3516ae5f7e9c792cb2aa93eba98d26ce1b240c (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 eecafe0fea249cfe78342dfc2bc9e2ef68e60657
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Mar 28 12:19:25 2009 +0200

    Bugfixes.
    
    * libmu_scm/mailutils.scm.in: Remove leftover reference to mu_guimb.inc

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

Summary of changes:
 libmu_scm/mailutils.scm.in |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/libmu_scm/mailutils.scm.in b/libmu_scm/mailutils.scm.in
index ebc7d8a..187fd92 100644
--- a/libmu_scm/mailutils.scm.in
+++ b/libmu_scm/mailutils.scm.in
@@ -90,7 +90,6 @@ changequote([,])dnl
 
 include(BUILDDIR/mu_address.inc)
 include(BUILDDIR/mu_body.inc)
-include(BUILDDIR/mu_guimb.inc)
 include(BUILDDIR/mu_mailbox.inc)
 include(BUILDDIR/mu_message.inc)
 include(BUILDDIR/mu_mime.inc)


hooks/post-receive
--
GNU Mailutils



