From MAILER-DAEMON Tue Feb 09 05:55:54 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Nenl4-0000mQ-Cd
	for mharc-commit-mailutils@gnu.org; Tue, 09 Feb 2010 05:55:54 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Nenl2-0000mA-FL
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 05:55:52 -0500
Received: from [199.232.76.173] (port=36793 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Nenl1-0000m2-I4
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 05:55:51 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nenkx-0006Ka-Vl
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 05:55:51 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:44083
	helo=internal.in.savannah.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 1Nenkw-0006KW-CZ
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 05:55:47 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nenkv-0006zu-Va
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 10:55:46 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nenkv-0003BF-6x
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 10:55:45 +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: 68447ef06f4752ebaf1d47e4f93d2791153459c9
X-Git-Newrev: 5d370760311aaa86a16ab5bab166d9d339104cd3
Message-Id: <E1Nenkv-0003BF-6x@vcs-noshell.in.savannah.gnu.org>
Date: Tue, 09 Feb 2010 10:55:45 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-30-g5d37076
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, 09 Feb 2010 10:55: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=5d370760311aaa86a16ab5bab166d9d339104cd3

The branch, master has been updated
       via  5d370760311aaa86a16ab5bab166d9d339104cd3 (commit)
      from  68447ef06f4752ebaf1d47e4f93d2791153459c9 (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 5d370760311aaa86a16ab5bab166d9d339104cd3
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Feb 9 12:52:02 2010 +0200

    Fix compilation without sendmail.
    
    * libproto/mailer/remote.c: Fix compilation with --disable-sendmail.
    * mail/testsuite/mail/send.exp: Ignore test (return UNSUPPORTED), if
    sendmail support is not compiled.
    * sieve/testsuite/sieve/redirect.exp: Likewise.
    * sieve/testsuite/sieve/reject.exp: Likewise.

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

Summary of changes:
 libproto/mailer/remote.c           |   10 ++-
 mail/testsuite/mail/send.exp       |  137 +++++++++++++++++++-----------------
 sieve/testsuite/sieve/redirect.exp |   16 +++--
 sieve/testsuite/sieve/reject.exp   |   16 +++--
 4 files changed, 97 insertions(+), 82 deletions(-)

diff --git a/libproto/mailer/remote.c b/libproto/mailer/remote.c
index a9d08be..a99e4ab 100644
--- a/libproto/mailer/remote.c
+++ b/libproto/mailer/remote.c
@@ -27,8 +27,6 @@
 # include <config.h>
 #endif
 
-#ifdef ENABLE_SMTP
-
 #include <stdlib.h>
 #include <string.h>
 
@@ -40,6 +38,8 @@
 #include <mailer0.h>
 #include <registrar0.h>
 
+#ifdef ENABLE_SMTP
+
 static int
 _url_remote_init (mu_url_t url, const char *new_scheme)
 {
@@ -88,8 +88,12 @@ static struct _mu_record _mu_remote_smtp_record = {
 };
 
 mu_record_t mu_remote_smtp_record = &_mu_remote_smtp_record;
+#else
+mu_record_t mu_remote_smtp_record = NULL;
+#endif
 
 
+#ifdef ENABLE_SENDMAIL
 static int
 _url_remote_sendmail_init (mu_url_t url)
 {
@@ -140,9 +144,7 @@ static struct _mu_record _mu_remote_prog_record =
 
 mu_record_t mu_remote_prog_record = &_mu_remote_prog_record;
 
-
 #else
-mu_record_t mu_remote_smtp_record = NULL;
 mu_record_t mu_remote_sendmail_record = NULL;
 mu_record_t mu_remote_prog_record = NULL;
 #endif
diff --git a/mail/testsuite/mail/send.exp b/mail/testsuite/mail/send.exp
index 726cffb..5576f06 100644
--- a/mail/testsuite/mail/send.exp
+++ b/mail/testsuite/mail/send.exp
@@ -17,81 +17,86 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA.
 
-mail_start "--file=%mbox1"
+mail_version
 
-mail_command "set sendmail=\"sendmail:$top_builddir/examples/mta\""
-mail_command "set inplacealiases"
-mail_command "setenv MTA_DIAG=\"$MU_FOLDER_DIR/mta.diag\""
+if ![mu_check_capability ENABLE_SENDMAIL] {
+    unsupported "Support for sendmail not compiled in"
+} else {
+    mail_start "--file=%mbox1"
 
-mail_test -noprompt "reply 1" \
+    mail_command "set sendmail=\"sendmail:$top_builddir/examples/mta\""
+    mail_command "set inplacealiases"
+    mail_command "setenv MTA_DIAG=\"$MU_FOLDER_DIR/mta.diag\""
+
+    mail_test -noprompt "reply 1" \
 	"To: <foobar@nonexistent.net>,<bar@dontmailme.org>"\
 	"Subject: Re: Jabberwocky"\
 	""
 
-mail_test -noprompt "~m"\
+    mail_test -noprompt "~m"\
 	"Interpolating: 1"\
 	"(continue)"
+    
+    mail_test "." 
 
-mail_test "." 
-
-mail_stop
-
-mu_test_file "$MU_FOLDER_DIR/mta.diag" \
--re "ENVELOPE FROM: \[^\r\n\]*"\
-"ENVELOPE TO: <foobar@nonexistent.net>,<bar@dontmailme.org>"\
-"   0: To: <foobar@nonexistent.net>,<bar@dontmailme.org>"\
-"   1: Subject: Re: Jabberwocky"\
-"   2: In-Reply-To: Your message of Fri, 28 Dec 2001 22:18:08 +0200"\
-"   3: \t<200112282018.fBSKI8N04906@nonexistent.net>"\
-"   4: References: <200112282018.fBSKI8N04906@nonexistent.net>"\
-"   5: X-Mailer: mail (GNU Mailutils $MU_TOOL_VERSION)"\
-"   6: "\
-"   7: > Received: (from foobar@nonexistent.net)"\
-"   8: > 	by nonexistent.net id fBSKI8N04906"\
-"   9: > 	for bar@dontmailme.org; Fri, 28 Dec 2001 22:18:08 +0200"\
-"  10: > Date: Fri, 28 Dec 2001 22:18:08 +0200"\
-"  11: > From: Foo Bar <foobar@nonexistent.net>"\
-"  12: > Message-Id: <200112282018.fBSKI8N04906@nonexistent.net>"\
-"  13: > To: Bar <bar@dontmailme.org>"\
-"  14: > Subject: Jabberwocky"\
-"  15: >"\
-"  16: > `Twas brillig, and the slithy toves"\
-"  17: > Did gyre and gimble in the wabe;"\
-"  18: > All mimsy were the borogoves,"\
-"  19: > And the mome raths outgrabe."\
-"  20: > "\
-"  21: > `Beware the Jabberwock, my son!"\
-"  22: > The jaws that bite, the claws that catch!"\
-"  23: > Beware the Jujub bird, and shun"\
-"  24: > The frumious Bandersnatch!'"\
-"  25: > "\
-"  26: > He took his vorpal sword in hand:"\
-"  27: > Long time the manxome foe he sought --"\
-"  28: > So rested he by the Tumtum gree,"\
-"  29: > And stood awhile in thought."\
-"  30: > "\
-"  31: > And as in uffish thought he stood,"\
-"  32: > The Jabberwock, with eyes of flame,"\
-"  33: > Came whiffling through the tulgey wook,"\
-"  34: > And burbled as it came!"\
-"  35: > "\
-"  36: > One, two!  One, two!  And through and through"\
-"  37: > The vorpal blade went snicker-snack!"\
-"  38: > He left it dead, and with its head"\
-"  39: > He went galumphing back."\
-"  40: > "\
-"  41: > `And has thou slain the Jabberwock?"\
-"  42: > Come to my arms, my beamish boy!"\
-"  43: > O frabjous day!  Calloh!  Callay!"\
-"  44: > He chortled in his joy."\
-"  45: > "\
-"  46: > `Twas brillig, and the slithy toves"\
-"  47: > Did gyre and gimble in the wabe;"\
-"  48: > All mimsy were the borogoves,"\
-"  49: > And the mome raths outgrabe."\
-"  50: > "\
-"  51: "\
-"END OF MESSAGE"
+    mail_stop
 
+    mu_test_file "$MU_FOLDER_DIR/mta.diag" \
+	-re "ENVELOPE FROM: \[^\r\n\]*"\
+	"ENVELOPE TO: <foobar@nonexistent.net>,<bar@dontmailme.org>"\
+	"   0: To: <foobar@nonexistent.net>,<bar@dontmailme.org>"\
+	"   1: Subject: Re: Jabberwocky"\
+	"   2: In-Reply-To: Your message of Fri, 28 Dec 2001 22:18:08 +0200"\
+	"   3: \t<200112282018.fBSKI8N04906@nonexistent.net>"\
+	"   4: References: <200112282018.fBSKI8N04906@nonexistent.net>"\
+	"   5: X-Mailer: mail (GNU Mailutils $MU_TOOL_VERSION)"\
+	"   6: "\
+	"   7: > Received: (from foobar@nonexistent.net)"\
+	"   8: > 	by nonexistent.net id fBSKI8N04906"\
+	"   9: > 	for bar@dontmailme.org; Fri, 28 Dec 2001 22:18:08 +0200"\
+	"  10: > Date: Fri, 28 Dec 2001 22:18:08 +0200"\
+	"  11: > From: Foo Bar <foobar@nonexistent.net>"\
+	"  12: > Message-Id: <200112282018.fBSKI8N04906@nonexistent.net>"\
+	"  13: > To: Bar <bar@dontmailme.org>"\
+	"  14: > Subject: Jabberwocky"\
+	"  15: >"\
+	"  16: > `Twas brillig, and the slithy toves"\
+	"  17: > Did gyre and gimble in the wabe;"\
+	"  18: > All mimsy were the borogoves,"\
+	"  19: > And the mome raths outgrabe."\
+	"  20: > "\
+	"  21: > `Beware the Jabberwock, my son!"\
+	"  22: > The jaws that bite, the claws that catch!"\
+	"  23: > Beware the Jujub bird, and shun"\
+	"  24: > The frumious Bandersnatch!'"\
+	"  25: > "\
+	"  26: > He took his vorpal sword in hand:"\
+	"  27: > Long time the manxome foe he sought --"\
+	"  28: > So rested he by the Tumtum gree,"\
+	"  29: > And stood awhile in thought."\
+	"  30: > "\
+	"  31: > And as in uffish thought he stood,"\
+	"  32: > The Jabberwock, with eyes of flame,"\
+	"  33: > Came whiffling through the tulgey wook,"\
+	"  34: > And burbled as it came!"\
+	"  35: > "\
+	"  36: > One, two!  One, two!  And through and through"\
+	"  37: > The vorpal blade went snicker-snack!"\
+	"  38: > He left it dead, and with its head"\
+	"  39: > He went galumphing back."\
+	"  40: > "\
+	"  41: > `And has thou slain the Jabberwock?"\
+	"  42: > Come to my arms, my beamish boy!"\
+	"  43: > O frabjous day!  Calloh!  Callay!"\
+	"  44: > He chortled in his joy."\
+	"  45: > "\
+	"  46: > `Twas brillig, and the slithy toves"\
+	"  47: > Did gyre and gimble in the wabe;"\
+	"  48: > All mimsy were the borogoves,"\
+	"  49: > And the mome raths outgrabe."\
+	"  50: > "\
+	"  51: "\
+	"END OF MESSAGE"
+}
 
 # End of send.exp
diff --git a/sieve/testsuite/sieve/redirect.exp b/sieve/testsuite/sieve/redirect.exp
index d782c80..c947000 100644
--- a/sieve/testsuite/sieve/redirect.exp
+++ b/sieve/testsuite/sieve/redirect.exp
@@ -17,14 +17,18 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA.
 
-set mtafile "$MU_FOLDER_DIR/mta.diag"
-set env(MTA_DIAG) "$mtafile"
-set env(MTA_APPEND) 1
+mu_version
+if ![mu_check_capability ENABLE_SENDMAIL] {
+    unsupported "Support for sendmail not compiled in"
+} else {
+    set mtafile "$MU_FOLDER_DIR/mta.diag"
+    set env(MTA_DIAG) "$mtafile"
+    set env(MTA_APPEND) 1
 
-set mailer "sendmail:$top_builddir/examples/mta"
-
-sieve_driver_test "Redirect" "$mailer" "$mtafile"
+    set mailer "sendmail:$top_builddir/examples/mta"
 
+    sieve_driver_test "Redirect" "$mailer" "$mtafile"
+}
 # End of redirect.exp	
 
 
diff --git a/sieve/testsuite/sieve/reject.exp b/sieve/testsuite/sieve/reject.exp
index c2a2c48..2a904a7 100644
--- a/sieve/testsuite/sieve/reject.exp
+++ b/sieve/testsuite/sieve/reject.exp
@@ -17,14 +17,18 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 USA.
 
-set mtafile "$MU_FOLDER_DIR/mta.diag"
-set env(MTA_DIAG) "$mtafile"
-set env(MTA_APPEND) 1
+mu_version
+if ![mu_check_capability ENABLE_SENDMAIL] {
+    unsupported "Support for sendmail not compiled in"
+} else {
+    set mtafile "$MU_FOLDER_DIR/mta.diag"
+    set env(MTA_DIAG) "$mtafile"
+    set env(MTA_APPEND) 1
 
-set mailer "sendmail:$top_builddir/examples/mta"
-
-sieve_driver_test "Reject" "$mailer" "$mtafile"
+    set mailer "sendmail:$top_builddir/examples/mta"
 
+    sieve_driver_test "Reject" "$mailer" "$mtafile"
+}
 # End of reject.exp	
 
 


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Tue Feb 09 06:19:44 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Neo88-00081O-GW
	for mharc-commit-mailutils@gnu.org; Tue, 09 Feb 2010 06:19:44 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Neo87-00081J-Lf
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 06:19:43 -0500
Received: from [199.232.76.173] (port=57050 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Neo87-00081B-8x
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 06:19:43 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <INVALID.NOREPLY@gnu.org>) id 1Neo85-0000KC-AD
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 06:19:43 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:56363
	helo=internal.in.savannah.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 1Neo84-0000Jy-KM
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 06:19:40 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Neo84-0007FY-3p
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 11:19:40 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Neo83-0004mJ-U4
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 11:19:40 +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: 5d370760311aaa86a16ab5bab166d9d339104cd3
X-Git-Newrev: 5f97b64945c9be3f50ca7ffc664ff87a08bd7a9b
Message-Id: <E1Neo83-0004mJ-U4@vcs-noshell.in.savannah.gnu.org>
Date: Tue, 09 Feb 2010 11:19:39 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-32-g5f97b64
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, 09 Feb 2010 11:19:43 -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=5f97b64945c9be3f50ca7ffc664ff87a08bd7a9b

The branch, master has been updated
       via  5f97b64945c9be3f50ca7ffc664ff87a08bd7a9b (commit)
       via  58e8f4267dce75055f074a02afcc98df1d1e5cea (commit)
      from  5d370760311aaa86a16ab5bab166d9d339104cd3 (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 5f97b64945c9be3f50ca7ffc664ff87a08bd7a9b
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Feb 9 13:09:58 2010 +0200

    Fix improperly placed variable declarations.
    
    * imap4d/id.c
    * libproto/imap/folder.c
    * libproto/pop/mbox.c
    * sieve/sieve.c

commit 58e8f4267dce75055f074a02afcc98df1d1e5cea
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Feb 9 13:08:30 2010 +0200

    Minor fix.
    
    * sieve/testsuite/sieve/ext.exp [!HAVE_LIBLTDL]: Use unsupported
    instead of returning 0.

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

Summary of changes:
 imap4d/id.c                   |    2 +-
 libproto/imap/folder.c        |    6 ++++--
 libproto/pop/mbox.c           |    4 +++-
 sieve/sieve.c                 |    4 +++-
 sieve/testsuite/sieve/ext.exp |    9 ++++-----
 5 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/imap4d/id.c b/imap4d/id.c
index 39105d0..f8c261c 100644
--- a/imap4d/id.c
+++ b/imap4d/id.c
@@ -173,10 +173,10 @@ imap4d_id (struct imap4d_command *command, imap4d_tokbuf_t tok)
   if (imap4d_id_list)
     {
       mu_iterator_t itr;
-      mu_list_get_iterator (imap4d_id_list, &itr);
       int i;
       int outcnt = 0;
       
+      mu_list_get_iterator (imap4d_id_list, &itr);
       for (i = 0, mu_iterator_first (itr);
 	   i < 30 && !mu_iterator_is_done (itr);
 	   i++, mu_iterator_next (itr))
diff --git a/libproto/imap/folder.c b/libproto/imap/folder.c
index 215cfc7..77e7919 100644
--- a/libproto/imap/folder.c
+++ b/libproto/imap/folder.c
@@ -574,10 +574,12 @@ static int
 imap_writer (void *iodata, char *buf)
 {
   f_imap_t iop = iodata;
+  int status;
+    
   MU_DEBUG2 (iop->folder->debug, MU_DEBUG_PROT, "g%lu %s\n",
              (unsigned long)iop->seq, buf);
-  int status = imap_writeline (iop, "g%lu %s\r\n",
-                               (unsigned long)iop->seq++, buf);
+  status = imap_writeline (iop, "g%lu %s\r\n",
+			   (unsigned long)iop->seq++, buf);
   CHECK_ERROR (iop, status);
   status = imap_send (iop);
   CHECK_ERROR (iop, status);
diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index 7cbe08c..a9e28d5 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -729,8 +729,10 @@ static int
 pop_writer (void *iodata, char *buf)
 {
   pop_data_t iop = iodata;
+  int status;
+  
   MU_DEBUG1 (iop->mbox->debug, MU_DEBUG_PROT, "%s\n", buf);
-  int status = pop_writeline (iop, "%s\r\n", buf);
+  status = pop_writeline (iop, "%s\r\n", buf);
   CHECK_ERROR (iop, status);
   status = pop_write (iop);
   CHECK_ERROR (iop, status);
diff --git a/sieve/sieve.c b/sieve/sieve.c
index 5cb55f8..c02b5d8 100644
--- a/sieve/sieve.c
+++ b/sieve/sieve.c
@@ -271,9 +271,11 @@ cb_debug (mu_debug_t debug, void *data, mu_config_value_t *val)
 static int
 cb_email (mu_debug_t debug, void *data, mu_config_value_t *val)
 {
+  int rc;
+  
   if (mu_cfg_assert_value_type (val, MU_CFG_STRING, debug))
     return 1;
-  int rc = mu_set_user_email (val->v.string);
+  rc = mu_set_user_email (val->v.string);
   if (rc)
     mu_cfg_format_error (debug, MU_DEBUG_ERROR, _("invalid email: %s"),
 			 mu_strerror (rc));
diff --git a/sieve/testsuite/sieve/ext.exp b/sieve/testsuite/sieve/ext.exp
index 3afcff8..ac34c44 100644
--- a/sieve/testsuite/sieve/ext.exp
+++ b/sieve/testsuite/sieve/ext.exp
@@ -19,10 +19,9 @@
 
 mu_version
 if ![mu_check_capability HAVE_LIBLTDL] {
-    exit 0
-}
-
-sieve_test --clearpath -L "${top_builddir}/examples" -f ${MU_SPOOL_DIR}/bigto.mbox numaddr.sv -pattern \
+    unsupported "This test requires libltdl"
+} else {
+    sieve_test --clearpath -L "${top_builddir}/examples" -f ${MU_SPOOL_DIR}/bigto.mbox numaddr.sv -pattern \
 	"DISCARD on msg uid 1: marking as deleted"
-
+}
 # End of ext.exp


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Tue Feb 09 09:30:55 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ner79-0005T5-Eo
	for mharc-commit-mailutils@gnu.org; Tue, 09 Feb 2010 09:30:55 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ner78-0005Sk-Cz
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 09:30:54 -0500
Received: from [199.232.76.173] (port=46425 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ner77-0005SK-Jt
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 09:30:53 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ner6q-0008HD-Ds
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 09:30:44 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:54750
	helo=internal.in.savannah.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 1Ner6l-0008Gc-Gp
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 09:30:31 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ner6k-0001Aa-FL
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 14:30:30 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ner6j-0007C6-H0
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 14:30:30 +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: 5f97b64945c9be3f50ca7ffc664ff87a08bd7a9b
X-Git-Newrev: 2235ee278c7b50002ba54e0f1e5ae5ef143f5629
Message-Id: <E1Ner6j-0007C6-H0@vcs-noshell.in.savannah.gnu.org>
Date: Tue, 09 Feb 2010 14:30:30 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-34-g2235ee2
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, 09 Feb 2010 14:30: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=2235ee278c7b50002ba54e0f1e5ae5ef143f5629

The branch, master has been updated
       via  2235ee278c7b50002ba54e0f1e5ae5ef143f5629 (commit)
       via  7cdb5991a67eb355434b2457abcd3b931b6602de (commit)
      from  5f97b64945c9be3f50ca7ffc664ff87a08bd7a9b (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 2235ee278c7b50002ba54e0f1e5ae5ef143f5629
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Feb 9 16:30:01 2010 +0200

    Fix TLS stream leak.
    
    * libmu_auth/tls.c (_tls_destroy): Destroy underlying streams,
    unless MU_STREAM_NO_CLOSE is set.
    (_tls_close): Likewise for close.

commit 7cdb5991a67eb355434b2457abcd3b931b6602de
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Feb 9 16:04:43 2010 +0200

    Bugfixes.
    
    * libproto/imap/mbox.c (imap_append_message0): Send trailing CRLF,
    not just LF.
    * mailbox/cfg_parser.y (mu_cfg_parse): Zero out _mu_cfg_debug
    to avoid destroying it doubly.
    * mailbox/mbx_default.c (plus_expand): Remove unused variable.

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

Summary of changes:
 libmu_auth/tls.c      |   25 +++++++++++++++++++++++--
 libproto/imap/mbox.c  |    4 ++--
 mailbox/cfg_parser.y  |    1 +
 mailbox/mbx_default.c |    2 +-
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/libmu_auth/tls.c b/libmu_auth/tls.c
index 7a4970d..9d28f9e 100644
--- a/libmu_auth/tls.c
+++ b/libmu_auth/tls.c
@@ -258,6 +258,8 @@ static void
 _tls_destroy (mu_stream_t stream)
 {
   struct _tls_stream *s = mu_stream_get_owner (stream);
+  int flags;
+  
   if (x509_cred)
     gnutls_certificate_free_credentials (x509_cred);
   if (s->session && s->state == state_closed)
@@ -266,6 +268,15 @@ _tls_destroy (mu_stream_t stream)
       s->state = state_destroyed;
     }
   _auth_lb_destroy (&s->lb);
+
+  mu_stream_get_flags (stream, &flags);
+  if (!(flags & MU_STREAM_NO_CLOSE))
+    {
+      int same_stream = s->strin == s->strout;
+      mu_stream_destroy (&s->strin, mu_stream_get_owner (s->strin));
+      if (!same_stream)
+	mu_stream_destroy (&s->strout, mu_stream_get_owner (s->strout));
+    }
   free (s);
 }
     
@@ -371,11 +382,21 @@ static int
 _tls_close (mu_stream_t stream)
 {
   struct _tls_stream *s = mu_stream_get_owner (stream);
+  int flags;
+  
   if (s->session && s->state == state_open)
     {
       gnutls_bye (s->session, GNUTLS_SHUT_RDWR);
       s->state = state_closed;
     }
+  
+  mu_stream_get_flags (stream, &flags);
+  if (!(flags & MU_STREAM_NO_CLOSE))
+    {
+      mu_stream_close (s->strin);
+      if (s->strin != s->strout)
+	mu_stream_close (s->strout);
+    }
   return 0;
 }
 
@@ -578,7 +599,7 @@ _tls_wait (mu_stream_t stream, int *pflags, struct timeval *tvp)
    mu_tls_stream_create_client will malfunction */
 int
 mu_tls_stream_create (mu_stream_t *stream,
-		   mu_stream_t strin, mu_stream_t strout, int flags)
+		      mu_stream_t strin, mu_stream_t strout, int flags)
 {
   struct _tls_stream *s;
   int rc;
@@ -618,7 +639,7 @@ mu_tls_stream_create (mu_stream_t *stream,
 
 int
 mu_tls_stream_create_client (mu_stream_t *stream,
-			  mu_stream_t strin, mu_stream_t strout, int flags)
+			     mu_stream_t strin, mu_stream_t strout, int flags)
 {
   struct _tls_stream *s;
   int rc;
diff --git a/libproto/imap/mbox.c b/libproto/imap/mbox.c
index d31957a..3bf1d1b 100644
--- a/libproto/imap/mbox.c
+++ b/libproto/imap/mbox.c
@@ -1081,8 +1081,8 @@ imap_append_message0 (mu_mailbox_t mailbox, mu_message_t msg)
 	  }
 	f_imap->state = IMAP_APPEND_ACK;
       }
-      /* !@#%$ UW-IMAP server hack: insists on the last line.  */
-      imap_writeline (f_imap, "\n");
+      /* !@#%$ UW-IMAP and Gimap server hack: both insist on the last line.  */
+      imap_writeline (f_imap, "\r\n");
       status = imap_send (f_imap);
       CHECK_EAGAIN (f_imap, status);
 
diff --git a/mailbox/cfg_parser.y b/mailbox/cfg_parser.y
index a8bd044..f938526 100644
--- a/mailbox/cfg_parser.y
+++ b/mailbox/cfg_parser.y
@@ -442,6 +442,7 @@ mu_cfg_parse (mu_cfg_tree_t **ptree)
 
   tree = mu_alloc (sizeof (*tree));
   tree->debug = _mu_cfg_debug;
+  _mu_cfg_debug = NULL;
   tree->head = parse_head;
   tree->tail = parse_tail;
   tree->pool = mu_cfg_lexer_pool ();
diff --git a/mailbox/mbx_default.c b/mailbox/mbx_default.c
index e135a82..e970d15 100644
--- a/mailbox/mbx_default.c
+++ b/mailbox/mbx_default.c
@@ -270,7 +270,7 @@ plus_expand (const char *file, char **buf)
 {
   char *home;
   const char *folder_dir = mu_folder_directory ();
-  int status, len;
+  int len;
 
   home = get_homedir (NULL);
   if (!home)


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Tue Feb 09 17:49:37 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Neytk-0003Ln-Ob
	for mharc-commit-mailutils@gnu.org; Tue, 09 Feb 2010 17:49:36 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Neyti-0003KM-Nb
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 17:49:34 -0500
Received: from [199.232.76.173] (port=53923 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Neyti-0003KC-AC
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 17:49:34 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <INVALID.NOREPLY@gnu.org>) id 1NeytT-00028X-AJ
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 17:49:32 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:47961
	helo=internal.in.savannah.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 1NeytQ-00028L-Iy
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 17:49:17 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NeytP-000796-Rr
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 22:49:15 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NeytP-0004AX-EB
	for commit-mailutils@gnu.org; Tue, 09 Feb 2010 22:49: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: 2235ee278c7b50002ba54e0f1e5ae5ef143f5629
X-Git-Newrev: 88c2fc773ed17a22beebaabafc9c8ce8ecfc939d
Message-Id: <E1NeytP-0004AX-EB@vcs-noshell.in.savannah.gnu.org>
Date: Tue, 09 Feb 2010 22:49:15 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-35-g88c2fc7
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, 09 Feb 2010 22:49:34 -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=88c2fc773ed17a22beebaabafc9c8ce8ecfc939d

The branch, master has been updated
       via  88c2fc773ed17a22beebaabafc9c8ce8ecfc939d (commit)
      from  2235ee278c7b50002ba54e0f1e5ae5ef143f5629 (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 88c2fc773ed17a22beebaabafc9c8ce8ecfc939d
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Feb 10 00:32:00 2010 +0200

    Fix memory override in smtp.c code. Fix ESMTP capability parsing.
    
    * mailbox/base64.c (mu_base64_encode): Make sure output buffer
    is null-terminated.
    * imap4d/auth_gss.c (auth_gssapi): Assume buffer returned
    by mu_base64_encode is null-terminated.
    * libproto/mailer/smtp.c (cram_md5): Take challenge_len
    as argument. All callers updated.
    (smtp_auth): Fix eventual memory override. Assume buffer returned
    by mu_base64_encode is nul-terminated.
    (smtp_parse_ehlo_ack): Fix capability parsing: (a) do not depend
    on the continuation marker ('-' or ' ') and (b) fix parsing of
    the SIZE capablity.
    Move call to mu_rtrim_cset out of the internal loop.

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

Summary of changes:
 imap4d/auth_gss.c      |    6 +++---
 libproto/mailer/smtp.c |   45 ++++++++++++++++++++++-----------------------
 mailbox/base64.c       |    8 ++++----
 3 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/imap4d/auth_gss.c b/imap4d/auth_gss.c
index a231137..e85c258 100644
--- a/imap4d/auth_gss.c
+++ b/imap4d/auth_gss.c
@@ -192,7 +192,7 @@ auth_gssapi (struct imap4d_command *command,
 	  if (outbuf.length)
 	    {
 	      mu_base64_encode (outbuf.value, outbuf.length, &tmp, &size);
-	      util_send ("+ %*.*s\r\n", size, size, tmp);
+	      util_send ("+ %s\r\n", tmp);
 	      free (tmp);
 	      gss_release_buffer (&min_stat, &outbuf);
 	    }
@@ -212,7 +212,7 @@ auth_gssapi (struct imap4d_command *command,
   if (outbuf.length)
     {
       mu_base64_encode (outbuf.value, outbuf.length, &tmp, &size);
-      util_send ("+ %*.*s\r\n", size, size, tmp);
+      util_send ("+ %s\r\n", tmp);
       free (tmp);
       gss_release_buffer (&min_stat, &outbuf);
       imap4d_getline (&token_str, &token_size, &token_len);
@@ -232,7 +232,7 @@ auth_gssapi (struct imap4d_command *command,
     }
   
   mu_base64_encode (outbuf.value, outbuf.length, &tmp, &size);
-  util_send ("+ %*.*s\r\n", size, size, tmp);
+  util_send ("+ %s\r\n", tmp);
   free (tmp);
 
   imap4d_getline (&token_str, &token_size, &token_len);
diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index 07b9db3..32ccb66 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -630,13 +630,13 @@ smtp_starttls (smtp_t smtp)
 }
 
 static void
-cram_md5 (char *secret, unsigned char *challenge, unsigned char *digest)
+cram_md5 (char *secret, unsigned char *challenge, size_t challenge_len, 
+          unsigned char *digest)
 {
   struct mu_md5_ctx context;
   unsigned char   ipad[64];
   unsigned char   opad[64];
   int             secret_len;
-  int             challenge_len;
   int             i;
 
   if (secret == 0 || challenge == 0)
@@ -766,7 +766,7 @@ smtp_auth (smtp_t smtp)
       mu_rtrim_cset (p, "\r\n");
       mu_base64_decode ((unsigned char*) p, strlen (p), &chl, &chlen);
 
-      cram_md5 ((char *) mu_secret_password (secret), chl, digest);
+      cram_md5 ((char *) mu_secret_password (secret), chl, chlen, digest);
       mu_secret_password_unref (secret);
       free (chl);
 
@@ -776,7 +776,6 @@ smtp_auth (smtp_t smtp)
       mu_asnprintf (&buf, &buflen, "%s %s", user, ascii_digest);
       buflen = strlen (buf);
       mu_base64_encode ((unsigned char*) buf, buflen, &b64buf, &b64buflen);
-      b64buf[b64buflen] = '\0';
       free (buf);
 
       status = smtp_writeline (smtp, "%s\r\n", b64buf);
@@ -818,7 +817,6 @@ smtp_auth (smtp_t smtp)
 	    buf[c] = '\0';
 	}
       mu_base64_encode ((unsigned char*) buf, buflen, &b64buf, &b64buflen);
-      b64buf[b64buflen] = '\0';
       free (buf);
 
       status = smtp_writeline (smtp, "AUTH PLAIN %s\r\n", b64buf);
@@ -1398,42 +1396,43 @@ smtp_parse_ehlo_ack (smtp_t smtp)
       status = smtp_readline (smtp);
       if ((smtp->ptr - smtp->buffer) > 4 && smtp->buffer[3] == '-')
 	multi = 1;
-      if (status == 0)
+      if (status == 0 && memcmp (smtp->buffer, "250", 3) == 0)
 	{
+	  char *capa_str = smtp->buffer + 4;
+
 	  smtp->ptr = smtp->buffer;
 
-	  if (!mu_c_strncasecmp (smtp->buffer, "250-STARTTLS", 12))
+	  if (!mu_c_strncasecmp (capa_str, "STARTTLS", 8))
 	    smtp->capa |= CAPA_STARTTLS;
-	  else if (!mu_c_strncasecmp (smtp->buffer, "250-SIZE", 8))
+	  else if (!mu_c_strncasecmp (capa_str, "SIZE", 4))
 	    {
+	      char  *p;
+	      size_t n;
+	      
 	      smtp->capa |= CAPA_SIZE;
-	      if (smtp->buffer[8] == '=')
-		{
-		  char           *p;
-		  size_t          n = strtoul (smtp->buffer + 9, &p, 10);
-
-		  if (*p != '\n')
-		    MU_DEBUG1 (smtp->mailer->debug, MU_DEBUG_ERROR,
-			       "suspicious size declaration: %s",
-			       smtp->buffer);
-		  else
-		    smtp->max_size = n;
-		}
+
+	      n = strtoul (capa_str + 5, &p, 10);
+	      if (*p != '\n')
+		MU_DEBUG1 (smtp->mailer->debug, MU_DEBUG_ERROR,
+			   "suspicious size capability: %s",
+			   smtp->buffer);
+	      else
+		smtp->max_size = n;
 	    }
-	  else if (!mu_c_strncasecmp (smtp->buffer, "250-AUTH", 8))
+	  else if (!mu_c_strncasecmp (capa_str, "AUTH", 4))
 	    {
 	      char           *name, *s;
 
 	      smtp->capa |= CAPA_AUTH;
 
-	      for (name = strtok_r (smtp->buffer + 8, " ", &s); name;
+	      for (name = strtok_r (capa_str + 5, " ", &s); name;
 		   name = strtok_r (NULL, " ", &s))
 		{
 		  struct auth_mech_record *mechs = auth_mech_list;
 
+		  mu_rtrim_cset (name, "\r\n");
 		  for (; mechs->name; mechs++)
 		    {
-		      mu_rtrim_cset (name, "\r\n");
 		      if (!mu_c_strcasecmp (mechs->name, name))
 			{
 			  smtp->auth_mechs |= mechs->id;
diff --git a/mailbox/base64.c b/mailbox/base64.c
index 4c67a48..65e8f5c 100644
--- a/mailbox/base64.c
+++ b/mailbox/base64.c
@@ -26,11 +26,11 @@
 
 int
 mu_base64_encode (const unsigned char *input, size_t input_len,
-		  unsigned char **output, size_t * output_len)
+		  unsigned char **output, size_t *output_len)
 {
   static char b64tab[] =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-  size_t olen = 4 * (input_len + 2) / 3;
+  size_t olen = 4 * (input_len + 2) / 3 + 1;
   unsigned char *out = malloc (olen);
 
   if (!out)
@@ -42,7 +42,6 @@ mu_base64_encode (const unsigned char *input, size_t input_len,
       *out++ = b64tab[((input[0] << 4) & 0x30) | (input[1] >> 4)];
       *out++ = b64tab[((input[1] << 2) & 0x3c) | (input[2] >> 6)];
       *out++ = b64tab[input[2] & 0x3f];
-      olen -= 4;
       input_len -= 3;
       input += 3;
     }
@@ -58,12 +57,13 @@ mu_base64_encode (const unsigned char *input, size_t input_len,
       *out++ = '=';
     }
   *output_len = out - *output;
+  *out = 0;
   return 0;
 }
 
 int
 mu_base64_decode (const unsigned char *input, size_t input_len,
-		  unsigned char **output, size_t * output_len)
+		  unsigned char **output, size_t *output_len)
 {
   static int b64val[128] = {
     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Thu Feb 11 01:35:13 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1NfSds-0007s3-TS
	for mharc-commit-mailutils@gnu.org; Thu, 11 Feb 2010 01:35:12 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NfSdq-0007rg-JC
	for commit-mailutils@gnu.org; Thu, 11 Feb 2010 01:35:10 -0500
Received: from [199.232.76.173] (port=38531 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NfSdp-0007rW-Df
	for commit-mailutils@gnu.org; Thu, 11 Feb 2010 01:35:09 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim
	4.60) (envelope-from <INVALID.NOREPLY@gnu.org>) id 1NfSdn-0007Vg-N5
	for commit-mailutils@gnu.org; Thu, 11 Feb 2010 01:35:09 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:53683
	helo=internal.in.savannah.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 1NfSdn-0007VW-Fz
	for commit-mailutils@gnu.org; Thu, 11 Feb 2010 01:35:07 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NfSdn-0004jV-11
	for commit-mailutils@gnu.org; Thu, 11 Feb 2010 06:35:07 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NfSdm-00083F-W2
	for commit-mailutils@gnu.org; Thu, 11 Feb 2010 06:35:06 +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: 88c2fc773ed17a22beebaabafc9c8ce8ecfc939d
X-Git-Newrev: f9766e22019f9d1fa51351b339b75137450be73f
Message-Id: <E1NfSdm-00083F-W2@vcs-noshell.in.savannah.gnu.org>
Date: Thu, 11 Feb 2010 06:35:06 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-36-gf9766e2
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, 11 Feb 2010 06:35:11 -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=f9766e22019f9d1fa51351b339b75137450be73f

The branch, master has been updated
       via  f9766e22019f9d1fa51351b339b75137450be73f (commit)
      from  88c2fc773ed17a22beebaabafc9c8ce8ecfc939d (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 f9766e22019f9d1fa51351b339b75137450be73f
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Feb 11 08:36:14 2010 +0200

    Bugfix
    
    * libproto/mailer/smtp.c (cram_md5): Remove left-over
    assignment to challenge_len.

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

Summary of changes:
 libproto/mailer/smtp.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index 32ccb66..f5a6f1c 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -643,7 +643,6 @@ cram_md5 (char *secret, unsigned char *challenge, size_t challenge_len,
     return;
 
   secret_len = strlen (secret);
-  challenge_len = strlen ((char*) challenge);
   memset (ipad, 0, sizeof (ipad));
   memset (opad, 0, sizeof (opad));
 


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Wed Feb 17 16:20:18 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1NhrJi-0007x1-N8
	for mharc-commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:20:18 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NhrJg-0007w6-Fq
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:20:16 -0500
Received: from [140.186.70.92] (port=44292 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NhrJf-0007vY-89
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:20:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NhrJe-000397-Nk
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:20:15 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:56191
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NhrJe-00038z-Jp
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:20:14 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NhrJe-0004HY-CN
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 21:20:14 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NhrJd-0003Xr-Tk
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 21:20:14 +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: f9766e22019f9d1fa51351b339b75137450be73f
X-Git-Newrev: bb3a903e6c9e590ba8397219255d399c99621042
Message-Id: <E1NhrJd-0003Xr-Tk@vcs-noshell.in.savannah.gnu.org>
Date: Wed, 17 Feb 2010 21:20:14 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-37-gbb3a903
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, 17 Feb 2010 21:20:16 -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=bb3a903e6c9e590ba8397219255d399c99621042

The branch, master has been updated
       via  bb3a903e6c9e590ba8397219255d399c99621042 (commit)
      from  f9766e22019f9d1fa51351b339b75137450be73f (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 bb3a903e6c9e590ba8397219255d399c99621042
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Feb 17 23:19:21 2010 +0200

    Bugfix
    
    * libproto/mbox/mbox.c (mbox_append_message): Fix qid calculation.

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

Summary of changes:
 libproto/mbox/mbox.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c
index d073c02..826098d 100644
--- a/libproto/mbox/mbox.c
+++ b/libproto/mbox/mbox.c
@@ -1263,7 +1263,7 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg)
 {
   int status = 0;
   mbox_data_t mud = mailbox->data;
-  mu_off_t size;
+  mu_off_t qid;
   
   if (msg == NULL || mud == NULL)
     return EINVAL;
@@ -1284,9 +1284,11 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg)
 
     default:
       {
+	mu_off_t size;
 	/* Move to the end of the file, not necesary if _APPEND mode.  */
 	if ((status = mu_stream_size (mailbox->stream, &size)) != 0
-	    || (status = mbox_append_message0 (mailbox, msg,
+	    || (qid = size,
+	        status = mbox_append_message0 (mailbox, msg,
 					       &size, 0, 0)) != 0)
 	  {
 	    if (status != EAGAIN)
@@ -1300,7 +1302,7 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg)
   if (mailbox->observable)
     {
       char *buf = NULL;
-      mu_asprintf (&buf, "%lu", (unsigned long) size);
+      mu_asprintf (&buf, "%lu", (unsigned long) qid);
       mu_observable_notify (mailbox->observable, MU_EVT_MESSAGE_APPEND, buf);
       free (buf);
     }


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Wed Feb 17 16:38:03 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Nhras-0000pg-Uf
	for mharc-commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:38:03 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Nhrar-0000oj-Di
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:38:01 -0500
Received: from [140.186.70.92] (port=47724 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Nhraq-0000o8-Hu
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:38:01 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nhraq-0005G0-0a
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:38:00 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:46476
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nhrap-0005Fw-V2
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 16:37:59 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nhrap-0004Rr-Sj
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 21:37:59 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nhrap-0004MP-ML
	for commit-mailutils@gnu.org; Wed, 17 Feb 2010 21:37:59 +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: bb3a903e6c9e590ba8397219255d399c99621042
X-Git-Newrev: 9d392215f9a067fd1951b2d727371fd2f682036a
Message-Id: <E1Nhrap-0004MP-ML@vcs-noshell.in.savannah.gnu.org>
Date: Wed, 17 Feb 2010 21:37:59 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-38-g9d39221
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, 17 Feb 2010 21:38: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=9d392215f9a067fd1951b2d727371fd2f682036a

The branch, master has been updated
       via  9d392215f9a067fd1951b2d727371fd2f682036a (commit)
      from  bb3a903e6c9e590ba8397219255d399c99621042 (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 9d392215f9a067fd1951b2d727371fd2f682036a
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Feb 17 23:35:55 2010 +0200

    Minor fix
    
    * mail/send.c (mail_send0): Pipe message to the program if
    the value of sendmail variable begins with a slash.
    Otherwise, issue meaningful error messages if the mailer cannot
    be created or opened.

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

Summary of changes:
 mail/send.c |   46 ++++++++++++++++++++++++++++------------------
 1 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/mail/send.c b/mail/send.c
index 7ebdaaa..6538a49 100644
--- a/mail/send.c
+++ b/mail/send.c
@@ -594,30 +594,40 @@ mail_send0 (compose_env_t * env, int save_to)
 		  || compose_header_get (env, MU_HEADER_BCC, NULL))
 		{
 		  char *sendmail;
-		  if (mailvar_get (&sendmail, "sendmail", mailvar_type_string, 0) 
-                       == 0)
+		  if (mailvar_get (&sendmail, "sendmail",
+				   mailvar_type_string, 0) == 0)
 		    {
-		      int status = mu_mailer_create (&mailer, sendmail);
-		      if (status == 0)
+		      if (sendmail[0] == '/')
+			msg_to_pipe (sendmail, msg);
+		      else
 			{
-			  if (mailvar_get (NULL, "verbose", mailvar_type_boolean, 0)
-			      == 0)
-			    {
-			      mu_debug_t debug = NULL;
-			      mu_mailer_get_debug (mailer, &debug);
-			      mu_debug_set_level (debug,
-				         MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
-			    }
-			  status = mu_mailer_open (mailer, MU_STREAM_RDWR);
+			  int status = mu_mailer_create (&mailer, sendmail);
 			  if (status == 0)
 			    {
-			      mu_mailer_send_message (mailer, msg, NULL, NULL);
-			      mu_mailer_close (mailer);
+			      if (mailvar_get (NULL, "verbose",
+					       mailvar_type_boolean, 0) == 0)
+				{
+				  mu_debug_t debug = NULL;
+				  mu_mailer_get_debug (mailer, &debug);
+				  mu_debug_set_level (debug,
+						      MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
+				}
+			      status = mu_mailer_open (mailer, MU_STREAM_RDWR);
+			      if (status == 0)
+				{
+				  mu_mailer_send_message (mailer, msg,
+							  NULL, NULL);
+				  mu_mailer_close (mailer);
+				}
+			      else
+				util_error (_("Cannot open mailer: %s"),
+					    mu_strerror (status));
+			      mu_mailer_destroy (&mailer);
 			    }
-			  mu_mailer_destroy (&mailer);
+			  else
+			    util_error (_("Cannot create mailer: %s"),
+					mu_strerror (status));
 			}
-		      if (status != 0)
-			msg_to_pipe (sendmail, msg);
 		    }
 		  else
 		    util_error (_("Variable sendmail not set: no mailer"));


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Fri Feb 19 10:06:50 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1NiURO-0000NQ-RB
	for mharc-commit-mailutils@gnu.org; Fri, 19 Feb 2010 10:06:50 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NiURN-0000NL-RF
	for commit-mailutils@gnu.org; Fri, 19 Feb 2010 10:06:49 -0500
Received: from [140.186.70.92] (port=36453 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NiURM-0000ND-38
	for commit-mailutils@gnu.org; Fri, 19 Feb 2010 10:06:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NiURK-0001kd-LG
	for commit-mailutils@gnu.org; Fri, 19 Feb 2010 10:06:48 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:38530
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NiURK-0001kY-Hf
	for commit-mailutils@gnu.org; Fri, 19 Feb 2010 10:06:46 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NiURK-0000Vb-80
	for commit-mailutils@gnu.org; Fri, 19 Feb 2010 15:06:46 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NiURJ-0002PL-T5
	for commit-mailutils@gnu.org; Fri, 19 Feb 2010 15:06: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: 9d392215f9a067fd1951b2d727371fd2f682036a
X-Git-Newrev: 5781e1f68d451a0930060f166a376ba38a88fad2
Message-Id: <E1NiURJ-0002PL-T5@vcs-noshell.in.savannah.gnu.org>
Date: Fri, 19 Feb 2010 15:06:45 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-41-g5781e1f
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, 19 Feb 2010 15:06:50 -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=5781e1f68d451a0930060f166a376ba38a88fad2

The branch, master has been updated
       via  5781e1f68d451a0930060f166a376ba38a88fad2 (commit)
       via  2cb1d3573e8f0e8ebcf34e511d80abbee5b0dfec (commit)
       via  35ac66f0561ccd6d46f83262d56bebccb83fed40 (commit)
      from  9d392215f9a067fd1951b2d727371fd2f682036a (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 5781e1f68d451a0930060f166a376ba38a88fad2
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Feb 19 15:56:32 2010 +0200

    Implement new list functions.
    
    * include/mailutils/list.h (_mu_list_ptr_comparator)
    (mu_list_insert_list, mu_list_append_list)
    (mu_list_prepend_list): New prototypes.
    * libproto/include/list0.h (_mu_list_insert_sublist): New prototype.
    * mailbox/listlist.c: New function.
    * mailbox/Makefile.am (libmailutils_la_SOURCES): Add listlist.c.
    * mailbox/list.c: Remove unnecessary parentheses.
    (def_comp): Rename to _mu_list_ptr_comparator.
    Remove static qualifier. All uses updated.
    (_insert_item): Remove.
    (mu_list_insert): Use _mu_list_insert_sublist instead of _insert_item.
    * examples/listop.c (print): Print number of elements.
    (count): New function.
    (ins): Use mu_list_insert if only one new element was given,
    mu_list_insert_list otherwise.
    (help): Update.
    (main)<count>: New keyword.
    * mailbox/testsuite/mailbox/list.exp: Update. Add new tests.

commit 2cb1d3573e8f0e8ebcf34e511d80abbee5b0dfec
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Feb 19 13:30:15 2010 +0200

    Minor fixes.
    
    * mailbox/attachment.c (MAX_HDR_LEN): Remove unused define.
    * sieve/sieve.c (parser) <ARGP_KEY_NO_ARGS>: Don't check for
    the script,
    (main): ... do it here, instead.

commit 35ac66f0561ccd6d46f83262d56bebccb83fed40
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Feb 19 13:23:45 2010 +0200

    Work around a libtool bug.
    
    * configure.ac [WITH_GSSAPI]: Remove any -Wl directives from GSSAPI_LIBS.

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

Summary of changes:
 configure.ac                       |   21 +++++-
 examples/listop.c                  |  105 +++++++++++++++++++++------
 include/mailutils/list.h           |   13 +++-
 libproto/include/list0.h           |    6 ++
 mailbox/Makefile.am                |    1 +
 mailbox/attachment.c               |    1 -
 mailbox/list.c                     |  111 +++++++++++------------------
 mailbox/listlist.c                 |  137 ++++++++++++++++++++++++++++++++++++
 mailbox/testsuite/mailbox/list.exp |   49 +++++++++++++-
 sieve/sieve.c                      |   12 ++--
 10 files changed, 353 insertions(+), 103 deletions(-)
 create mode 100644 mailbox/listlist.c

diff --git a/configure.ac b/configure.ac
index 84fb2af..29a7600 100644
--- a/configure.ac
+++ b/configure.ac
@@ -256,7 +256,26 @@ if test "x$WITH_GSSAPI" != "xno"; then
     AC_CACHE_SAVE
     AC_MSG_RESULT([GSSAPI libraries not found])
   else
-    SERV_AUTHLIBS="$SERV_AUTHLIBS $GSSAPI_LIBS"
+    # Output produced by `krb5-config --libs' may contain `-Wl,-rpath -Wl,DIR'
+    # options. Once they are added to SERV_AUTHLIBS, libtool, when creating
+    # relink command line in wrapper files for executables, places them at the
+    # beginnig of the option list and adds its own -rpath directives at
+    # the end. Executables created by such command will look for the runtime
+    # libraries first in DIR and then in the local tree subdirectories. Thus,
+    # if DIR contains libraries from a previous installation of Mailutils, the
+    # programs will use old libraries.
+    #
+    # Obviously, libtool should be fixed to place user-added -rpath directives
+    # after the ones added by it. For the time being I work around this bug by
+    # removing any -Wl directives from GSSAPI_LIBS.
+    #
+    for arg in $GSSAPI_LIBS
+    do
+      case $arg in
+      -Wl,*) ;;
+      *)     SERV_AUTHLIBS="$SERV_AUTHLIBS $arg"
+      esac
+    done
     SERV_AUTHINCS="$SERV_AUTHINCS $GSSAPI_CFLAGS"
     IMAP_AUTHOBJS="$IMAP_AUTHOBJS auth_gss.o"
     AC_DEFINE(WITH_GSSAPI,1,[Define if mailutils is using GSSAPI])
diff --git a/examples/listop.c b/examples/listop.c
index a92f911..971cfee 100644
--- a/examples/listop.c
+++ b/examples/listop.c
@@ -44,13 +44,20 @@ void
 print (mu_list_t list)
 {
   mu_iterator_t itr;
+  size_t count;
   int rc;
   
   rc = mu_list_get_iterator (list, &itr);
   if (rc)
     lperror ("mu_list_get_iterator", rc);
 
-  for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next (itr))
+  rc = mu_list_count (list, &count);
+  if (rc)
+    lperror ("mu_iterator_current", rc);
+
+  printf ("# items: %lu\n", (unsigned long) count);
+  for (mu_iterator_first (itr); !mu_iterator_is_done (itr);
+       mu_iterator_next (itr))
     {
       char *text;
 
@@ -63,6 +70,19 @@ print (mu_list_t list)
 }
 
 void
+count (mu_list_t list)
+{
+  size_t n;
+  int rc;
+
+  rc = mu_list_count (list, &n);
+  if (rc)
+    lperror ("mu_iterator_current", rc);
+  else
+    printf ("%lu\n", (unsigned long) n);
+}
+
+void
 next (mu_iterator_t itr, char *arg)
 {
   int skip = arg ? strtoul (arg, NULL, 0) :  1;
@@ -130,41 +150,75 @@ prep (mu_list_t list, int argc, char **argv)
     }
 }
 
+static int
+read_list (mu_list_t list, int argc, char **argv)
+{
+  int rc;
+  
+  for (; argc; argc--, argv++)
+    {
+      rc = mu_list_append (list, strdup (*argv));
+      if (rc)
+	break;
+    }
+  return rc;
+}
+
 void
 ins (mu_list_t list, int argc, char **argv)
 {
+  int an;
   int rc;
   char *item;
-  char *new_item;
+  int insert_before = 0;
   
-  if (argc < 3 || argc > 4)
+  if (argc < 3)
     {
-      fprintf (stderr, "ins [before] item new_item?\n");
+      fprintf (stderr, "ins [before] item new_item [new_item*]?\n");
       return;
     }
 
-  if (argc == 4)
+  an = 1;
+  if (strcmp (argv[1], "before") == 0)
     {
-      if (strcmp (argv[1], "before"))
-	{
-	  fprintf (stderr, "ins before item new_item?\n");
-	  return;
-	}
-	
-      item = argv[2];
-      new_item = argv[3];
+      an++;
+      insert_before = 1;
     }
-  else
+  else if (strcmp (argv[1], "after") == 0)
     {
-      item = argv[1];
-      new_item = argv[2];
+      an++;
+      insert_before = 0;
     }
+
+  item = argv[an++];
   
-  rc = mu_list_insert (list, item, strdup (new_item), argc == 4);
+  if (an + 1 == argc)
+    rc = mu_list_insert (list, item, strdup (argv[an]), insert_before);
+  else
+    {
+      mu_list_t tmp;
+      
+      rc = mu_list_create (&tmp);
+      if (rc)
+	{
+	  fprintf (stderr, "creating temp list: %s\n", mu_strerror (rc));
+	  return;
+	}
+
+      rc = read_list (tmp, argc - an, argv + an);
+      if (rc)
+	{
+	  fprintf (stderr, "reading temp list: %s\n", mu_strerror (rc));
+	  return;
+	}
+      rc = mu_list_insert_list (list, item, tmp, insert_before);
+      mu_list_destroy (&tmp);
+    }
+
   if (rc)
-    fprintf (stderr, "mu_list_insert: %s\n", mu_strerror (rc));
+    lperror ("mu_list_insert", rc);
 }
-
+  
 
 void
 repl (mu_list_t list, int argc, char **argv)
@@ -232,14 +286,15 @@ find (mu_iterator_t itr, char *arg)
 void
 help ()
 {
+  printf ("count\n");
   printf ("next [count]\n");
   printf ("first\n");
   printf ("find item\n");
-  printf ("del item [item...]\n");
-  printf ("add item [item...]\n");
-  printf ("prep item [item...]\n");
+  printf ("del item [item*]\n");
+  printf ("add item [item*]\n");
+  printf ("prep item [item*]\n");
   printf ("repl old_item new_item\n");
-  printf ("ins [before] item new_item\n");
+  printf ("ins [before|after] item new_item [new_item*]\n");
   printf ("print\n");
   printf ("quit\n");
   printf ("iter num\n");
@@ -285,7 +340,9 @@ shell (mu_list_t list)
 
       if (argc > 0)
 	{
-	  if (strcmp (argv[0], "next") == 0)
+	  if (strcmp (argv[0], "count") == 0)
+	    count (list);
+	  else if (strcmp (argv[0], "next") == 0)
 	    next (itr[num], argv[1]);
 	  else if (strcmp (argv[0], "first") == 0)
 	    mu_iterator_first (itr[num]);
diff --git a/include/mailutils/list.h b/include/mailutils/list.h
index cbe31d9..ef29bca 100644
--- a/include/mailutils/list.h
+++ b/include/mailutils/list.h
@@ -41,12 +41,14 @@ extern int mu_list_to_array (mu_list_t list, void **array, size_t count, size_t
 extern int mu_list_locate   (mu_list_t list, void *item, void **ret_item);
 extern int mu_list_get_iterator (mu_list_t, mu_iterator_t *);
 
-typedef int mu_list_action_t (void* item, void* cbdata);
-  
-extern int mu_list_do       (mu_list_t list, mu_list_action_t * action, void *cbdata);
+typedef int mu_list_action_t (void *item, void *cbdata);
+
+extern int mu_list_do       (mu_list_t list, mu_list_action_t *action, void *cbdata);
 
 typedef int (*mu_list_comparator_t) (const void*, const void*);
 
+extern int _mu_list_ptr_comparator (const void*, const void*);
+  
 extern mu_list_comparator_t mu_list_set_comparator (mu_list_t,
 						    mu_list_comparator_t);
 extern int mu_list_get_comparator (mu_list_t, mu_list_comparator_t *);
@@ -59,6 +61,11 @@ extern int mu_list_intersect_dup (mu_list_t *, mu_list_t, mu_list_t,
 				  int (*dup_item) (void **, void *, void *),
 				  void *);
 extern int mu_list_intersect (mu_list_t *, mu_list_t, mu_list_t);  
+
+extern int mu_list_insert_list (mu_list_t list, void *item, mu_list_t new_list,
+				int insert_before);
+extern void mu_list_append_list (mu_list_t list, mu_list_t new_list);
+extern void mu_list_prepend_list (mu_list_t list, mu_list_t new_list);
   
 #ifdef __cplusplus
 }
diff --git a/libproto/include/list0.h b/libproto/include/list0.h
index 697f750..530d9fa 100644
--- a/libproto/include/list0.h
+++ b/libproto/include/list0.h
@@ -51,6 +51,12 @@ struct _mu_list
   struct _mu_iterator *itr;
 };
 
+extern void _mu_list_insert_sublist (mu_list_t list,
+				     struct list_data *current,
+				     struct list_data *head,
+				     struct list_data *tail,
+				     size_t count,
+				     int insert_before);
 
 #ifdef __cplusplus
 }
diff --git a/mailbox/Makefile.am b/mailbox/Makefile.am
index 1019e7b..9982187 100644
--- a/mailbox/Makefile.am
+++ b/mailbox/Makefile.am
@@ -86,6 +86,7 @@ libmailutils_la_SOURCES = \
  ipsrv.c\
  kwd.c\
  list.c\
+ listlist.c\
  locale.c\
  locker.c\
  mailbox.c\
diff --git a/mailbox/attachment.c b/mailbox/attachment.c
index 0940904..34332d4 100644
--- a/mailbox/attachment.c
+++ b/mailbox/attachment.c
@@ -45,7 +45,6 @@
 #include <mailutils/errno.h>
 #include <mailutils/mutil.h>
 
-#define MAX_HDR_LEN 256
 #define BUF_SIZE	2048
 
 struct _msg_info
diff --git a/mailbox/list.c b/mailbox/list.c
index 8d2d2a1..f598281 100644
--- a/mailbox/list.c
+++ b/mailbox/list.c
@@ -40,14 +40,14 @@ mu_list_create (mu_list_t *plist)
   list = calloc (sizeof (*list), 1);
   if (list == NULL)
     return ENOMEM;
-  status = mu_monitor_create (&(list->monitor), 0,  list);
+  status = mu_monitor_create (&list->monitor, 0,  list);
   if (status != 0)
     {
       free (list);
       return status;
     }
-  list->head.next = &(list->head);
-  list->head.prev = &(list->head);
+  list->head.next = &list->head;
+  list->head.prev = &list->head;
   *plist = list;
   return 0;
 }
@@ -62,7 +62,7 @@ mu_list_destroy (mu_list_t *plist)
       struct list_data *previous;
 
       mu_monitor_wrlock (list->monitor);
-      for (current = list->head.next; current != &(list->head);)
+      for (current = list->head.next; current != &list->head;)
 	{
 	  previous = current;
 	  current = current->next;
@@ -71,7 +71,7 @@ mu_list_destroy (mu_list_t *plist)
 	  free (previous);
 	}
       mu_monitor_unlock (list->monitor);
-      mu_monitor_destroy (&(list->monitor), list);
+      mu_monitor_destroy (&list->monitor, list);
       free (list);
       *plist = NULL;
     }
@@ -91,7 +91,7 @@ mu_list_append (mu_list_t list, void *item)
     return ENOMEM;
   ldata->item = item;
   mu_monitor_wrlock (list->monitor);
-  ldata->next = &(list->head);
+  ldata->next = &list->head;
   ldata->prev = list->head.prev;
   last->next = ldata;
   list->head.prev = ldata;
@@ -114,7 +114,7 @@ mu_list_prepend (mu_list_t list, void *item)
     return ENOMEM;
   ldata->item = item;
   mu_monitor_wrlock (list->monitor);
-  ldata->prev = &(list->head);
+  ldata->prev = &list->head;
   ldata->next = list->head.next;
   first->prev = ldata;
   list->head.next = ldata;
@@ -164,8 +164,8 @@ mu_list_get_comparator (mu_list_t list, mu_list_comparator_t *comp)
   return 0;
 }
 
-static int
-def_comp (const void *item, const void *value)
+int
+_mu_list_ptr_comparator (const void *item, const void *value)
 {
   return item != value;
 }
@@ -179,10 +179,10 @@ mu_list_locate (mu_list_t list, void *item, void **ret_item)
 
   if (list == NULL)
     return EINVAL;
-  comp = list->comp ? list->comp : def_comp;
+  comp = list->comp ? list->comp : _mu_list_ptr_comparator;
   mu_monitor_wrlock (list->monitor);
-  for (previous = &(list->head), current = list->head.next;
-       current != &(list->head); previous = current, current = current->next)
+  for (previous = &list->head, current = list->head.next;
+       current != &list->head; previous = current, current = current->next)
     {
       if (comp (current->item, item) == 0)
 	{
@@ -196,43 +196,6 @@ mu_list_locate (mu_list_t list, void *item, void **ret_item)
   return status;
 }
 
-static int
-_insert_item(mu_list_t list, struct list_data *current, void *new_item,
-	     int insert_before)
-{
-  struct list_data *ldata = calloc (sizeof (*ldata), 1);
-  if (ldata == NULL)
-    return ENOMEM;
-
-  ldata->item = new_item;
-  if (insert_before)
-    {
-      ldata->prev = current->prev;
-      ldata->next = current;
-      if (current->prev != &list->head)
-	current->prev->next = ldata;
-      else
-	list->head.next = ldata;
-
-      current->prev = ldata;
-    }
-  else
-    {
-      ldata->next = current->next;
-      ldata->prev = current;
-      
-      if (current->next != &list->head)
-	current->next->prev = ldata;
-      else
-	list->head.prev = ldata;
-
-      current->next = ldata;
-    }
-  
-  list->count++;
-  return 0;
-}
-
 int
 mu_list_insert (mu_list_t list, void *item, void *new_item, int insert_before)
 {
@@ -242,16 +205,27 @@ mu_list_insert (mu_list_t list, void *item, void *new_item, int insert_before)
 
   if (list == NULL)
     return EINVAL;
-  comp = list->comp ? list->comp : def_comp;
+  comp = list->comp ? list->comp : _mu_list_ptr_comparator;
 
   mu_monitor_wrlock (list->monitor);
   for (current = list->head.next;
-       current != &(list->head);
+       current != &list->head;
        current = current->next)
     {
       if (comp (current->item, item) == 0)
 	{
-	  status = _insert_item (list, current, new_item, insert_before);
+	  struct list_data *ldata = calloc (sizeof (*ldata), 1);
+	  if (ldata == NULL)
+	    status = ENOMEM;
+	  else
+	    {
+	      ldata->item = new_item;
+	      _mu_list_insert_sublist (list, current,
+				       ldata, ldata,
+				       1,
+				       insert_before);
+	      status = 0;
+	    }
 	  break;
 	}
     }
@@ -268,10 +242,10 @@ mu_list_remove (mu_list_t list, void *item)
 
   if (list == NULL)
     return EINVAL;
-  comp = list->comp ? list->comp : def_comp;
+  comp = list->comp ? list->comp : _mu_list_ptr_comparator;
   mu_monitor_wrlock (list->monitor);
-  for (previous = &(list->head), current = list->head.next;
-       current != &(list->head); previous = current, current = current->next)
+  for (previous = &list->head, current = list->head.next;
+       current != &list->head; previous = current, current = current->next)
     {
       if (comp (current->item, item) == 0)
 	{
@@ -297,10 +271,10 @@ mu_list_replace (mu_list_t list, void *old_item, void *new_item)
 
   if (list == NULL)
     return EINVAL;
-  comp = list->comp ? list->comp : def_comp;
+  comp = list->comp ? list->comp : _mu_list_ptr_comparator;
   mu_monitor_wrlock (list->monitor);
-  for (previous = &(list->head), current = list->head.next;
-       current != &(list->head); previous = current, current = current->next)
+  for (previous = &list->head, current = list->head.next;
+       current != &list->head; previous = current, current = current->next)
     {
       if (comp (current->item, old_item) == 0)
 	{
@@ -325,7 +299,7 @@ mu_list_get (mu_list_t list, size_t indx, void **pitem)
   if (pitem == NULL)
     return MU_ERR_OUT_PTR_NULL;
   mu_monitor_rdlock (list->monitor);
-  for (current = list->head.next, count = 0; current != &(list->head);
+  for (current = list->head.next, count = 0; current != &list->head;
        current = current->next, count++)
     {
       if (count == indx)
@@ -340,7 +314,7 @@ mu_list_get (mu_list_t list, size_t indx, void **pitem)
 }
 
 int
-mu_list_do (mu_list_t list, mu_list_action_t * action, void *cbdata)
+mu_list_do (mu_list_t list, mu_list_action_t *action, void *cbdata)
 {
   mu_iterator_t itr;
   int status = 0;
@@ -350,7 +324,8 @@ mu_list_do (mu_list_t list, mu_list_action_t * action, void *cbdata)
   status = mu_list_get_iterator(list, &itr);
   if (status)
     return status;
-  for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next (itr))
+  for (mu_iterator_first (itr); !mu_iterator_is_done (itr);
+       mu_iterator_next (itr))
     {
       void *item;
       mu_iterator_current (itr, &item);
@@ -386,7 +361,7 @@ mu_list_to_array (mu_list_t list, void **array, size_t count, size_t *pcount)
       struct list_data *current;
 
       for (i = 0, current = list->head.next;
-	   i < total && current != &(list->head); current = current->next)
+	   i < total && current != &list->head; current = current->next)
 	array[i++] = current->item;
     }
   if (pcount)
@@ -394,15 +369,15 @@ mu_list_to_array (mu_list_t list, void **array, size_t count, size_t *pcount)
   return 0;
 }
 
-/* Computes an intersection of the two lists. The resulting list,
-   stored into PDEST, contains elements from the list A that are
-   also encountered in the list B, using the comparison function of
-   the latter.
+/* Computes an intersection of two lists and returns it in PDEST.
+   The resulting list contains elements from A that are
+   also encountered in B (as per comparison function of
+   the latter).
 
-   If DUP_ITEM is not NULL, it is used to create copies of the
+   If DUP_ITEM is not NULL, it is used to create copies of
    items to be stored in PDEST.  In this case, the destroy_item
    function of B is also attached to PDEST.  Otherwise, if
-   DUP_ITEM is NULL, the pointers to the elements are stored and
+   DUP_ITEM is NULL, pointers to elements are stored and
    no destroy_item function is assigned. */
 int
 mu_list_intersect_dup (mu_list_t *pdest, mu_list_t a, mu_list_t b,
diff --git a/mailbox/listlist.c b/mailbox/listlist.c
new file mode 100644
index 0000000..d566710
--- /dev/null
+++ b/mailbox/listlist.c
@@ -0,0 +1,137 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007, 2008, 2010 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 */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <list0.h>
+#include <iterator0.h>
+#include <mailutils/errno.h>
+
+void
+_mu_list_insert_sublist (mu_list_t list,
+			 struct list_data *current,
+			 struct list_data *head,
+			 struct list_data *tail,
+			 size_t count,
+			 int insert_before)
+{
+  if (insert_before)
+    {
+      head->prev = current->prev;
+      tail->next = current;
+      if (current->prev != &list->head)
+	current->prev->next = head;
+      else
+	list->head.next = head;
+
+      current->prev = tail;
+    }
+  else
+    {
+      tail->next = current->next;
+      head->prev = current;
+      if (current->next != &list->head)
+	current->next->prev = tail;
+      else
+	list->head.prev = tail;
+
+      current->next = head;
+    }
+  list->count += count;
+}
+
+static void
+clear_list (mu_list_t list)
+{
+  list->head.next = list->head.prev = &list->head;
+  list->count = 0;
+}
+
+int
+mu_list_insert_list (mu_list_t list, void *item, mu_list_t new_list,
+		     int insert_before)
+{
+  struct list_data *current;
+  mu_list_comparator_t comp;
+  int status = MU_ERR_NOENT;
+
+  if (list == NULL)
+    return EINVAL;
+  comp = list->comp ? list->comp : _mu_list_ptr_comparator;
+
+  mu_monitor_wrlock (list->monitor);
+  for (current = list->head.next;
+       current != &list->head;
+       current = current->next)
+    {
+      if (comp (current->item, item) == 0)
+	{
+	  _mu_list_insert_sublist (list, current,
+				   new_list->head.next, new_list->head.prev,
+				   new_list->count,
+				   insert_before);
+	  clear_list (new_list);
+	  status = 0;
+	  break;
+	}
+    }
+  mu_monitor_unlock (list->monitor);
+  return status;
+}
+
+void
+mu_list_append_list (mu_list_t list, mu_list_t new_list)
+{
+  if (list->count == 0)
+    {
+      list->head = new_list->head;
+      list->count = new_list->count;
+    }
+  else
+    _mu_list_insert_sublist (list, list->head.prev,
+			     new_list->head.next, new_list->head.prev,
+			     new_list->count,
+			     0);
+  clear_list (new_list);
+}
+
+void
+mu_list_prepend_list (mu_list_t list, mu_list_t new_list)
+{
+  if (list->count == 0)
+    {
+      list->head = new_list->head;
+      list->count = new_list->count;
+    }
+  else
+    _mu_list_insert_sublist (list, list->head.next,
+			     new_list->head.next, new_list->head.prev,
+			     new_list->count,
+			     1);
+  clear_list (new_list);
+}
+
+
+
diff --git a/mailbox/testsuite/mailbox/list.exp b/mailbox/testsuite/mailbox/list.exp
index c081520..062d8e2 100644
--- a/mailbox/testsuite/mailbox/list.exp
+++ b/mailbox/testsuite/mailbox/list.exp
@@ -50,6 +50,7 @@ mailbox_prog_start "${top_builddir}/examples/listop"
 
 mailbox_prog_command "add en to tre fire fem"
 mailbox_prog_test "print" \
+        "# items: 5" \
 	"en" \
 	"to" \
 	"tre" \
@@ -78,6 +79,7 @@ prompt_iterator 0
 prompt_text "fem"
 mailbox_prog_test "iter 0"
 mailbox_prog_test "print" \
+        "# items: 3" \
 	"en" \
 	"to" \
 	"fem"
@@ -85,6 +87,7 @@ mailbox_prog_test "print" \
 mailbox_prog_command "prep jeden dwa trzy cztery"
 
 mailbox_prog_test "print" \
+        "# items: 7" \
 	"cztery" \
 	"trzy" \
 	"dwa" \
@@ -110,6 +113,7 @@ mailbox_prog_test "next 2"
 
 mailbox_prog_command "ins jeden un"
 mailbox_prog_test "print" \
+        "# items: 7" \
 	"3" \
 	"dwa" \
 	"jeden" \
@@ -120,6 +124,7 @@ mailbox_prog_test "print" \
 
 mailbox_prog_command "ins before jeden zero"
 mailbox_prog_test "print" \
+        "# items: 8" \
 	"3" \
 	"dwa" \
         "zero" \
@@ -136,6 +141,7 @@ mailbox_prog_command "ins before un cero"
 mailbox_prog_command "ins un dos"
 
 mailbox_prog_test "print" \
+        "# items: 10" \
 	"3" \
 	"dwa" \
         "zero" \
@@ -149,6 +155,7 @@ mailbox_prog_test "print" \
 
 mailbox_prog_command "ins before 3 1"
 mailbox_prog_test "print" \
+        "# items: 11" \
         "1" \
 	"3" \
 	"dwa" \
@@ -163,6 +170,7 @@ mailbox_prog_test "print" \
 
 mailbox_prog_command "ins before 3 2"
 mailbox_prog_test "print" \
+        "# items: 12" \
         "1" \
         "2" \
 	"3" \
@@ -173,9 +181,48 @@ mailbox_prog_test "print" \
         "un" \
         "dos" \
 	"en" \
-	"to" \
+ 	"to" \
 	"fem"
 
+mailbox_prog_command "ins 3 4 5 6"
+mailbox_prog_test "print" \
+    "# items: 15" \
+    "1" \
+    "2" \
+    "3" \
+    "4" \
+    "5" \
+    "6" \
+    "dwa" \
+    "zero" \
+    "jeden" \
+    "cero" \
+    "un" \
+    "dos" \
+    "en" \
+    "to" \
+    "fem"
+
+mailbox_prog_command "ins before dwa zero jeden"
+mailbox_prog_test "print" \
+    "# items: 17" \
+    "1" \
+    "2" \
+    "3" \
+    "4" \
+    "5" \
+    "6" \
+    "zero" \
+    "jeden" \
+    "dwa" \
+    "zero" \
+    "jeden" \
+    "cero" \
+    "un" \
+    "dos" \
+    "en" \
+    "to" \
+    "fem"
 
 mailbox_prog_send "quit"
 mailbox_prog_stop
diff --git a/sieve/sieve.c b/sieve/sieve.c
index c02b5d8..5aa3430 100644
--- a/sieve/sieve.c
+++ b/sieve/sieve.c
@@ -231,11 +231,6 @@ parser (int key, char *arg, struct argp_state *state)
       script = mu_tilde_expansion (arg, "/", NULL);
       break;
 
-    case ARGP_KEY_NO_ARGS:
-      if (!mu_help_config_mode)
-	argp_error (state, _("SCRIPT must be specified"));
-      return ARGP_ERR_UNKNOWN;
-      
     case ARGP_KEY_INIT:
       mu_argp_node_list_init (&lst);
       break;
@@ -243,6 +238,7 @@ parser (int key, char *arg, struct argp_state *state)
     case ARGP_KEY_FINI:
       mu_argp_node_list_finish (&lst, NULL, NULL);
       break;
+      
     default:
       return ARGP_ERR_UNKNOWN;
     }
@@ -499,6 +495,12 @@ main (int argc, char *argv[])
 		   argc, argv, ARGP_IN_ORDER, NULL, NULL))
     exit (EX_USAGE);
 
+  if (!script)
+    {
+      mu_error (_("script must be specified"));
+      exit (EX_USAGE);
+    }
+  
   /* Sieve interpreter setup. */
   rc = mu_sieve_machine_init (&mach, NULL);
   if (rc)


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Sat Feb 20 13:23:21 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Nitz6-0004i5-RN
	for mharc-commit-mailutils@gnu.org; Sat, 20 Feb 2010 13:23:20 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Nitz2-0004fM-4Q
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 13:23:16 -0500
Received: from [140.186.70.92] (port=50466 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Nityz-0004e1-Ke
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 13:23:15 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nityx-0002Gu-K9
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 13:23:13 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:45924
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nityx-0002Gq-GH
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 13:23:11 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nityx-0003Fw-9r
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 18:23:11 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Nityw-0008DP-W8
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 18:23:11 +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: 5781e1f68d451a0930060f166a376ba38a88fad2
X-Git-Newrev: 1413567bfd73bfb39404201a4fc19a4d23dae3ec
Message-Id: <E1Nityw-0008DP-W8@vcs-noshell.in.savannah.gnu.org>
Date: Sat, 20 Feb 2010 18:23:11 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-43-g1413567
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, 20 Feb 2010 18:23:19 -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=1413567bfd73bfb39404201a4fc19a4d23dae3ec

The branch, master has been updated
       via  1413567bfd73bfb39404201a4fc19a4d23dae3ec (commit)
       via  a192c1115ffc99fe631826cd6f17ce00f4d22820 (commit)
      from  5781e1f68d451a0930060f166a376ba38a88fad2 (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 1413567bfd73bfb39404201a4fc19a4d23dae3ec
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Feb 20 20:19:45 2010 +0200

    Mu_list_replace and mu_list_remove actually reclaim the memory associated with the item.
    
    * include/mailutils/iterator.h (mu_itrctl_delete_nd)
    (mu_itrctl_replace_nd): New mu_itrctl_req constants.
    * include/mailutils/list.h (mu_list_remove_nd)
    (mu_list_replace_nd): New prototypes.
    (mu_list_destroy_item_t): New typedef.
    (mu_list_set_destroy_item): Return mu_list_destroy_item_t.
    * mailbox/list.c (DESTROY_ITEM): New macro.
    (mu_list_destroy): Use DESTROY_ITEM.
    (mu_list_remove, mu_list_replace): Actually destroy the
    item being removed.
    (mu_list_remove_nd, mu_list_replace_nd): New functions.
    (mu_list_set_destroy_item): Return previous value of
    destroy_item.
    (list_itrctl): Handle mu_itrctl_delete_nd and mu_itrctl_replace_nd.
    
    * mailbox/observer.c (mu_observable_create): Register destroy_item
    function.
    (mu_observable_destroy): Remove explicit loop. Rely on destroy_item
    instead.
    (mu_observable_detach): Use mu_iterator_ctl to actually
    remove the event.
    * mh/mh_alias.y (_insert_list): Remove.
    (alias_expand_list): Use mu_iterator_ctl to insert
    replacement list and remove the current item.
    * mh/sortm.c (addop): Register destroy_item function.
    (remop): Remove call to free.
    * movemail/movemail.c (main): <uidl loop>: Use mu_itrctl_delete
    to remove items.
    
    * libmu_sieve/util.c: Minor change.
    
    * mail/util.c (util_slist_compare): New static function.
    (util_slist_add): Register destroy_item and comparison
    functions for the new list.
    (util_slist_remove,util_slist_destroy): Rewrite.
    
    * imap4d/authenticate.c (auth_add): Use mu_list_free_item as
    destroy_item function.
    * imap4d/util.c (util_register_event): Likewise.
    
    * include/mailutils/cpp/list.h (List)<set_destroy_item>: Change
    return value.
    * libmu_cpp/list.cc (List::set_destroy_item): Reflect changes to
    mu_list_set_destroy_item.
    * libmu_argp/common.c: Include stdlib.h

commit a192c1115ffc99fe631826cd6f17ce00f4d22820
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Feb 20 14:20:12 2010 +0200

    Implement `iterator_ctl' function.
    
    * include/mailutils/iterator.h (mu_itrctl_req): New enum.
    (mu_iterator_skip, mu_iterator_ctl)
    (mu_iterator_set_itrctl): New prototypes.
    * include/mailutils/list.h (mu_list_free_item): New prototype.
    * libproto/include/iterator0.h (struct _mu_iterator)<itrctl>: New method.
    * libproto/include/list0.h (_mu_list_clear): New proto.
    * mailbox/iterator.c (mu_iterator_set_itrctl): New function.
    (mu_iterator_skip, mu_iterator_ctl): New functions.
    * mailbox/list.c (_insert_item): Re-implement function.
    (mu_list_insert): Use _insert_item again.
    (mu_list_remove): Don't keep track of the previous item.
    (list_itrctl): New function.
    (mu_list_get_iterator): Set itrctl method.
    * mailbox/listlist.c (clear_list): Rename to _mu_list_clear,
    remove static qualifier. All uses updated.
    
    * mailbox/freeitem.c: New file.
    * mailbox/Makefile.am (libmailutils_la_SOURCES): Add freeitem.c.
    
    * examples/listop.c (read_list): Rewrite to simplify
    calling convention. All callers updated.
    (inctl_tell,ictl_del,ictl_repl)
    (ictl_ins,ictl): New functions.
    (help): Add new commands.
    (shell): Handle "inctl" command.
    (delete): Fix memory leak.
    (main): Set mu_list_free_item as a destroy_item function.
    
    * mailbox/testsuite/mailbox/listop.c: Add ictl tests.
    
    * libmu_cfg/sieve.c (_add_path): Set mu_list_free_item as
    a destroy_item function.
    * mailbox/gocs.c (mu_gocs_store): Likewise.
    * maidag/lmtp.c (cfun_rcpt_to): Likewise.
    * imap4d/namespace.c (namespace_init): Likewise.
    * libmu_sieve/conf.c (_path_append): Likewise.

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

Summary of changes:
 examples/listop.c                          |  143 ++++++++++++++++++++----
 imap4d/authenticate.c                      |    1 +
 imap4d/namespace.c                         |   10 +--
 imap4d/util.c                              |    5 +-
 include/mailutils/cpp/list.h               |    2 +-
 include/mailutils/iterator.h               |   19 +++-
 include/mailutils/list.h                   |   10 ++-
 libmu_argp/common.c                        |    1 +
 libmu_cfg/sieve.c                          |    8 +-
 libmu_cpp/list.cc                          |    8 +-
 libmu_sieve/conf.c                         |    8 +-
 libmu_sieve/util.c                         |    1 -
 libproto/include/iterator0.h               |    1 +
 libproto/include/list0.h                   |    1 +
 maidag/lmtp.c                              |    8 +-
 mail/util.c                                |   57 ++++------
 mailbox/Makefile.am                        |    1 +
 libmu_argp/cmdline.h => mailbox/freeitem.c |   14 ++-
 mailbox/gocs.c                             |    8 +-
 mailbox/iterator.c                         |   34 ++++++
 mailbox/list.c                             |  167 ++++++++++++++++++++++++----
 mailbox/listlist.c                         |   10 +-
 mailbox/mailbox.c                          |   10 +--
 mailbox/observer.c                         |   46 +++-----
 mailbox/testsuite/mailbox/list.exp         |   77 +++++++++++++
 mh/mh_alias.y                              |   26 +----
 mh/sortm.c                                 |   11 +-
 movemail/movemail.c                        |    3 +-
 28 files changed, 488 insertions(+), 202 deletions(-)
 copy libmu_argp/cmdline.h => mailbox/freeitem.c (80%)

diff --git a/examples/listop.c b/examples/listop.c
index 971cfee..c04adac 100644
--- a/examples/listop.c
+++ b/examples/listop.c
@@ -106,7 +106,7 @@ delete (mu_list_t list, int argc, char **argv)
 
   while (--argc)
     {
-      rc = mu_list_remove (list, strdup (*++argv));
+      rc = mu_list_remove (list, *++argv);
       if (rc)
 	fprintf (stderr, "mu_list_remove(%s): %s\n", *argv, mu_strerror (rc));
     }
@@ -150,18 +150,30 @@ prep (mu_list_t list, int argc, char **argv)
     }
 }
 
-static int
-read_list (mu_list_t list, int argc, char **argv)
+static mu_list_t
+read_list (int argc, char **argv)
 {
   int rc;
+  mu_list_t list;
   
+  rc = mu_list_create (&list);
+  if (rc)
+    {
+      fprintf (stderr, "creating temp list: %s\n", mu_strerror (rc));
+      return NULL;
+    }
+  mu_list_set_destroy_item (list, mu_list_free_item);
   for (; argc; argc--, argv++)
     {
       rc = mu_list_append (list, strdup (*argv));
       if (rc)
-	break;
+	{
+	  mu_list_destroy (&list);
+	  fprintf (stderr, "adding to temp list: %s\n", mu_strerror (rc));
+	  break;
+	}
     }
-  return rc;
+  return list;
 }
 
 void
@@ -196,21 +208,9 @@ ins (mu_list_t list, int argc, char **argv)
     rc = mu_list_insert (list, item, strdup (argv[an]), insert_before);
   else
     {
-      mu_list_t tmp;
-      
-      rc = mu_list_create (&tmp);
-      if (rc)
-	{
-	  fprintf (stderr, "creating temp list: %s\n", mu_strerror (rc));
-	  return;
-	}
-
-      rc = read_list (tmp, argc - an, argv + an);
-      if (rc)
-	{
-	  fprintf (stderr, "reading temp list: %s\n", mu_strerror (rc));
-	  return;
-	}
+      mu_list_t tmp = read_list (argc - an, argv + an);
+      if (!tmp)
+	return;
       rc = mu_list_insert_list (list, item, tmp, insert_before);
       mu_list_destroy (&tmp);
     }
@@ -219,7 +219,6 @@ ins (mu_list_t list, int argc, char **argv)
     lperror ("mu_list_insert", rc);
 }
   
-
 void
 repl (mu_list_t list, int argc, char **argv)
 {
@@ -236,6 +235,99 @@ repl (mu_list_t list, int argc, char **argv)
     fprintf (stderr, "mu_list_replace: %s\n", mu_strerror (rc));
 }
 
+void
+ictl_tell (mu_iterator_t itr, int argc)
+{
+  size_t pos;
+  int rc;
+
+  if (argc)
+    {
+      fprintf (stderr, "ictl tell?\n");
+      return;
+    }
+  
+  rc = mu_iterator_ctl (itr, mu_itrctl_tell, &pos);
+  if (rc)
+    lperror ("mu_iterator_ctl", rc);
+  printf ("%lu\n", (unsigned long) pos);
+}
+
+void
+ictl_del (mu_iterator_t itr, int argc)
+{
+  int rc;
+
+  if (argc)
+    {
+      fprintf (stderr, "ictl del?\n");
+      return;
+    }
+  rc = mu_iterator_ctl (itr, mu_itrctl_delete, NULL);
+  if (rc)
+    lperror ("mu_iterator_ctl", rc);
+}
+
+void
+ictl_repl (mu_iterator_t itr, int argc, char **argv)
+{
+  int rc;
+  
+  if (argc != 1)
+    {
+      fprintf (stderr, "ictl repl item?\n");
+      return;
+    }
+
+  rc = mu_iterator_ctl (itr, mu_itrctl_replace, strdup (argv[0]));
+  if (rc)
+    lperror ("mu_iterator_ctl", rc);
+}
+
+void
+ictl_ins (mu_iterator_t itr, int argc, char **argv)
+{
+  int rc;
+  
+  if (argc < 1)
+    {
+      fprintf (stderr, "ictl ins item [item*]?\n");
+      return;
+    }
+
+  if (argc == 1)
+    rc = mu_iterator_ctl (itr, mu_itrctl_insert, strdup (argv[0]));
+  else
+    {
+      mu_list_t tmp = read_list (argc, argv);
+      if (!tmp)
+	return;
+      rc = mu_iterator_ctl (itr, mu_itrctl_insert_list, tmp);
+      mu_list_destroy (&tmp);
+    }
+}
+
+void
+ictl (mu_iterator_t itr, int argc, char **argv)
+{
+  if (argc == 1)
+    {
+      fprintf (stderr, "ictl tell|del|repl|ins?\n");
+      return;
+    }
+  
+  if (strcmp (argv[1], "tell") == 0)
+    ictl_tell (itr, argc - 2);
+  else if (strcmp (argv[1], "del") == 0)
+    ictl_del (itr, argc - 2);
+  else if (strcmp (argv[1], "repl") == 0)
+    ictl_repl (itr, argc - 2, argv + 2);
+  else if (strcmp (argv[1], "ins") == 0)
+    ictl_ins (itr, argc - 2, argv + 2);
+  else
+    fprintf (stderr, "unknown subcommand\n");
+}
+    
 #define NITR 4
 
 int
@@ -295,6 +387,10 @@ help ()
   printf ("prep item [item*]\n");
   printf ("repl old_item new_item\n");
   printf ("ins [before|after] item new_item [new_item*]\n");
+  printf ("ictl tell\n");
+  printf ("ictl del\n");
+  printf ("ictl repl item\n");
+  printf ("ictl ins item [item*]\n");
   printf ("print\n");
   printf ("quit\n");
   printf ("iter num\n");
@@ -356,6 +452,8 @@ shell (mu_list_t list)
 	    ins (list, argc, argv);
 	  else if (strcmp (argv[0], "repl") == 0)
 	    repl (list, argc, argv);
+	  else if (strcmp (argv[0], "ictl") == 0)
+	    ictl (itr[num], argc, argv);
 	  else if (strcmp (argv[0], "print") == 0)
 	    print (list);
 	  else if (strcmp (argv[0], "quit") == 0)
@@ -437,7 +535,8 @@ main (int argc, char **argv)
   if (rc)
     lperror ("mu_list_create", rc);
   mu_list_set_comparator (list, string_comp);
-
+  mu_list_set_destroy_item (list, mu_list_free_item);
+  
   while (argc--)
     {
       rc = mu_list_append (list, *argv++);
diff --git a/imap4d/authenticate.c b/imap4d/authenticate.c
index 12978b5..1354203 100644
--- a/imap4d/authenticate.c
+++ b/imap4d/authenticate.c
@@ -47,6 +47,7 @@ auth_add (char *name, imap4d_auth_handler_fp handler)
     {
       mu_list_create (&imap_auth_list);
       mu_list_set_comparator (imap_auth_list, comp);
+      mu_list_set_destroy_item (imap_auth_list, mu_list_free_item);
     }
   mu_list_append (imap_auth_list, (void*)p);
 }
diff --git a/imap4d/namespace.c b/imap4d/namespace.c
index 45feeca..abe21cd 100644
--- a/imap4d/namespace.c
+++ b/imap4d/namespace.c
@@ -261,12 +261,6 @@ normalize_fun (void *item, void *data)
 			 mu_strdup (mu_normalize_path (name)));
 }
 
-static void
-free_item (void *item)
-{
-  free (item);
-}
-  
 void
 namespace_init ()
 {
@@ -278,9 +272,9 @@ namespace_init ()
 	{
 	  mu_list_t list;
 	  mu_list_create (&list);
-	  mu_list_set_destroy_item (list, free_item);
+	  mu_list_set_destroy_item (list, mu_list_free_item);
 	  mu_list_do (namespace[i], normalize_fun, list);
-	  mu_list_set_destroy_item (namespace[i], free_item);
+	  mu_list_set_destroy_item (namespace[i], mu_list_free_item);
 	  mu_list_destroy (&namespace[i]);
 	  namespace[i] = list;
 	}
diff --git a/imap4d/util.c b/imap4d/util.c
index 51b19c1..d697a33 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -951,7 +951,10 @@ util_register_event (int old_state, int new_state,
   evp->action = action;
   evp->data = data;
   if (!event_list)
-    mu_list_create (&event_list);
+    {
+      mu_list_create (&event_list);
+      mu_list_set_destroy_item (event_list, mu_list_free_item);
+    }
   mu_list_append (event_list, (void*)evp);
 }
 
diff --git a/include/mailutils/cpp/list.h b/include/mailutils/cpp/list.h
index 810b66b..c579b69 100644
--- a/include/mailutils/cpp/list.h
+++ b/include/mailutils/cpp/list.h
@@ -69,7 +69,7 @@ class List
 
   void apply (mu_list_action_t* action, void* cbdata);
   mu_list_comparator_t set_comparator (mu_list_comparator_t comp);
-  void set_destroy_item (void (*mu_destoy_item) (void *item));
+  mu_list_destroy_item_t set_destroy_item (mu_list_destroy_item_t mu_destroy_item);
 
   bool is_empty ();
   size_t count ();
diff --git a/include/mailutils/iterator.h b/include/mailutils/iterator.h
index dfe4c2d..1ecbda2 100644
--- a/include/mailutils/iterator.h
+++ b/include/mailutils/iterator.h
@@ -26,16 +26,30 @@
 extern "C" {
 #endif
 
+enum mu_itrctl_req
+  {
+    mu_itrctl_tell,        /* Return current position in the object */
+    mu_itrctl_delete,      /* Delete current element */
+    mu_itrctl_delete_nd,   /* Delete current element, non-destructive */
+    mu_itrctl_replace,     /* Replace current element */
+    mu_itrctl_replace_nd,  /* Replace current element, non-destructive */
+    mu_itrctl_insert,      /* Insert new element in the current position */
+    mu_itrctl_insert_list, /* Insert a list of elements */
+  };
+  
 extern int mu_iterator_create   (mu_iterator_t *, void *);
 extern int mu_iterator_dup      (mu_iterator_t *piterator, mu_iterator_t orig);
 extern void mu_iterator_destroy (mu_iterator_t *);
 extern int mu_iterator_first    (mu_iterator_t);
 extern int mu_iterator_next     (mu_iterator_t);
+extern int mu_iterator_skip (mu_iterator_t iterator, ssize_t count);
 extern int mu_iterator_current  (mu_iterator_t, void **pitem);
 extern int mu_iterator_current_kv (mu_iterator_t,
 				   const void **key, void **pitem);  
 extern int mu_iterator_is_done  (mu_iterator_t);
 
+extern int mu_iterator_ctl (mu_iterator_t, enum mu_itrctl_req, void *);
+  
 extern int mu_iterator_attach (mu_iterator_t *root, mu_iterator_t iterator);
 extern int mu_iterator_detach (mu_iterator_t *root, mu_iterator_t iterator);
 extern void mu_iterator_advance (mu_iterator_t iterator, void *e);
@@ -53,7 +67,10 @@ extern int mu_iterator_set_destroy (mu_iterator_t itr,
 				 int (*destroy) (mu_iterator_t, void *data));
 extern int mu_iterator_set_curitem_p (mu_iterator_t itr,
 				   int (*curitem_p) (void *, void *));
-  
+extern int mu_iterator_set_itrctl (mu_iterator_t itr,
+				   int (*itrctl) (void *,
+						  enum mu_itrctl_req,
+						  void *));
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/mailutils/list.h b/include/mailutils/list.h
index ef29bca..bb1b377 100644
--- a/include/mailutils/list.h
+++ b/include/mailutils/list.h
@@ -35,7 +35,9 @@ extern int mu_list_insert   (mu_list_t list, void *item, void *new_item,
 extern int mu_list_is_empty (mu_list_t);
 extern int mu_list_count    (mu_list_t, size_t *pcount);
 extern int mu_list_remove   (mu_list_t, void *item);
+extern int mu_list_remove_nd  (mu_list_t, void *item);
 extern int mu_list_replace  (mu_list_t list, void *old_item, void *new_item);  
+extern int mu_list_replace_nd (mu_list_t list, void *old_item, void *new_item);  
 extern int mu_list_get      (mu_list_t, size_t _index, void **pitem);
 extern int mu_list_to_array (mu_list_t list, void **array, size_t count, size_t *pcount);
 extern int mu_list_locate   (mu_list_t list, void *item, void **ret_item);
@@ -53,8 +55,12 @@ extern mu_list_comparator_t mu_list_set_comparator (mu_list_t,
 						    mu_list_comparator_t);
 extern int mu_list_get_comparator (mu_list_t, mu_list_comparator_t *);
 
-extern int mu_list_set_destroy_item (mu_list_t list,
-				     void (*destroy_item) (void *));
+extern void mu_list_free_item (void *item);
+
+typedef void (*mu_list_destroy_item_t) (void *);
+  
+extern mu_list_destroy_item_t mu_list_set_destroy_item
+              (mu_list_t list, mu_list_destroy_item_t destroy_item);
 
 
 extern int mu_list_intersect_dup (mu_list_t *, mu_list_t, mu_list_t,
diff --git a/libmu_argp/common.c b/libmu_argp/common.c
index fca1c17..6584c6a 100644
--- a/libmu_argp/common.c
+++ b/libmu_argp/common.c
@@ -21,6 +21,7 @@
 #endif
 #include "cmdline.h"
 #include <unistd.h>
+#include <stdlib.h>
 #include <string.h>
 #include <mailutils/syslog.h>
 #include <mailutils/mailbox.h>
diff --git a/libmu_cfg/sieve.c b/libmu_cfg/sieve.c
index 595fb13..5b4a5ed 100644
--- a/libmu_cfg/sieve.c
+++ b/libmu_cfg/sieve.c
@@ -58,12 +58,6 @@ cb_clear_include_path (mu_debug_t debug, void *data, mu_config_value_t *val)
   return 0;
 }
 
-static void
-destroy_string (void *str)
-{
-  free (str);
-}
-
 static int
 _add_path (mu_debug_t debug, const char *arg, void *data)
 {
@@ -79,7 +73,7 @@ _add_path (mu_debug_t debug, const char *arg, void *data)
 			       _("cannot create list: %s"), mu_strerror (rc));
 	  exit (1);
 	}
-      mu_list_set_destroy_item (*plist, destroy_string);
+      mu_list_set_destroy_item (*plist, mu_list_free_item);
     }
   /* FIXME: Use mu_argcv */
   tmp = strdup (arg);
diff --git a/libmu_cpp/list.cc b/libmu_cpp/list.cc
index dc29b58..75dd945 100644
--- a/libmu_cpp/list.cc
+++ b/libmu_cpp/list.cc
@@ -215,12 +215,10 @@ List :: set_comparator (mu_list_comparator_t comp)
   return mu_list_set_comparator (mu_list, comp);
 }
 
-void
-List :: set_destroy_item (void (*mu_destroy_item) (void *item))
+mu_list_destroy_item_t
+List :: set_destroy_item (mu_list_destroy_item_t mu_destroy_item)
 {
-  int status = mu_list_set_destroy_item (mu_list, mu_destroy_item);
-  if (status)
-    throw Exception ("List::set_destroy_item", status);
+  return mu_list_set_destroy_item (mu_list, mu_destroy_item);
 }
 
 std::list<void*>
diff --git a/libmu_sieve/conf.c b/libmu_sieve/conf.c
index f2c0170..9566a0b 100644
--- a/libmu_sieve/conf.c
+++ b/libmu_sieve/conf.c
@@ -26,12 +26,6 @@
 mu_list_t mu_sieve_include_path = NULL;
 mu_list_t mu_sieve_library_path = NULL;
 
-static void
-destroy_string (void *str)
-{
-  free (str);
-}
-
 static int
 _path_append (void *item, void *data)
 {
@@ -44,7 +38,7 @@ _path_append (void *item, void *data)
 	  mu_error (_("cannot create list: %s"), mu_strerror (rc));
 	  exit (1);
 	}
-      mu_list_set_destroy_item (*plist, destroy_string);
+      mu_list_set_destroy_item (*plist, mu_list_free_item);
     }
   return mu_list_append (*plist, strdup (item));
 }
diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c
index 327cb52..2966950 100644
--- a/libmu_sieve/util.c
+++ b/libmu_sieve/util.c
@@ -96,7 +96,6 @@ mu_sieve_prealloc (mu_list_t *pool, void *ptr, size_t size)
 void
 mu_sieve_pfree (mu_list_t *pool, void *ptr)
 {
-
   if (*pool)
     mu_list_remove (*pool, ptr);
   free (ptr);
diff --git a/libproto/include/iterator0.h b/libproto/include/iterator0.h
index f84c45b..8abbb80 100644
--- a/libproto/include/iterator0.h
+++ b/libproto/include/iterator0.h
@@ -43,6 +43,7 @@ struct _mu_iterator
   int (*getitem) (void *owner, void **pret, const void **pkey);
   int (*curitem_p) (void *owner, void *item);
   int (*finished_p) (void *owner);
+  int (*itrctl) (void *owner, enum mu_itrctl_req req, void *arg);
 };
 
 #ifdef __cplusplus
diff --git a/libproto/include/list0.h b/libproto/include/list0.h
index 530d9fa..3ac00fb 100644
--- a/libproto/include/list0.h
+++ b/libproto/include/list0.h
@@ -51,6 +51,7 @@ struct _mu_list
   struct _mu_iterator *itr;
 };
 
+extern void _mu_list_clear (mu_list_t list);
 extern void _mu_list_insert_sublist (mu_list_t list,
 				     struct list_data *current,
 				     struct list_data *head,
diff --git a/maidag/lmtp.c b/maidag/lmtp.c
index e821451..4393291 100644
--- a/maidag/lmtp.c
+++ b/maidag/lmtp.c
@@ -155,12 +155,6 @@ mu_list_t rcpt_list;   /* Recipient addresses */
 struct mail_tmp *mtmp; /* Temporary mail storage */
 mu_mailbox_t mbox;     /* Collected mail body */
 
-static void
-rcpt_to_destroy_item (void *ptr)
-{
-  free (ptr);
-}
-
 
 int
 cfun_unknown (FILE *out, char *arg)
@@ -295,7 +289,7 @@ cfun_rcpt_to (FILE *out, char *arg)
   if (!rcpt_list)
     {
       mu_list_create (&rcpt_list);
-      mu_list_set_destroy_item (rcpt_list, rcpt_to_destroy_item);
+      mu_list_set_destroy_item (rcpt_list, mu_list_free_item);
     }
   mu_list_append (rcpt_list, user);
   lmtp_reply (out, "250", "2.1.5", "Go ahead");
diff --git a/mail/util.c b/mail/util.c
index 70cc8f1..013ae83 100644
--- a/mail/util.c
+++ b/mail/util.c
@@ -587,55 +587,39 @@ util_slist_lookup (mu_list_t list, const char *str)
   return rc;
 }
 
-void
-util_slist_add (mu_list_t *list, char *value)
+static int
+util_slist_compare (const void *a, const void *b)
 {
-  char *p;
+  return mu_c_strcasecmp (a, b);
+}
 
-  if (!*list && mu_list_create (list))
-    return;
+void
+util_slist_add (mu_list_t *plist, char *value)
+{
+  mu_list_t list;
 
-  if ((p = strdup(value)) == NULL)
+  if (!*plist)
     {
-      util_error(_("Not enough memory"));
-      return;
+      if (mu_list_create (&list))
+	return;
+      mu_list_set_destroy_item (list, mu_list_free_item);
+      mu_list_set_comparator (list, util_slist_compare);
+      *plist = list;
     }
-  mu_list_append (*list, p);
-}
-
-static int
-comp (const void *item, const void *data)
-{
-  return strcmp ((char*)item, (char*)data);
+  else
+    list = *plist;
+  mu_list_append (list, xstrdup (value));
 }
 
 void
 util_slist_remove (mu_list_t *list, char *value)
 {
-  mu_list_comparator_t cp;
-  
-  if (!*list)
-    return;
-  cp = mu_list_set_comparator (*list, comp);
   mu_list_remove (*list, value);
-  mu_list_set_comparator (*list, cp);
 }
 
 void
 util_slist_destroy (mu_list_t *list)
 {
-  mu_iterator_t itr;
-  char *name;
-
-  if (!*list || mu_list_get_iterator (*list, &itr))
-    return;
-
-  for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next (itr))
-    {
-      mu_iterator_current (itr, (void **)&name);
-      free (name);
-    }
-  mu_iterator_destroy (&itr);
   mu_list_destroy (list);
 }
 
@@ -649,12 +633,13 @@ util_slist_to_string (mu_list_t list, const char *delim)
   if (!list || mu_list_get_iterator (list, &itr))
     return NULL;
 
-  for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next (itr))
+  for (mu_iterator_first (itr); !mu_iterator_is_done (itr);
+       mu_iterator_next (itr))
     {
       mu_iterator_current (itr, (void **)&name);
       if (str && delim)
-	util_strcat(&str, delim);
-      util_strcat(&str, name);
+	util_strcat (&str, delim);
+      util_strcat (&str, name);
     }
   mu_iterator_destroy (&itr);
   return str;
diff --git a/mailbox/Makefile.am b/mailbox/Makefile.am
index 9982187..845bc58 100644
--- a/mailbox/Makefile.am
+++ b/mailbox/Makefile.am
@@ -78,6 +78,7 @@ libmailutils_la_SOURCES = \
  filter_rfc822.c\
  filter_trans.c\
  folder.c\
+ freeitem.c\
  gdebug.c\
  gocs.c\
  hdritr.c\
diff --git a/libmu_argp/cmdline.h b/mailbox/freeitem.c
similarity index 80%
copy from libmu_argp/cmdline.h
copy to mailbox/freeitem.c
index fecb043..65dd7f9 100644
--- a/libmu_argp/cmdline.h
+++ b/mailbox/freeitem.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2007, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010 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
@@ -16,7 +16,13 @@
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301 USA */
 
-#include "mailutils/libcfg.h"
-#include "mailutils/libargp.h"
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
-extern struct mu_cfg_tree *mu_argp_tree;
+/* Default destroy_item function. */
+void
+mu_list_free_item (void *item)
+{
+  free (item);
+}
diff --git a/mailbox/gocs.c b/mailbox/gocs.c
index 35e85ac..40bde9d 100644
--- a/mailbox/gocs.c
+++ b/mailbox/gocs.c
@@ -333,12 +333,6 @@ struct mu_gocs_data
 
 static mu_list_t /* of struct mu_gocs_data */ data_list;
 
-static void
-_destroy_data (void *item)
-{
-  free (item);
-}
-
 static int
 _gocs_comp (const void *a, const void *b)
 {
@@ -353,7 +347,7 @@ mu_gocs_store (char *capa, void *data)
   if (!data_list)
     {
       mu_list_create (&data_list);
-      mu_list_set_destroy_item (data_list, _destroy_data);
+      mu_list_set_destroy_item (data_list, mu_list_free_item);
       mu_list_set_comparator (data_list, _gocs_comp);
     }
   s = malloc (sizeof *s);
diff --git a/mailbox/iterator.c b/mailbox/iterator.c
index 9ace323..9ecae2b 100644
--- a/mailbox/iterator.c
+++ b/mailbox/iterator.c
@@ -92,6 +92,18 @@ mu_iterator_set_curitem_p (mu_iterator_t itr,
 }
 
 int
+mu_iterator_set_itrctl (mu_iterator_t itr,
+			int (*itrctl) (void *,
+				       enum mu_itrctl_req,
+				       void *))
+{
+  if (!itr)
+    return EINVAL;
+  itr->itrctl = itrctl;
+  return 0;
+}
+
+int
 mu_iterator_set_destroy (mu_iterator_t itr, int (*destroy) (mu_iterator_t, void *))
 {
   if (!itr)
@@ -176,6 +188,18 @@ mu_iterator_next (mu_iterator_t iterator)
 }
 
 int
+mu_iterator_skip (mu_iterator_t iterator, ssize_t count)
+{
+  int status;
+  if (count < 0)
+    return ENOSYS; /* Need prev method */
+  while (count--)
+    if ((status = mu_iterator_next (iterator)))
+      break;
+  return status;
+}
+
+int
 mu_iterator_current (mu_iterator_t iterator, void **pitem)
 {
   return iterator->getitem (iterator->owner, pitem, NULL);
@@ -247,3 +271,13 @@ mu_iterator_detach (mu_iterator_t *root, mu_iterator_t iterator)
   
   return 0;
 }
+
+int
+mu_iterator_ctl (mu_iterator_t iterator, enum mu_itrctl_req req, void *arg)
+{
+  if (!iterator)
+    return EINVAL;
+  if (!iterator->itrctl)
+    return ENOSYS;
+  return iterator->itrctl (iterator->owner, req, arg);
+}
diff --git a/mailbox/list.c b/mailbox/list.c
index f598281..9985d4f 100644
--- a/mailbox/list.c
+++ b/mailbox/list.c
@@ -29,6 +29,14 @@
 #include <iterator0.h>
 #include <mailutils/errno.h>
 
+#define DESTROY_ITEM(list, elt)			\
+  do						\
+    {						\
+       if ((list)->destroy_item)		\
+	 (list)->destroy_item ((elt)->item);	\
+    }						\
+  while (0)
+
 int
 mu_list_create (mu_list_t *plist)
 {
@@ -66,8 +74,7 @@ mu_list_destroy (mu_list_t *plist)
 	{
 	  previous = current;
 	  current = current->next;
-	  if (list->destroy_item)
-	    list->destroy_item (previous->item);
+	  DESTROY_ITEM (list, previous);
 	  free (previous);
 	}
       mu_monitor_unlock (list->monitor);
@@ -196,6 +203,26 @@ mu_list_locate (mu_list_t list, void *item, void **ret_item)
   return status;
 }
 
+static int
+_insert_item (mu_list_t list, struct list_data *current, void *new_item,
+	      int insert_before)
+{
+  int status;
+  struct list_data *ldata = calloc (sizeof (*ldata), 1);
+  if (ldata == NULL)
+    status = ENOMEM;
+  else
+    {
+      ldata->item = new_item;
+      _mu_list_insert_sublist (list, current,
+			       ldata, ldata,
+			       1,
+			       insert_before);
+      status = 0;
+    }
+  return status;
+}
+
 int
 mu_list_insert (mu_list_t list, void *item, void *new_item, int insert_before)
 {
@@ -214,18 +241,7 @@ mu_list_insert (mu_list_t list, void *item, void *new_item, int insert_before)
     {
       if (comp (current->item, item) == 0)
 	{
-	  struct list_data *ldata = calloc (sizeof (*ldata), 1);
-	  if (ldata == NULL)
-	    status = ENOMEM;
-	  else
-	    {
-	      ldata->item = new_item;
-	      _mu_list_insert_sublist (list, current,
-				       ldata, ldata,
-				       1,
-				       insert_before);
-	      status = 0;
-	    }
+	  status = _insert_item (list, current, new_item, insert_before);
 	  break;
 	}
     }
@@ -236,7 +252,7 @@ mu_list_insert (mu_list_t list, void *item, void *new_item, int insert_before)
 int
 mu_list_remove (mu_list_t list, void *item)
 {
-  struct list_data *current, *previous;
+  struct list_data *current;
   mu_list_comparator_t comp;
   int status = MU_ERR_NOENT;
 
@@ -244,14 +260,17 @@ mu_list_remove (mu_list_t list, void *item)
     return EINVAL;
   comp = list->comp ? list->comp : _mu_list_ptr_comparator;
   mu_monitor_wrlock (list->monitor);
-  for (previous = &list->head, current = list->head.next;
-       current != &list->head; previous = current, current = current->next)
+  for (current = list->head.next;
+       current != &list->head; current = current->next)
     {
       if (comp (current->item, item) == 0)
 	{
+	  struct list_data *previous = current->prev;
+	  
 	  mu_iterator_advance (list->itr, current);
 	  previous->next = current->next;
 	  current->next->prev = previous;
+	  DESTROY_ITEM (list, current);
 	  free (current);
 	  list->count--;
 	  status = 0;
@@ -263,6 +282,15 @@ mu_list_remove (mu_list_t list, void *item)
 }
 
 int
+mu_list_remove_nd (mu_list_t list, void *item)
+{
+  mu_list_destroy_item_t dptr = mu_list_set_destroy_item (list, NULL);
+  int rc = mu_list_remove (list, item);
+  mu_list_set_destroy_item (list, dptr);
+  return rc;
+}
+
+int
 mu_list_replace (mu_list_t list, void *old_item, void *new_item)
 {
   struct list_data *current, *previous;
@@ -278,6 +306,7 @@ mu_list_replace (mu_list_t list, void *old_item, void *new_item)
     {
       if (comp (current->item, old_item) == 0)
 	{
+	  DESTROY_ITEM (list, current);
 	  current->item = new_item;
 	  status = 0;
 	  break;
@@ -288,6 +317,15 @@ mu_list_replace (mu_list_t list, void *old_item, void *new_item)
 }
 
 int
+mu_list_replace_nd (mu_list_t list, void *item, void *new_item)
+{
+  mu_list_destroy_item_t dptr = mu_list_set_destroy_item (list, NULL);
+  int rc = mu_list_replace (list, item, new_item);
+  mu_list_set_destroy_item (list, dptr);
+  return rc;
+}
+
+int
 mu_list_get (mu_list_t list, size_t indx, void **pitem)
 {
   struct list_data *current;
@@ -336,13 +374,12 @@ mu_list_do (mu_list_t list, mu_list_action_t *action, void *cbdata)
   return status;
 }
 
-int
+mu_list_destroy_item_t
 mu_list_set_destroy_item (mu_list_t list, void (*destroy_item)(void *item))
 {
-  if (list == NULL)
-    return EINVAL;
+  mu_list_destroy_item_t ret = list->destroy_item;
   list->destroy_item = destroy_item;
-  return 0;
+  return ret;
 }
 
 int
@@ -503,6 +540,91 @@ list_data_dup (void **ptr, void *owner)
   return 0;
 }
 
+static int
+list_itrctl (void *owner, enum mu_itrctl_req req, void *arg)
+{
+  struct list_iterator *itr = owner;
+  mu_list_t list = itr->list;
+  struct list_data *ptr;
+  
+  if (itr->cur == NULL)
+    return MU_ERR_NOENT;
+  switch (req)
+    {
+    case mu_itrctl_tell:
+      /* Return current position in the object */
+      {
+	size_t count;
+
+	for (count = 0, ptr = list->head.next; ptr != &list->head;
+	     ptr = ptr->next, count++)
+	  {
+	    if (ptr == itr->cur)
+	      {
+		*(size_t*)arg = count;
+		return 0;
+	      }
+	  }
+	return MU_ERR_NOENT;
+      }
+	
+    case mu_itrctl_delete:
+    case mu_itrctl_delete_nd:
+      /* Delete current element */
+      {
+	struct list_data *prev;
+	
+	ptr = itr->cur;
+	prev = ptr->prev;
+	
+	mu_iterator_advance (list->itr, ptr);
+	prev->next = ptr->next;
+	ptr->next->prev = prev;
+	if (req == mu_itrctl_delete)
+	  DESTROY_ITEM (list, ptr);
+	free (ptr);
+	list->count--;
+      }
+      break;
+      
+    case mu_itrctl_replace:
+    case mu_itrctl_replace_nd:
+      /* Replace current element */
+      if (!arg)
+	return EINVAL;
+      if (req == mu_itrctl_replace)
+	  DESTROY_ITEM (list, ptr);
+      ptr = itr->cur;
+      ptr->item = arg;
+      break;
+      
+    case mu_itrctl_insert:
+      /* Insert new element in the current position */
+      if (!arg)
+	return EINVAL;
+      return _insert_item (list, itr->cur, arg, 0);
+
+    case mu_itrctl_insert_list:
+      /* Insert a list of elements */
+      if (!arg)
+	return EINVAL;
+      else
+	{
+	  mu_list_t new_list = arg;
+	  _mu_list_insert_sublist (list, itr->cur,
+				   new_list->head.next, new_list->head.prev,
+				   new_list->count,
+				   0);
+	  _mu_list_clear (new_list);
+	}
+      break;
+      
+    default:
+      return ENOSYS;
+    }
+  return 0;
+}
+
 int
 mu_list_get_iterator (mu_list_t list, mu_iterator_t *piterator)
 {
@@ -533,7 +655,8 @@ mu_list_get_iterator (mu_list_t list, mu_iterator_t *piterator)
   mu_iterator_set_curitem_p (iterator, curitem_p);
   mu_iterator_set_destroy (iterator, destroy);
   mu_iterator_set_dup (iterator, list_data_dup);
-
+  mu_iterator_set_itrctl (iterator, list_itrctl);
+  
   mu_iterator_attach (&list->itr, iterator);
 
   *piterator = iterator;
diff --git a/mailbox/listlist.c b/mailbox/listlist.c
index d566710..af52862 100644
--- a/mailbox/listlist.c
+++ b/mailbox/listlist.c
@@ -62,8 +62,8 @@ _mu_list_insert_sublist (mu_list_t list,
   list->count += count;
 }
 
-static void
-clear_list (mu_list_t list)
+void
+_mu_list_clear (mu_list_t list)
 {
   list->head.next = list->head.prev = &list->head;
   list->count = 0;
@@ -92,7 +92,7 @@ mu_list_insert_list (mu_list_t list, void *item, mu_list_t new_list,
 				   new_list->head.next, new_list->head.prev,
 				   new_list->count,
 				   insert_before);
-	  clear_list (new_list);
+	  _mu_list_clear (new_list);
 	  status = 0;
 	  break;
 	}
@@ -114,7 +114,7 @@ mu_list_append_list (mu_list_t list, mu_list_t new_list)
 			     new_list->head.next, new_list->head.prev,
 			     new_list->count,
 			     0);
-  clear_list (new_list);
+  _mu_list_clear (new_list);
 }
 
 void
@@ -130,7 +130,7 @@ mu_list_prepend_list (mu_list_t list, mu_list_t new_list)
 			     new_list->head.next, new_list->head.prev,
 			     new_list->count,
 			     1);
-  clear_list (new_list);
+  _mu_list_clear (new_list);
 }
 
 
diff --git a/mailbox/mailbox.c b/mailbox/mailbox.c
index 91c658b..b06fe3d 100644
--- a/mailbox/mailbox.c
+++ b/mailbox/mailbox.c
@@ -681,12 +681,6 @@ mu_mailbox_unlock (mu_mailbox_t mbox)
   return mu_locker_unlock (lock);
 }
 
-static void
-free_uidl (void *item)
-{
-  free (item);
-}
-
 int
 mu_mailbox_get_uidls (mu_mailbox_t mbox, mu_list_t *plist)
 {
@@ -700,7 +694,7 @@ mu_mailbox_get_uidls (mu_mailbox_t mbox, mu_list_t *plist)
   status = mu_list_create (&list);
   if (status)
     return status;
-  mu_list_set_destroy_item (list, free_uidl);
+  mu_list_set_destroy_item (list, mu_list_free_item);
   if (mbox->_get_uidls)
     status = mbox->_get_uidls (mbox, list);
   else
@@ -734,7 +728,7 @@ mu_mailbox_get_uidls (mu_mailbox_t mbox, mu_list_t *plist)
 	  status = mu_list_append (list, uidl);
 	  if (status)
 	    {
-	      free_uidl (uidl);
+	      free (uidl);
 	      break;
 	    }
 	}
diff --git a/mailbox/observer.c b/mailbox/observer.c
index d6b26f4..355a4fa 100644
--- a/mailbox/observer.c
+++ b/mailbox/observer.c
@@ -119,6 +119,14 @@ mu_observer_set_flags (mu_observer_t observer, int flags)
   return 0;
 }
 
+static void
+_free_event (void *ptr)
+{
+  event_t event = ptr;
+  mu_observer_destroy (&event->observer, NULL);
+  free (event);
+}
+
 int
 mu_observable_create (mu_observable_t *pobservable, void *owner)
 {
@@ -129,12 +137,13 @@ mu_observable_create (mu_observable_t *pobservable, void *owner)
   observable = calloc (sizeof (*observable), 1);
   if (observable == NULL)
     return ENOMEM;
-  status = mu_list_create (&(observable->list));
+  status = mu_list_create (&observable->list);
   if (status != 0 )
     {
       free (observable);
       return status;
     }
+  mu_list_set_destroy_item (observable->list, _free_event);
   observable->owner = owner;
   *pobservable = observable;
   return 0;
@@ -143,31 +152,13 @@ mu_observable_create (mu_observable_t *pobservable, void *owner)
 void
 mu_observable_destroy (mu_observable_t *pobservable, void *owner)
 {
-  mu_iterator_t iterator;
   if (pobservable && *pobservable)
     {
       mu_observable_t observable = *pobservable;
       if (observable->owner == owner)
 	{
-	  int status = mu_list_get_iterator (observable->list, &iterator);
-	  if (status == 0)
-	    {
-	      event_t event = NULL;
-	      for (mu_iterator_first (iterator); !mu_iterator_is_done (iterator);
-		   mu_iterator_next (iterator))
-		{
-		  event = NULL;
-		  mu_iterator_current (iterator, (void **)&event);
-		  if (event != NULL)
-		    {
-		      mu_observer_destroy (&(event->observer), NULL);
-		      free (event);
-		    }
-		}
-	      mu_iterator_destroy (&iterator);
-	    }
-	  mu_list_destroy (&((*pobservable)->list));
-	  free (*pobservable);
+	  mu_list_destroy (&observable->list);
+	  free (observable);
 	}
       *pobservable = NULL;
     }
@@ -198,13 +189,14 @@ mu_observable_detach (mu_observable_t observable, mu_observer_t observer)
 {
   mu_iterator_t iterator;
   int status;
-  int found = 0;
   event_t event = NULL;
+
   if (observable == NULL || observer == NULL)
     return EINVAL;
   status = mu_list_get_iterator (observable->list, &iterator);
   if (status != 0)
     return status;
+  status = MU_ERR_NOENT;
   for (mu_iterator_first (iterator); !mu_iterator_is_done (iterator);
        mu_iterator_next (iterator))
     {
@@ -212,18 +204,12 @@ mu_observable_detach (mu_observable_t observable, mu_observer_t observer)
       mu_iterator_current (iterator, (void **)&event);
       if (event && event->observer == observer)
         {
-          found = 1;
+          mu_iterator_ctl (iterator, mu_itrctl_delete, NULL);
+	  status = 0;
           break;
         }
     }
   mu_iterator_destroy (&iterator);
-  if (found)
-    {
-      status = mu_list_remove (observable->list, event);
-      free (event);
-    }
-  else
-    status = MU_ERR_NOENT;
   return status;
 }
 
diff --git a/mailbox/testsuite/mailbox/list.exp b/mailbox/testsuite/mailbox/list.exp
index 062d8e2..56aac99 100644
--- a/mailbox/testsuite/mailbox/list.exp
+++ b/mailbox/testsuite/mailbox/list.exp
@@ -224,6 +224,83 @@ mailbox_prog_test "print" \
     "to" \
     "fem"
 
+mailbox_prog_test "ictl tell" "12"
+
+prompt_text "dos"
+mailbox_prog_test "ictl del"
+
+prompt_text "dos"
+mailbox_prog_test "next"
+
+mailbox_prog_test "print" \
+    "# items: 16" \
+    "1" \
+    "2" \
+    "3" \
+    "4" \
+    "5" \
+    "6" \
+    "zero" \
+    "jeden" \
+    "dwa" \
+    "zero" \
+    "jeden" \
+    "cero" \
+    "dos" \
+    "en" \
+    "to" \
+    "fem"
+
+mailbox_prog_test "ictl ins seis"
+
+mailbox_prog_test "print" \
+    "# items: 17" \
+    "1" \
+    "2" \
+    "3" \
+    "4" \
+    "5" \
+    "6" \
+    "zero" \
+    "jeden" \
+    "dwa" \
+    "zero" \
+    "jeden" \
+    "cero" \
+    "dos" \
+    "seis" \
+    "en" \
+    "to" \
+    "fem"
+
+mailbox_prog_test "ictl ins tres quatro cinco"
+
+mailbox_prog_test "print" \
+    "# items: 20" \
+    "1" \
+    "2" \
+    "3" \
+    "4" \
+    "5" \
+    "6" \
+    "zero" \
+    "jeden" \
+    "dwa" \
+    "zero" \
+    "jeden" \
+    "cero" \
+    "dos" \
+    "tres" \
+    "quatro" \
+    "cinco" \
+    "seis" \
+    "en" \
+    "to" \
+    "fem"
+
+prompt_text "tres"
+mailbox_prog_test "next"
+
 mailbox_prog_send "quit"
 mailbox_prog_stop
 
diff --git a/mh/mh_alias.y b/mh/mh_alias.y
index c6e742b..ca27e8b 100644
--- a/mh/mh_alias.y
+++ b/mh/mh_alias.y
@@ -262,26 +262,6 @@ aliascmp (const char *pattern, const char *name)
   return strcmp (pattern, name);
 }
 
-
-int
-_insert_list (mu_list_t list, void *prev, mu_list_t new_list)
-{
-  mu_iterator_t itr;
-
-  if (mu_list_get_iterator (new_list, &itr))
-    return 1;
-  for (mu_iterator_first (itr); !mu_iterator_is_done (itr); mu_iterator_next (itr))
-    {
-      void *item;
-      
-      mu_iterator_current (itr, &item);
-      mu_list_insert (list, prev, item, 0);
-      prev = item;
-    }
-  mu_iterator_destroy (&itr);
-  return 0;
-}
-
 static int mh_alias_get_internal (const char *name, mu_iterator_t start,
 				  mu_list_t *return_list, int *inclusive);
 
@@ -300,9 +280,11 @@ alias_expand_list (mu_list_t name_list, mu_iterator_t orig_itr, int *inclusive)
       mu_iterator_current (itr, (void **)&name);
       if (mh_alias_get_internal (name, orig_itr, &exlist, inclusive) == 0)
 	{
-	  _insert_list (name_list, name, exlist);
-	  mu_list_remove (name_list, name);
+	  /* Insert exlist after name */
+	  mu_iterator_ctl (itr, mu_itrctl_insert_list, exlist);
 	  mu_list_destroy (&exlist);
+	  /* Remove name */
+	  mu_iterator_ctl (itr, mu_itrctl_delete, NULL);
 	}
     }
   mu_iterator_destroy (&itr);
diff --git a/mh/sortm.c b/mh/sortm.c
index 06482f9..68b95c3 100644
--- a/mh/sortm.c
+++ b/mh/sortm.c
@@ -215,10 +215,14 @@ addop (char *field, compfun comp)
 {
   struct comp_op *op = xmalloc (sizeof (*op));
   
-  if (!oplist && mu_list_create (&oplist))
+  if (!oplist)
     {
-      mu_error (_("can't create operation list"));
-      exit (1);
+      if (mu_list_create (&oplist))
+	{
+	  mu_error (_("can't create operation list"));
+	  exit (1);
+	}
+      mu_list_set_destroy_item (oplist, mu_list_free_item);
     }
   op->field = field;
   op->comp = comp;
@@ -248,7 +252,6 @@ remop (compfun comp)
   d.op = NULL;
   mu_list_do (oplist, rem_action, &d);
   mu_list_remove (oplist, d.op);
-  free (d.op);
 }
 
 struct comp_data {
diff --git a/movemail/movemail.c b/movemail/movemail.c
index c9ce1e1..d843bb6 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -731,7 +731,6 @@ main (int argc, char **argv)
       if (rc)
 	die (dest, _("cannot get UIDLs"), rc);
 
-      mu_list_set_comparator (src_uidl_list, NULL);
       mu_list_set_comparator (dst_uidl_list, _compare_uidls);
       
       mu_list_get_iterator (src_uidl_list, &itr);
@@ -742,7 +741,7 @@ main (int argc, char **argv)
 	      
 	  mu_iterator_current (itr, (void **)&uidl);
 	  if (mu_list_locate (dst_uidl_list, uidl, NULL) == 0)
-	    mu_list_remove (src_uidl_list, uidl);
+	    mu_iterator_ctl (itr, mu_itrctl_delete, NULL);
 	}
       mu_iterator_destroy (&itr);
       mu_list_destroy (&dst_uidl_list);


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Sat Feb 20 16:50:50 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1NixDu-0006fy-HN
	for mharc-commit-mailutils@gnu.org; Sat, 20 Feb 2010 16:50:50 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NixDt-0006f5-KB
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 16:50:49 -0500
Received: from [140.186.70.92] (port=50907 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NixDs-0006df-1V
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 16:50:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NixDr-0003vd-9g
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 16:50:47 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:48634
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NixDr-0003vZ-7v
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 16:50:47 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NixDr-0005nN-27
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 21:50:47 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NixDq-0001Gb-9K
	for commit-mailutils@gnu.org; Sat, 20 Feb 2010 21:50:47 +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: 1413567bfd73bfb39404201a4fc19a4d23dae3ec
X-Git-Newrev: 9f2f2247b8191614c4344dce26eb3336224eac06
Message-Id: <E1NixDq-0001Gb-9K@vcs-noshell.in.savannah.gnu.org>
Date: Sat, 20 Feb 2010 21:50:46 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-44-g9f2f224
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, 20 Feb 2010 21:50:49 -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=9f2f2247b8191614c4344dce26eb3336224eac06

The branch, master has been updated
       via  9f2f2247b8191614c4344dce26eb3336224eac06 (commit)
      from  1413567bfd73bfb39404201a4fc19a4d23dae3ec (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 9f2f2247b8191614c4344dce26eb3336224eac06
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Feb 20 23:49:28 2010 +0200

    Implement bidirectional iteration over lists.
    
    * include/mailutils/iterator.h (mu_itrctl_qry_direction)
    (mu_itrctl_set_direction): New mu_itrctl_req constants.
    * mailbox/iterator.c (mu_iterator_dup): Bugfix: copy dup as well.
    * mailbox/list.c (struct list_iterator)
    <backwards>: New member.
    (first, next): Move direction depends on the value
    of list_iterator.backwards.
    (list_itrctl): Handle mu_itrctl_qry_direction and
    mu_itrctl_set_direction
    
    * examples/listop.c (ictl_dir): New function.
    (ictl_ins): Handle new subcommand "dir".
    (help): Show new subcommand "dir".
    * mailbox/testsuite/mailbox/list.exp: Add tests for
    iteration backwards.

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

Summary of changes:
 examples/listop.c                  |   38 ++++++++++++++++++++++++++++++++++++
 include/mailutils/iterator.h       |   16 ++++++++------
 mailbox/iterator.c                 |    9 ++++---
 mailbox/list.c                     |   25 +++++++++++++++++++++-
 mailbox/testsuite/mailbox/list.exp |   23 +++++++++++++++++++++
 5 files changed, 98 insertions(+), 13 deletions(-)

diff --git a/examples/listop.c b/examples/listop.c
index c04adac..01e7e7b 100644
--- a/examples/listop.c
+++ b/examples/listop.c
@@ -285,6 +285,41 @@ ictl_repl (mu_iterator_t itr, int argc, char **argv)
 }
 
 void
+ictl_dir (mu_iterator_t itr, int argc, char **argv)
+{
+  int rc;
+  int dir;
+  
+  if (argc > 1)
+    {
+      fprintf (stderr, "ictl dir [backwards|forwards]?\n");
+      return;
+    }
+  if (argc == 1)
+    {
+      if (strcmp (argv[0], "backwards") == 0)
+	dir = 1;
+      else if (strcmp (argv[0], "forwards") == 0)
+	dir = 0;
+      else
+	{
+	  fprintf (stderr, "ictl dir [backwards|forwards]?\n");
+	  return;
+	}
+      rc = mu_iterator_ctl (itr, mu_itrctl_set_direction, &dir);
+      if (rc)
+	lperror ("mu_iterator_ctl", rc);
+    }
+  else
+    {
+      rc = mu_iterator_ctl (itr, mu_itrctl_qry_direction, &dir);
+      if (rc)
+	lperror ("mu_iterator_ctl", rc);
+      printf ("%s\n", dir ? "backwards" : "forwards");
+    }
+}
+  
+void
 ictl_ins (mu_iterator_t itr, int argc, char **argv)
 {
   int rc;
@@ -324,6 +359,8 @@ ictl (mu_iterator_t itr, int argc, char **argv)
     ictl_repl (itr, argc - 2, argv + 2);
   else if (strcmp (argv[1], "ins") == 0)
     ictl_ins (itr, argc - 2, argv + 2);
+  else if (strcmp (argv[1], "dir") == 0)
+    ictl_dir (itr, argc - 2, argv + 2);
   else
     fprintf (stderr, "unknown subcommand\n");
 }
@@ -391,6 +428,7 @@ help ()
   printf ("ictl del\n");
   printf ("ictl repl item\n");
   printf ("ictl ins item [item*]\n");
+  printf ("ictl dir [backwards|forwards]\n");
   printf ("print\n");
   printf ("quit\n");
   printf ("iter num\n");
diff --git a/include/mailutils/iterator.h b/include/mailutils/iterator.h
index 1ecbda2..815b605 100644
--- a/include/mailutils/iterator.h
+++ b/include/mailutils/iterator.h
@@ -28,13 +28,15 @@ extern "C" {
 
 enum mu_itrctl_req
   {
-    mu_itrctl_tell,        /* Return current position in the object */
-    mu_itrctl_delete,      /* Delete current element */
-    mu_itrctl_delete_nd,   /* Delete current element, non-destructive */
-    mu_itrctl_replace,     /* Replace current element */
-    mu_itrctl_replace_nd,  /* Replace current element, non-destructive */
-    mu_itrctl_insert,      /* Insert new element in the current position */
-    mu_itrctl_insert_list, /* Insert a list of elements */
+    mu_itrctl_tell,          /* Return current position in the object */
+    mu_itrctl_delete,        /* Delete current element */
+    mu_itrctl_delete_nd,     /* Delete current element, non-destructive */
+    mu_itrctl_replace,       /* Replace current element */
+    mu_itrctl_replace_nd,    /* Replace current element, non-destructive */
+    mu_itrctl_insert,        /* Insert new element in the current position */
+    mu_itrctl_insert_list,   /* Insert a list of elements */
+    mu_itrctl_qry_direction, /* Query iteration direction */
+    mu_itrctl_set_direction  /* Set iteration direction */
   };
   
 extern int mu_iterator_create   (mu_iterator_t *, void *);
diff --git a/mailbox/iterator.c b/mailbox/iterator.c
index 9ecae2b..aba94ab 100644
--- a/mailbox/iterator.c
+++ b/mailbox/iterator.c
@@ -145,14 +145,15 @@ mu_iterator_dup (mu_iterator_t *piterator, mu_iterator_t orig)
       return status;
     }
   iterator->is_advanced = orig->is_advanced;   
+  iterator->dup = orig->dup;
+  iterator->destroy = orig->destroy;
   iterator->first = orig->first;
   iterator->next = orig->next;
   iterator->getitem = orig->getitem;
-  iterator->finished_p = orig->finished_p;
   iterator->curitem_p = orig->curitem_p;
-  iterator->dup = orig->dup;
-  iterator->destroy = orig->destroy;
-
+  iterator->finished_p = orig->finished_p;
+  iterator->itrctl = orig->itrctl;
+  
   *piterator = iterator;
   return 0;
 }
diff --git a/mailbox/list.c b/mailbox/list.c
index 9985d4f..3ba6477 100644
--- a/mailbox/list.c
+++ b/mailbox/list.c
@@ -479,13 +479,17 @@ struct list_iterator
 {
   mu_list_t list;
   struct list_data *cur;
+  int backwards; /* true if iterating backwards */
 };
 
 static int
 first (void *owner)
 {
   struct list_iterator *itr = owner;
-  itr->cur = itr->list->head.next;
+  if (itr->backwards)
+    itr->cur = itr->list->head.prev;
+  else
+    itr->cur = itr->list->head.next;
   return 0;
 }
 
@@ -493,7 +497,10 @@ static int
 next (void *owner)
 {
   struct list_iterator *itr = owner;
-  itr->cur = itr->cur->next;
+  if (itr->backwards)
+    itr->cur = itr->cur->prev;
+  else
+    itr->cur = itr->cur->next;
   return 0;
 }
 
@@ -618,6 +625,20 @@ list_itrctl (void *owner, enum mu_itrctl_req req, void *arg)
 	  _mu_list_clear (new_list);
 	}
       break;
+
+    case mu_itrctl_qry_direction:
+      if (!arg)
+	return EINVAL;
+      else
+	*(int*)arg = itr->backwards;
+      break;
+
+    case mu_itrctl_set_direction:
+      if (!arg)
+	return EINVAL;
+      else
+	itr->backwards = !!*(int*)arg;
+      break;
       
     default:
       return ENOSYS;
diff --git a/mailbox/testsuite/mailbox/list.exp b/mailbox/testsuite/mailbox/list.exp
index 56aac99..acb7bb2 100644
--- a/mailbox/testsuite/mailbox/list.exp
+++ b/mailbox/testsuite/mailbox/list.exp
@@ -301,6 +301,29 @@ mailbox_prog_test "print" \
 prompt_text "tres"
 mailbox_prog_test "next"
 
+mailbox_prog_test "ictl dir" "forwards"
+
+mailbox_prog_test "ictl dir backwards"
+
+prompt_text "dos"
+mailbox_prog_test "next"
+
+prompt_text "dwa"
+mailbox_prog_test "next 4"
+
+prompt_text "jeden"
+mailbox_prog_test "ictl del"
+
+mailbox_prog_test "next"
+
+prompt_text "zero"
+mailbox_prog_test "next"
+
+mailbox_prog_test "ictl dir forwards"
+
+prompt_text "jeden"
+mailbox_prog_test "next"
+
 mailbox_prog_send "quit"
 mailbox_prog_stop
 


hooks/post-receive
-- 
GNU Mailutils



From MAILER-DAEMON Sun Feb 21 10:06:19 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1NjDNz-0000IQ-NV
	for mharc-commit-mailutils@gnu.org; Sun, 21 Feb 2010 10:06:19 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1NjDNy-0000IK-Vv
	for commit-mailutils@gnu.org; Sun, 21 Feb 2010 10:06:19 -0500
Received: from [140.186.70.92] (port=40777 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1NjDNw-0000IC-IR
	for commit-mailutils@gnu.org; Sun, 21 Feb 2010 10:06:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NjDNu-0003Ar-BT
	for commit-mailutils@gnu.org; Sun, 21 Feb 2010 10:06:16 -0500
Received: from colonialone.fsf.org ([140.186.70.51]:49835
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NjDNu-0003Ak-6b
	for commit-mailutils@gnu.org; Sun, 21 Feb 2010 10:06:14 -0500
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NjDNu-0001KB-1J
	for commit-mailutils@gnu.org; Sun, 21 Feb 2010 15:06:14 +0000
Received: from gray by vcs-noshell.in.savannah.gnu.org with local (Exim 4.69)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1NjDNt-0005Th-OD
	for commit-mailutils@gnu.org; Sun, 21 Feb 2010 15:06:14 +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: 9f2f2247b8191614c4344dce26eb3336224eac06
X-Git-Newrev: e1f5e01f24e9b102f0f806b3af9cb47a7f4daca7
Message-Id: <E1NjDNt-0005Th-OD@vcs-noshell.in.savannah.gnu.org>
Date: Sun, 21 Feb 2010 15:06:13 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-46-ge1f5e01
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, 21 Feb 2010 15:06:19 -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=e1f5e01f24e9b102f0f806b3af9cb47a7f4daca7

The branch, master has been updated
       via  e1f5e01f24e9b102f0f806b3af9cb47a7f4daca7 (commit)
       via  afce403c36eab3eecab4db52c92e87395d86ee1e (commit)
      from  9f2f2247b8191614c4344dce26eb3336224eac06 (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 e1f5e01f24e9b102f0f806b3af9cb47a7f4daca7
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sun Feb 21 15:29:07 2010 +0200

    Re-do configuration tree support using mu_list_t.
    
    * include/mailutils/cfg.h (mu_cfg_node)
    <next,node>: Remove members.
    <nodes>: New member.
    (mu_cfg_tree)<head,tail>: Remove.
    <nodes>: New member.
    (mu_cfg_iter_closure): New struct.
    (mu_cfg_preorder): Change prototype.
    (mu_cfg_postorder): Remove.
    (mu_cfg_create_node_list): New proto.
    (mu_cfg_tree_create_node): Change signature.
    (mu_cfg_tree_add_nodelist): New proto.
    (mu_cfg_find_node): Change signature.
    * include/mailutils/libargp.h (mu_argp_node_list): Remove struct.
    (mu_argp_node_list_init, mu_argp_node_list_add)
    (mu_argp_node_list_new, mu_argp_node_list_finish): Change signature.
    * libmu_argp/cmdline.c (mu_argp_node_list_init, mu_argp_node_list_add)
    (mu_argp_node_list_new, mu_argp_node_list_finish): Take mu_list_t as
    the nodelist argument.
    
    * mailbox/cfg_parser.y (parse_head,parse_tail): Remove.
    (parse_node_list): New static, used instead of the above.
    All uses updated.
    (mu_cfg_alloc_node): Last argument is mu_list_t.
    (mu_cfg_create_node_list): New function.
    (mu_cfg_tree_postprocess): Rewrite.
    (mu_cfg_preorder): Rewrite.
    (mu_cfg_postorder): Remove.
    (mu_cfg_destroy_tree): Use mu_list_destroy to free
    the node list.
    (mu_cfg_scan_tree): Update calls to mu_cfg_preorder.
    (mu_cfg_tree_add_node): Rewrite.
    (mu_cfg_tree_add_nodelist): New function.
    (mu_cfg_find_node): Change type of the first argument.
    (mu_cfg_create_subtree): Rewrite.
    
    * mailbox/cfg_format.c (mu_cfg_format_parse_tree)
    (mu_cfg_format_node): Use new mu_cfg_preorder function.
    
    * libmu_argp/common.c: Update calls to mu_argp_node_ functions.
    * libmu_argp/auth.c: Likewise.
    * comsat/comsat.c: Likewise.
    * config/mailutils-config.c: Likewise.
    * dotlock/dotlock.c: Likewise.
    * imap4d/imap4d.c: Likewise.
    * libmu_argp/sieve.c: Likewise.
    * libmu_argp/tls.c: Likewise.
    * maidag/maidag.c: Likewise.
    * mimeview/mimeview.c: Likewise.
    * movemail/movemail.c: Likewise.
    * pop3d/pop3d.c: Likewise.
    * readmsg/readmsg.c: Likewise.
    * sieve/sieve.c: Likewise.

commit afce403c36eab3eecab4db52c92e87395d86ee1e
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sun Feb 21 15:15:57 2010 +0200

    Bugfixes.
    
    * mailbox/listlist.c (mu_list_append_list)
    (mu_list_prepend_list): Initialize head.next and head.prev
    if the destination list was empty.
    * mailbox/freeitem.c: Include stdlib.h.
    * mailbox/list.c: Minor style fix.

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

Summary of changes:
 comsat/comsat.c             |   12 +-
 config/mailutils-config.c   |    2 +-
 dotlock/dotlock.c           |   10 +-
 imap4d/imap4d.c             |   12 +-
 include/mailutils/cfg.h     |   26 +++--
 include/mailutils/libargp.h |   15 +--
 libmu_argp/auth.c           |    4 +-
 libmu_argp/cmdline.c        |   56 +++++----
 libmu_argp/common.c         |   20 ++--
 libmu_argp/sieve.c          |   12 +-
 libmu_argp/tls.c            |    6 +-
 maidag/maidag.c             |   22 ++--
 mailbox/cfg_format.c        |   14 ++-
 mailbox/cfg_parser.y        |  280 +++++++++++++++++++------------------------
 mailbox/freeitem.c          |    1 +
 mailbox/list.c              |    2 +-
 mailbox/listlist.c          |    2 +
 mimeview/mimeview.c         |   10 +-
 movemail/movemail.c         |   14 +-
 pop3d/pop3d.c               |   12 +-
 readmsg/readmsg.c           |   18 ++--
 sieve/sieve.c               |   18 ++--
 22 files changed, 275 insertions(+), 293 deletions(-)

diff --git a/comsat/comsat.c b/comsat/comsat.c
index 3722f47..82e8056 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -147,7 +147,7 @@ struct mu_cfg_param comsat_cfg_param[] = {
 static error_t
 comsatd_parse_opt (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
@@ -179,17 +179,17 @@ _("The old configuration file format and the --config command\n"
       exit (0);
 
     case 'd':
-      mu_argp_node_list_new (&lst, "mode", "daemon");
+      mu_argp_node_list_new (lst, "mode", "daemon");
       if (arg)
-	mu_argp_node_list_new (&lst, "max-children", arg);
+	mu_argp_node_list_new (lst, "max-children", arg);
       break;
 
     case 'i':
-      mu_argp_node_list_new (&lst, "mode", "inetd");
+      mu_argp_node_list_new (lst, "mode", "inetd");
       break;
 
     case OPT_FOREGROUND:
-      mu_argp_node_list_new (&lst, "foreground", "yes");
+      mu_argp_node_list_new (lst, "foreground", "yes");
       break;
 
     case 't':
@@ -201,7 +201,7 @@ _("The old configuration file format and the --config command\n"
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
 
     default:
diff --git a/config/mailutils-config.c b/config/mailutils-config.c
index af4f911..c246d10 100644
--- a/config/mailutils-config.c
+++ b/config/mailutils-config.c
@@ -356,7 +356,7 @@ main (int argc, char **argv)
 	  char *path = *argv;
 	  mu_cfg_node_t *node;
 
-	  if (mu_cfg_find_node (tree->head, path, &node) == 0)
+	  if (mu_cfg_find_node (tree, path, &node) == 0)
 	    {
 	      mu_cfg_format_node (stream, node, fmtflags);
 	    }
diff --git a/dotlock/dotlock.c b/dotlock/dotlock.c
index 553557d..6315b2d 100644
--- a/dotlock/dotlock.c
+++ b/dotlock/dotlock.c
@@ -77,12 +77,12 @@ static int debug;
 static error_t
 parse_opt (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
     case 'd':
-      mu_argp_node_list_new (&lst, "debug", "yes");
+      mu_argp_node_list_new (lst, "debug", "yes");
       break;
 
     case 'u':
@@ -91,11 +91,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
     case 'r':
       if (arg)
-	mu_argp_node_list_new (&lst, "retry", arg);
+	mu_argp_node_list_new (lst, "retry", arg);
       break;
 
     case 'f':
-      mu_argp_node_list_new (&lst, "force", arg ? arg : "0");
+      mu_argp_node_list_new (lst, "force", arg ? arg : "0");
       break;
 
     case ARGP_KEY_ARG:
@@ -114,7 +114,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
       
     default:
diff --git a/imap4d/imap4d.c b/imap4d/imap4d.c
index 4fd7556..195c4af 100644
--- a/imap4d/imap4d.c
+++ b/imap4d/imap4d.c
@@ -101,22 +101,22 @@ static int imap4d_mainloop (int, FILE *, FILE *);
 static error_t
 imap4d_parse_opt (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
     case 'd':
-      mu_argp_node_list_new (&lst, "mode", "daemon");
+      mu_argp_node_list_new (lst, "mode", "daemon");
       if (arg)
-	mu_argp_node_list_new (&lst, "max-children", arg);
+	mu_argp_node_list_new (lst, "max-children", arg);
       break;
 
     case 'i':
-      mu_argp_node_list_new (&lst, "mode", "inetd");
+      mu_argp_node_list_new (lst, "mode", "inetd");
       break;
 
     case OPT_FOREGROUND:
-      mu_argp_node_list_new (&lst, "foreground", "yes");
+      mu_argp_node_list_new (lst, "foreground", "yes");
       break;
       
     case OPT_PREAUTH:
@@ -128,7 +128,7 @@ imap4d_parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
       
     default:
diff --git a/include/mailutils/cfg.h b/include/mailutils/cfg.h
index 3123f33..3fc7220 100644
--- a/include/mailutils/cfg.h
+++ b/include/mailutils/cfg.h
@@ -70,17 +70,16 @@ struct mu_cfg_locus
 
 struct mu_cfg_node
 {
-  mu_cfg_node_t *next;
   mu_cfg_locus_t locus;
   enum mu_cfg_node_type type;
   char *tag;
   mu_config_value_t *label;
-  mu_cfg_node_t *node;
+  mu_list_t nodes;   /* a list of mu_cfg_node_t */
 };
 
 struct mu_cfg_tree
 {
-  mu_cfg_node_t *head, *tail;
+  mu_list_t nodes;   /* a list of mu_cfg_node_t */
   mu_debug_t debug;
   mu_opool_t pool;
 };
@@ -107,14 +106,16 @@ void mu_cfg_format_error (mu_debug_t debug, size_t, const char *fmt, ...)
 
 typedef int (*mu_cfg_iter_func_t) (const mu_cfg_node_t *node, void *data);
 
+struct mu_cfg_iter_closure
+{
+  mu_cfg_iter_func_t beg;
+  mu_cfg_iter_func_t end;
+  void *data;
+};
+
 void mu_cfg_destroy_tree (mu_cfg_tree_t **tree);
 
-int mu_cfg_preorder (mu_cfg_node_t *node,
-		     mu_cfg_iter_func_t fun, mu_cfg_iter_func_t endfun,
-		     void *data);
-int mu_cfg_postorder (mu_cfg_node_t *node,
-		      mu_cfg_iter_func_t fun, mu_cfg_iter_func_t endfun,
-		      void *data);
+int mu_cfg_preorder (mu_list_t nodelist, struct mu_cfg_iter_closure *);
 
 
 /* Table-driven parsing */
@@ -227,6 +228,8 @@ int mu_create_canned_section (char *name, struct mu_cfg_section **psection);
 int mu_create_canned_param (char *name, struct mu_cfg_param **pparam);
 struct mu_cfg_cont *mu_get_canned_container (const char *name);
 
+int mu_cfg_create_node_list (mu_list_t *plist);
+  
 int mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct mu_cfg_section *sections,
 		      void *target, void *call_data);
 
@@ -300,10 +303,11 @@ mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree,
 					const mu_cfg_locus_t *loc,
 					const char *tag,
 					const char *label,
-					mu_cfg_node_t *node);
+					mu_list_t nodelist);
 void mu_cfg_tree_add_node (mu_cfg_tree_t *tree, mu_cfg_node_t *node);
+void mu_cfg_tree_add_nodelist (mu_cfg_tree_t *tree, mu_list_t nodelist);
 
-int mu_cfg_find_node (mu_cfg_node_t *tree, const char *path,
+int mu_cfg_find_node (mu_cfg_tree_t *tree, const char *path,
 		      mu_cfg_node_t **pnode);
 int mu_cfg_create_subtree (const char *path, mu_cfg_node_t **pnode);
 
diff --git a/include/mailutils/libargp.h b/include/mailutils/libargp.h
index 63f1aa7..e96df3a 100644
--- a/include/mailutils/libargp.h
+++ b/include/mailutils/libargp.h
@@ -83,17 +83,10 @@ error_t mu_argp_parse (const struct argp *myargp,
 		       int *arg_index,     
 		       void *input) __attribute__ ((deprecated));
 
-struct mu_argp_node_list
-{
-  int count;
-  mu_cfg_node_t *head, *tail;
-};
-
-void mu_argp_node_list_init (struct mu_argp_node_list *);
-void mu_argp_node_list_add (struct mu_argp_node_list *, mu_cfg_node_t *);
-void mu_argp_node_list_new (struct mu_argp_node_list *, 
-			    const char *, const char *);
-void mu_argp_node_list_finish (struct mu_argp_node_list *, char *, char *);
+void mu_argp_node_list_init (mu_list_t *);
+void mu_argp_node_list_add (mu_list_t, mu_cfg_node_t *);
+void mu_argp_node_list_new (mu_list_t, const char *, const char *);
+void mu_argp_node_list_finish (mu_list_t, char *, char *);
   
 #ifdef __cplusplus
 }
diff --git a/libmu_argp/auth.c b/libmu_argp/auth.c
index b142dcf..929912a 100644
--- a/libmu_argp/auth.c
+++ b/libmu_argp/auth.c
@@ -68,7 +68,7 @@ auth_set_debug ()
 static error_t
 mu_auth_argp_parser (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
   
   switch (key)
     {
@@ -77,7 +77,7 @@ mu_auth_argp_parser (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, "auth", NULL);
+      mu_argp_node_list_finish (lst, "auth", NULL);
       break;
 
     case OPT_DEBUG_AUTH:
diff --git a/libmu_argp/cmdline.c b/libmu_argp/cmdline.c
index b6cac65..61b217f 100644
--- a/libmu_argp/cmdline.c
+++ b/libmu_argp/cmdline.c
@@ -56,53 +56,57 @@ mu_libargp_init ()
 }
 
 void
-mu_argp_node_list_init (struct mu_argp_node_list *lst)
+mu_argp_node_list_init (mu_list_t *plist)
 {
-  lst->count = 0;
-  lst->head = lst->tail = NULL;
+  int rc = mu_cfg_create_node_list (plist);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_cfg_create_node_list", NULL, rc);
+      abort ();
+    }
 }
 
 void
-mu_argp_node_list_add (struct mu_argp_node_list *lst,  mu_cfg_node_t *node)
+mu_argp_node_list_add (mu_list_t lst, mu_cfg_node_t *node)
 {
-  lst->count++;
-  if (lst->tail)
-    lst->tail->next = node;
-  else
-    lst->head = node;
-  lst->tail = node;
+  int rc = mu_list_append (lst, node);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_list_append", NULL, rc);
+      abort ();
+    }
 }
 		   
 void
-mu_argp_node_list_new (struct mu_argp_node_list *lst,
-		       const char *tag, const char *label)
+mu_argp_node_list_new (mu_list_t lst, const char *tag, const char *label)
 {
   mu_cfg_node_t *node;
   mu_cfg_locus_t loc = { "command line", 0 };
 
-  loc.line = lst->count;
+  mu_list_count (lst, &loc.line);
   node = mu_cfg_tree_create_node (mu_argp_tree, mu_cfg_node_param,
 				  &loc, tag, label, NULL);
   mu_argp_node_list_add (lst, node);
 }
 
 void
-mu_argp_node_list_finish (struct mu_argp_node_list *lst, char *tag,
-			  char *label)
+mu_argp_node_list_finish (mu_list_t lst, char *tag, char *label)
 {
-  mu_cfg_node_t *node;
-
-  if (!lst->head)
+  if (mu_list_is_empty (lst))
     return;
   if (tag)
-    node = mu_cfg_tree_create_node (mu_argp_tree,
-				    mu_cfg_node_statement,
-				    NULL,
-				    tag, label,
-				    lst->head);
+    {
+      mu_cfg_node_t *node = mu_cfg_tree_create_node (mu_argp_tree,
+						     mu_cfg_node_statement,
+						     NULL,
+						     tag, label,
+						     lst);
+      mu_cfg_tree_add_node (mu_argp_tree, node);
+    }
   else
-    node = lst->head;
-  mu_cfg_tree_add_node (mu_argp_tree, node);
-  mu_argp_node_list_init (lst);
+    {
+      mu_cfg_tree_add_nodelist (mu_argp_tree, lst);
+      mu_list_destroy (&lst);
+    }
 }
 
diff --git a/libmu_argp/common.c b/libmu_argp/common.c
index 6584c6a..aa481de 100644
--- a/libmu_argp/common.c
+++ b/libmu_argp/common.c
@@ -157,13 +157,13 @@ static struct argp_option mu_logging_argp_option[] = {
 static error_t
 mu_logging_argp_parser (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
   
   switch (key)
     {
       /* log */
     case OPT_LOG_FACILITY:
-      mu_argp_node_list_new (&lst, "facility", arg);
+      mu_argp_node_list_new (lst, "facility", arg);
       break;
 	  
     case ARGP_KEY_INIT:
@@ -171,7 +171,7 @@ mu_logging_argp_parser (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, "logging", NULL);
+      mu_argp_node_list_finish (lst, "logging", NULL);
       break;
 
     default:
@@ -254,13 +254,13 @@ static struct argp_option mu_mailer_argp_option[] = {
 static error_t
 mu_mailer_argp_parser (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
       /* mailer */
     case 'M':
-      mu_argp_node_list_new (&lst, "url", arg);
+      mu_argp_node_list_new (lst, "url", arg);
       break;
 
     case ARGP_KEY_INIT:
@@ -268,7 +268,7 @@ mu_mailer_argp_parser (int key, char *arg, struct argp_state *state)
       break;
 
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, "mailer", NULL);
+      mu_argp_node_list_finish (lst, "mailer", NULL);
       break;
 
     default:
@@ -306,17 +306,17 @@ static struct argp_option mu_debug_argp_options[] =
 static error_t
 mu_debug_argp_parser (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
     case OPT_DEBUG_LEVEL:
       mu_global_debug_from_string (arg, "command line");
-      /*mu_argp_node_list_new (&lst, "level", arg);*/
+      /*mu_argp_node_list_new (lst, "level", arg);*/
       break;
 
     case OPT_LINE_INFO:
-      mu_argp_node_list_new (&lst, "line-info", "yes");
+      mu_argp_node_list_new (lst, "line-info", "yes");
       break;
       
     case ARGP_KEY_INIT:
@@ -324,7 +324,7 @@ mu_debug_argp_parser (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, "debug", NULL);
+      mu_argp_node_list_finish (lst, "debug", NULL);
       break;
       
     default:
diff --git a/libmu_argp/sieve.c b/libmu_argp/sieve.c
index 066fa4c..2bff3d3 100644
--- a/libmu_argp/sieve.c
+++ b/libmu_argp/sieve.c
@@ -44,24 +44,24 @@ static struct argp_option sieve_argp_option[] = {
 static error_t
 sieve_argp_parser (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
   
   switch (key)
     {
     case 'I':
-      mu_argp_node_list_new (&lst, "include-path", arg);
+      mu_argp_node_list_new (lst, "include-path", arg);
       break;
 
     case 'L':
-      mu_argp_node_list_new (&lst, "library-path", arg);
+      mu_argp_node_list_new (lst, "library-path", arg);
       break;
 
     case OPT_CLEAR_INCLUDE_PATH:
-      mu_argp_node_list_new (&lst, "clear-include-path", "yes");
+      mu_argp_node_list_new (lst, "clear-include-path", "yes");
       break;
 
     case OPT_CLEAR_LIBRARY_PATH:
-      mu_argp_node_list_new (&lst, "clear-library-path", "yes");
+      mu_argp_node_list_new (lst, "clear-library-path", "yes");
       break;
       
     case ARGP_KEY_INIT:
@@ -69,7 +69,7 @@ sieve_argp_parser (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, "sieve", NULL);
+      mu_argp_node_list_finish (lst, "sieve", NULL);
       break;
 			   
     default:
diff --git a/libmu_argp/tls.c b/libmu_argp/tls.c
index 4688fc8..b516062 100644
--- a/libmu_argp/tls.c
+++ b/libmu_argp/tls.c
@@ -35,12 +35,12 @@ static struct argp_option _tls_argp_options[] = {
 static error_t
 _tls_argp_parser (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
   
   switch (key)
     {
     case OPT_TLS:
-      mu_argp_node_list_new (&lst, "enable", arg ? arg : "yes");
+      mu_argp_node_list_new (lst, "enable", arg ? arg : "yes");
       break;
       
     case ARGP_KEY_INIT:
@@ -48,7 +48,7 @@ _tls_argp_parser (int key, char *arg, struct argp_state *state)
       break;
 
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, "tls", NULL);
+      mu_argp_node_list_finish (lst, "tls", NULL);
       break;
       
     default:
diff --git a/maidag/maidag.c b/maidag/maidag.c
index 69183ea..ea04f07 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -184,32 +184,32 @@ set_debug_flags (mu_debug_t debug, const char *arg)
 static error_t
 parse_opt (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
     case 'd':
-      mu_argp_node_list_new (&lst, "mode", "daemon");
+      mu_argp_node_list_new (lst, "mode", "daemon");
       if (arg)
-	mu_argp_node_list_new (&lst, "max-children", arg);
+	mu_argp_node_list_new (lst, "max-children", arg);
       break;
 
     case 'i':
-      mu_argp_node_list_new (&lst, "mode", "inetd");
+      mu_argp_node_list_new (lst, "mode", "inetd");
       break;
 
     case FOREGROUND_OPTION:
-      mu_argp_node_list_new (&lst, "foreground", "yes");
+      mu_argp_node_list_new (lst, "foreground", "yes");
       break;
       
     case MESSAGE_ID_HEADER_OPTION:
-      mu_argp_node_list_new (&lst, "message-id-header", arg);
+      mu_argp_node_list_new (lst, "message-id-header", arg);
       break;
 
     case LMTP_OPTION:
-      mu_argp_node_list_new (&lst, "lmtp", "yes");
+      mu_argp_node_list_new (lst, "lmtp", "yes");
       if (arg)
-	mu_argp_node_list_new (&lst, "listen", arg);
+	mu_argp_node_list_new (lst, "listen", arg);
       break;
 
     case 'r':
@@ -242,11 +242,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case 'x':
-      mu_argp_node_list_new (&lst, "debug", arg ? arg : D_DEFAULT);
+      mu_argp_node_list_new (lst, "debug", arg ? arg : D_DEFAULT);
       break;
 
     case STDERR_OPTION:
-      mu_argp_node_list_new (&lst, "stderr", "yes");
+      mu_argp_node_list_new (lst, "stderr", "yes");
       break;
 
     case URL_OPTION:
@@ -258,7 +258,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
       
     case ARGP_KEY_ERROR:
diff --git a/mailbox/cfg_format.c b/mailbox/cfg_format.c
index 0cdbb2d..4dcf6d5 100644
--- a/mailbox/cfg_format.c
+++ b/mailbox/cfg_format.c
@@ -186,13 +186,18 @@ format_node_end (const mu_cfg_node_t *node, void *data)
 void
 mu_cfg_format_parse_tree (mu_stream_t stream, mu_cfg_tree_t *tree, int flags)
 {
+  struct mu_cfg_iter_closure clos;
   struct tree_print t;
+
   t.flags = flags;
   t.level = 0;
   t.stream = stream;
   t.buf = NULL;
   t.bufsize = 0;
-  mu_cfg_preorder (tree->head, format_node, format_node_end, &t);
+  clos.beg = format_node;
+  clos.end = format_node_end;
+  clos.data = &t;
+  mu_cfg_preorder (tree->nodes, &clos);
   free (t.buf);
 }
 
@@ -200,6 +205,7 @@ void
 mu_cfg_format_node (mu_stream_t stream, const mu_cfg_node_t *node, int flags)
 {
   struct tree_print t;
+  
   t.flags = flags;
   t.level = 0;
   t.stream = stream;
@@ -208,7 +214,11 @@ mu_cfg_format_node (mu_stream_t stream, const mu_cfg_node_t *node, int flags)
   format_node (node, &t);
   if (node->type == mu_cfg_node_statement)
     {
-      mu_cfg_preorder (node->node, format_node, format_node_end, &t);
+      struct mu_cfg_iter_closure clos;
+      clos.beg = format_node;
+      clos.end = format_node_end;
+      clos.data = &t;
+      mu_cfg_preorder (node->nodes, &clos);
       format_node_end (node, &t);
     }
 }
diff --git a/mailbox/cfg_parser.y b/mailbox/cfg_parser.y
index f938526..bb32d46 100644
--- a/mailbox/cfg_parser.y
+++ b/mailbox/cfg_parser.y
@@ -38,7 +38,7 @@
 #include <mailutils/mutil.h>  
 
 int mu_cfg_parser_verbose;
-static mu_cfg_node_t *parse_head, *parse_tail;
+static mu_list_t /* of mu_cfg_node_t */ parse_node_list; 
 mu_cfg_locus_t mu_cfg_locus;
 size_t mu_cfg_error_count;
 
@@ -75,7 +75,7 @@ config_value_dup (mu_config_value_t *src)
 static mu_cfg_node_t *
 mu_cfg_alloc_node (enum mu_cfg_node_type type, mu_cfg_locus_t *loc,
 		   const char *tag, mu_config_value_t *label,
-		   mu_cfg_node_t *node)
+		   mu_list_t nodelist)
 {
   char *p;
   mu_cfg_node_t *np;
@@ -87,8 +87,7 @@ mu_cfg_alloc_node (enum mu_cfg_node_type type, mu_cfg_locus_t *loc,
   np->tag = p;
   strcpy (p, tag);
   np->label = label;
-  np->node = node;
-  np->next = NULL;
+  np->nodes = nodelist;
   return np;
 }
 
@@ -179,12 +178,44 @@ debug_print_node (mu_cfg_node_t *node)
     }
 }
 
+static void
+free_node_item (void *item)
+{
+  mu_cfg_node_t *node = item;
+
+  switch (node->type)
+    {
+    case mu_cfg_node_statement:
+      mu_list_destroy (&node->nodes);
+      break;
+      
+    case mu_cfg_node_undefined: /* hmm... */
+    case mu_cfg_node_param:
+      break;
+    }
+  mu_cfg_free_node (node);
+}
+
+int
+mu_cfg_create_node_list (mu_list_t *plist)
+{
+  int rc;
+  mu_list_t list;
+
+  rc = mu_list_create (&list);
+  if (rc)
+    return rc;
+  mu_list_set_destroy_item (list, free_node_item);
+  *plist = list;
+  return 0;
+}
+
 %}
 
 %union {
   mu_cfg_node_t node;
   mu_cfg_node_t *pnode;
-  struct { mu_cfg_node_t *head, *tail; } nodelist;
+  mu_list_t /* of mu_cfg_node_t */ nodelist;
   char *string;
   mu_config_value_t value, *pvalue;
   mu_list_t list;
@@ -205,21 +236,19 @@ debug_print_node (mu_cfg_node_t *node)
 
 input   : stmtlist
 	  {
-	    parse_head = $1.head;
-	    parse_tail = $1.tail;
+	    parse_node_list = $1;
 	  }
 	;
 
 stmtlist: stmt
 	  {
-	    $$.head = $$.tail = $1;
-	    debug_print_node ($1);
+	    mu_cfg_create_node_list (&$$);
+	    mu_list_append ($$, $1);
 	  }
 	| stmtlist stmt
 	  {
+	    mu_list_append ($1, $2);
 	    $$ = $1;
-	    $$.tail->next = $2;
-	    $$.tail = $2;
 	    debug_print_node ($2);
 	  }
 	;
@@ -246,8 +275,7 @@ block   : ident tag '{' '}' opt_sc
 	| ident tag '{' stmtlist '}' opt_sc
 	  {
 	    $$ = mu_cfg_alloc_node (mu_cfg_node_statement, &$1.locus,
-				    $1.name, $2,
-				    $4.head);
+				    $1.name, $2, $4);
 
 	  }
 	;
@@ -443,10 +471,9 @@ mu_cfg_parse (mu_cfg_tree_t **ptree)
   tree = mu_alloc (sizeof (*tree));
   tree->debug = _mu_cfg_debug;
   _mu_cfg_debug = NULL;
-  tree->head = parse_head;
-  tree->tail = parse_tail;
+  tree->nodes = parse_node_list;
   tree->pool = mu_cfg_lexer_pool ();
-  parse_head = parse_tail = NULL;
+  parse_node_list = NULL;
   *ptree = tree;
   return rc;
 }
@@ -479,12 +506,9 @@ mu_cfg_tree_union (mu_cfg_tree_t **pa, mu_cfg_tree_t **pb)
     return rc;
     
   /* Link node lists */
-  if (a->tail)
-    a->tail->next = b->head;
-  else
-    a->head = b->head;
-  a->tail = b->tail;
-
+  mu_list_append_list (a->nodes, b->nodes);
+  mu_list_destroy (&b->nodes);
+  
   mu_debug_destroy (&b->debug, mu_debug_get_owner (b->debug));
   free (b);
   *pb = NULL;
@@ -539,11 +563,20 @@ do_include (const char *name, int flags, mu_cfg_locus_t *loc)
 int
 mu_cfg_tree_postprocess (mu_cfg_tree_t *tree, int flags)
 {
-  mu_cfg_node_t *prev, *node;
+  int rc;
+  mu_iterator_t itr;
 
-  for (prev = NULL, node = tree->head; node; )
+  if (!tree->nodes)
+    return 0;
+  rc = mu_list_get_iterator (tree->nodes, &itr);
+  if (rc)
+    return rc;
+  for (mu_iterator_first (itr); !mu_iterator_is_done (itr);
+       mu_iterator_next (itr))
     {
-      mu_cfg_node_t *next = node->next;
+      mu_cfg_node_t *node;
+
+      mu_iterator_current (itr, (void**) &node);
 
       if (node->type == mu_cfg_node_statement)
 	{
@@ -554,180 +587,90 @@ mu_cfg_tree_postprocess (mu_cfg_tree_t *tree, int flags)
 		{
 		  if (strcmp (node->label->v.string, mu_program_name) == 0)
 		    {
-		      mu_cfg_node_t *p;
-		      
 		      /* Move all nodes from this block to the topmost
 			 level */
-		      if (prev)
-			prev->next = node->node;
-		      else
-			tree->head = node->node;
-		      p = node->node;
-		      mu_cfg_free_node (node);
-		      for (node = prev->next; node->next; node = node->next)
-			;
-		      node->next = next;
+		      mu_iterator_ctl (itr, mu_itrctl_insert_list,
+				       node->nodes);
+		      mu_iterator_ctl (itr, mu_itrctl_delete, NULL);
+		      /*FIXME:mu_cfg_free_node (node);*/
 		    }
 		}
 	      else
 		{
 		  mu_cfg_perror (tree->debug, &node->locus,
 				 _("argument to `program' is not a string"));
-		  if (prev)
-		    prev->next = next;
-		  else
-		    tree->head = next;
-		  mu_cfg_free_node (node);
+		  mu_iterator_ctl (itr, mu_itrctl_delete, NULL);
 		}
 	    }
 	}
       else if (node->type == mu_cfg_node_param &&
 	       strcmp (node->tag, "include") == 0)
 	{
-	  /* Remove node from the list */
-	  if (prev)
-	    prev->next = next;
-	  else
-	    tree->head = next;
-	      
 	  if (node->label->type == MU_CFG_STRING)
 	    {
 	      mu_cfg_tree_t *t = do_include (node->label->v.string, flags,
 					     &node->locus);
 	      if (t)
 		{
-		  if (prev)
-		    prev->next = t->head;
-		  else
-		    tree->head = t->head;
-		  
-		  t->tail->next = next;
-		  
-		  /* FIXME: check return value */
+		  /* Merge the new tree into the current point and
+		     destroy the rest of it */
+		  mu_iterator_ctl (itr, mu_itrctl_insert_list, t->nodes);
 		  mu_opool_union (&tree->pool, &t->pool);
-		  mu_debug_destroy (&t->debug, NULL);
-		  free (t);
+		  mu_cfg_destroy_tree (&t);
 		}		      
 	    }
 	  else
 	    mu_cfg_perror (tree->debug, &node->locus,
 			   _("argument to `include' is not a string"));
-	  mu_cfg_free_node (node);
+	  /* Remove node from the list */
+	  mu_iterator_ctl (itr, mu_itrctl_delete, NULL);
 	}
-	  
-      prev = node;
-      node = next;
     }
   return 0;
 }
 
 static int
-_mu_cfg_preorder_recursive (mu_cfg_node_t *node,
-			    mu_cfg_iter_func_t beg, mu_cfg_iter_func_t end,
-			    void *data)
-{
-  switch (node->type)
-    {
-    case mu_cfg_node_undefined:
-      abort ();
-
-    case mu_cfg_node_statement:
-      switch (beg (node, data))
-	{
-	case MU_CFG_ITER_OK:
-	  if (mu_cfg_preorder (node->node, beg, end, data))
-	    return MU_CFG_ITER_STOP;
-	  if (end && end (node, data) == MU_CFG_ITER_STOP)
-	    return MU_CFG_ITER_STOP;
-	  break;
-
-	case MU_CFG_ITER_SKIP:
-	  break;
-
-	case MU_CFG_ITER_STOP:
-	  return MU_CFG_ITER_STOP;
-	}
-      break;
-
-    case mu_cfg_node_param:
-      return beg (node, data);
-    }
-  return MU_CFG_ITER_OK;
-}
-
-int
-mu_cfg_preorder(mu_cfg_node_t *node,
-		mu_cfg_iter_func_t beg, mu_cfg_iter_func_t end, void *data)
+_mu_cfg_preorder_recursive (void *item, void *cbdata)
 {
-  for (; node; node = node->next)
-    if (_mu_cfg_preorder_recursive(node, beg, end, data)  == MU_CFG_ITER_STOP)
-      return 1;
-  return 0;
-}
+  mu_cfg_node_t *node = item;
+  struct mu_cfg_iter_closure *clos = cbdata;
 
-static int
-_mu_cfg_postorder_recursive(mu_cfg_node_t *node,
-			    mu_cfg_iter_func_t beg, mu_cfg_iter_func_t end,
-			    void *data)
-{
   switch (node->type)
     {
     case mu_cfg_node_undefined:
       abort ();
 
     case mu_cfg_node_statement:
-      switch (beg (node, data))
+      switch (clos->beg (node, clos->data))
 	{
 	case MU_CFG_ITER_OK:
-	  if (mu_cfg_postorder (node->node, beg, end, data))
-	    return MU_CFG_ITER_STOP;
-	  if (end && end (node, data) == MU_CFG_ITER_STOP)
-	    return MU_CFG_ITER_STOP;
+	  if (mu_cfg_preorder (node->nodes, clos))
+	    return 1;
+	  if (clos->end && clos->end (node, clos->data) == MU_CFG_ITER_STOP)
+	    return 1;
 	  break;
 
 	case MU_CFG_ITER_SKIP:
 	  break;
 
 	case MU_CFG_ITER_STOP:
-	  return MU_CFG_ITER_STOP;
+	  return 1;
 	}
       break;
 
     case mu_cfg_node_param:
-      return beg (node, data);
+      return clos->beg (node, clos->data) == MU_CFG_ITER_STOP;
     }
   return 0;
 }
 
 int
-mu_cfg_postorder (mu_cfg_node_t *node,
-		  mu_cfg_iter_func_t beg, mu_cfg_iter_func_t end, void *data)
+mu_cfg_preorder (mu_list_t nodelist, struct mu_cfg_iter_closure *clos)
 {
-  if (!node)
-    return 1;
-  if (node->next
-      && mu_cfg_postorder (node->next, beg, end, data) == MU_CFG_ITER_STOP)
-    return 1;
-  return _mu_cfg_postorder_recursive (node, beg, end, data)
-		== MU_CFG_ITER_STOP;
+  return mu_list_do (nodelist, _mu_cfg_preorder_recursive, clos);
 }
 
 
-static int
-free_section (const mu_cfg_node_t *node, void *data)
-{
-  if (node->type == mu_cfg_node_statement)
-    free ((void *) node);
-  return MU_CFG_ITER_OK;
-}
-
-static int
-free_param (const mu_cfg_node_t *node, void *data)
-{
-  if (node->type == mu_cfg_node_param)
-    free ((void*) node);
-  return MU_CFG_ITER_OK;
-}
 
 void
 mu_cfg_destroy_tree (mu_cfg_tree_t **ptree)
@@ -735,7 +678,7 @@ mu_cfg_destroy_tree (mu_cfg_tree_t **ptree)
   if (ptree && *ptree)
     {
       mu_cfg_tree_t *tree = *ptree;
-      mu_cfg_postorder (tree->head, free_param, free_section, NULL);
+      mu_list_destroy (&tree->nodes);
       mu_opool_destroy (&tree->pool);
       *ptree = NULL;
     }
@@ -1423,11 +1366,14 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct mu_cfg_section *sections,
 {
   mu_debug_t debug = NULL;
   struct scan_tree_data dat;
+  struct mu_cfg_iter_closure clos;
+    
   dat.tree = tree;
   dat.list = NULL;
   dat.error = 0;
   dat.call_data = data;
   dat.target = target;
+  
   if (!tree->debug)
     {
       mu_diag_get_debug (&debug);
@@ -1435,7 +1381,10 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct mu_cfg_section *sections,
     }
   if (push_section (&dat, sections))
     return 1;
-  mu_cfg_preorder (tree->head, _scan_tree_helper, _scan_tree_end_helper, &dat);
+  clos.beg = _scan_tree_helper;
+  clos.end = _scan_tree_end_helper;
+  clos.data = &dat;
+  mu_cfg_preorder (tree->nodes, &clos);
   if (debug)
     {
       mu_debug_set_locus (debug, NULL, 0);
@@ -1501,7 +1450,7 @@ mu_cfg_tree_create_node (struct mu_cfg_tree *tree,
 			 enum mu_cfg_node_type type,
 			 const mu_cfg_locus_t *loc,
 			 const char *tag, const char *label,
-			 mu_cfg_node_t *node)
+			 mu_list_t nodelist)
 {
   char *p;
   mu_cfg_node_t *np;
@@ -1528,24 +1477,32 @@ mu_cfg_tree_create_node (struct mu_cfg_tree *tree,
     }
   else
     np->label = NULL;
-  np->node = node;
-  np->next = NULL;
+  np->nodes = nodelist;
   return np;
 }
 
 void
 mu_cfg_tree_add_node (mu_cfg_tree_t *tree, mu_cfg_node_t *node)
 {
-  if (!tree->head)
-    tree->head = node;
-  else
-    {
-      mu_cfg_node_t *p;
-      for (p = tree->head; p->next; p = p->next)
-	;
-      p->next = node;
-    }
+  if (!node)
+    return;
+  if (!tree->nodes)
+    /* FIXME: return code? */
+    mu_cfg_create_node_list (&tree->nodes);
+  mu_list_append (tree->nodes, node);
+}
+
+void
+mu_cfg_tree_add_nodelist (mu_cfg_tree_t *tree, mu_list_t nodelist)
+{
+  if (!nodelist)
+    return;
+  if (!tree->nodes)
+    /* FIXME: return code? */
+    mu_cfg_create_node_list (&tree->nodes);
+  mu_list_append_list (tree->nodes, nodelist);
 }
+
 
 /* Return 1 if configuration value A equals B */
 int
@@ -1740,10 +1697,11 @@ node_finder (const mu_cfg_node_t *node, void *data)
 }
 
 int	    
-mu_cfg_find_node (mu_cfg_node_t *tree, const char *path, mu_cfg_node_t **pval)
+mu_cfg_find_node (mu_cfg_tree_t *tree, const char *path, mu_cfg_node_t **pval)
 {
   int rc;
   struct find_data data;
+  struct mu_cfg_iter_closure clos;
 
   rc = mu_argcv_get_np (path, strlen (path),
 			MU_CFG_PATH_DELIM_STR, NULL,
@@ -1752,7 +1710,11 @@ mu_cfg_find_node (mu_cfg_node_t *tree, const char *path, mu_cfg_node_t **pval)
     return rc;
   data.tag = 0;
   parse_tag (&data);
-  rc = mu_cfg_preorder (tree, node_finder, NULL, &data);
+
+  clos.beg = node_finder;
+  clos.end = NULL;
+  clos.data = &data;
+  rc = mu_cfg_preorder (tree->nodes, &clos);
   destroy_value (data.label);
   if (rc)
     {
@@ -1784,6 +1746,7 @@ mu_cfg_create_subtree (const char *path, mu_cfg_node_t **pnode)
 
   for (i = argc - 1; i >= 0; i--)
     {
+      mu_list_t nodelist = NULL;
       char *p = strrchr (argv[i], '=');
       mu_config_value_t *label = NULL;
 
@@ -1795,8 +1758,13 @@ mu_cfg_create_subtree (const char *path, mu_cfg_node_t **pnode)
 	  if (i == argc - 1)
 	    type = mu_cfg_node_param;
 	}
-      
-      node = mu_cfg_alloc_node (type, &locus, argv[i], label, node);
+
+      if (node)
+	{
+	  mu_cfg_create_node_list (&nodelist);
+	  mu_list_append (nodelist, node);
+	}
+      node = mu_cfg_alloc_node (type, &locus, argv[i], label, nodelist);
     }
 
   mu_argcv_free (argc, argv);
diff --git a/mailbox/freeitem.c b/mailbox/freeitem.c
index 65dd7f9..c268ea4 100644
--- a/mailbox/freeitem.c
+++ b/mailbox/freeitem.c
@@ -19,6 +19,7 @@
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
+#include <stdlib.h>
 
 /* Default destroy_item function. */
 void
diff --git a/mailbox/list.c b/mailbox/list.c
index 3ba6477..f47af25 100644
--- a/mailbox/list.c
+++ b/mailbox/list.c
@@ -359,7 +359,7 @@ mu_list_do (mu_list_t list, mu_list_action_t *action, void *cbdata)
 
   if (list == NULL || action == NULL)
     return EINVAL;
-  status = mu_list_get_iterator(list, &itr);
+  status = mu_list_get_iterator (list, &itr);
   if (status)
     return status;
   for (mu_iterator_first (itr); !mu_iterator_is_done (itr);
diff --git a/mailbox/listlist.c b/mailbox/listlist.c
index af52862..060c724 100644
--- a/mailbox/listlist.c
+++ b/mailbox/listlist.c
@@ -107,6 +107,7 @@ mu_list_append_list (mu_list_t list, mu_list_t new_list)
   if (list->count == 0)
     {
       list->head = new_list->head;
+      list->head.next->prev = list->head.prev->next = &list->head;
       list->count = new_list->count;
     }
   else
@@ -123,6 +124,7 @@ mu_list_prepend_list (mu_list_t list, mu_list_t new_list)
   if (list->count == 0)
     {
       list->head = new_list->head;
+      list->head.next->prev = list->head.prev->next = &list->head;
       list->count = new_list->count;
     }
   else
diff --git a/mimeview/mimeview.c b/mimeview/mimeview.c
index 89e5ce8..45945e4 100644
--- a/mimeview/mimeview.c
+++ b/mimeview/mimeview.c
@@ -93,7 +93,7 @@ set_debug_flags (mu_debug_t debug, const char *arg)
 static error_t
 parse_opt (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
@@ -108,7 +108,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
     case ARGP_KEY_FINI:
       if (dry_run && !debug_level)
 	debug_level = 1;
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
 
     case 'a':
@@ -117,7 +117,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case 'd':
-      mu_argp_node_list_new (&lst, "debug", arg ? arg : "9");
+      mu_argp_node_list_new (lst, "debug", arg ? arg : "9");
       break;
 
     case 'h':
@@ -129,11 +129,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case 't':
-      mu_argp_node_list_new (&lst, "mimetypes", arg);
+      mu_argp_node_list_new (lst, "mimetypes", arg);
       break;
 
     case OPT_METAMAIL:
-      mu_argp_node_list_new (&lst, "metamail", arg ? arg : "metamail");
+      mu_argp_node_list_new (lst, "metamail", arg ? arg : "metamail");
       break;
       
     default: 
diff --git a/movemail/movemail.c b/movemail/movemail.c
index d843bb6..a385173 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -111,24 +111,24 @@ mu_kwd_t method_kwd[] = {
 static error_t
 parse_opt (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
     case 'r':
-      mu_argp_node_list_new (&lst, "reverse", "yes");
+      mu_argp_node_list_new (lst, "reverse", "yes");
       break;
 
     case 'p':
-      mu_argp_node_list_new (&lst, "preserve", "yes");
+      mu_argp_node_list_new (lst, "preserve", "yes");
       break;
 
     case 'P':
-      mu_argp_node_list_new (&lst, "mailbox-ownership", arg);
+      mu_argp_node_list_new (lst, "mailbox-ownership", arg);
       break;
 
     case 'u':
-      mu_argp_node_list_new (&lst, "uidl", "yes");
+      mu_argp_node_list_new (lst, "uidl", "yes");
       break;
 
     case 'v':
@@ -136,7 +136,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case OPT_EMACS:
-      mu_argp_node_list_new (&lst, "emacs", "yes");
+      mu_argp_node_list_new (lst, "emacs", "yes");
       break;
 
     case ARGP_KEY_INIT:
@@ -144,7 +144,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
       
     default:
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c
index 8490fff..d0e7b60 100644
--- a/pop3d/pop3d.c
+++ b/pop3d/pop3d.c
@@ -146,22 +146,22 @@ static const char *pop3d_argp_capa[] = {
 static error_t
 pop3d_parse_opt (int key, char *arg, struct argp_state *astate)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
   
   switch (key)
     {
     case 'd':
-      mu_argp_node_list_new (&lst, "mode", "daemon");
+      mu_argp_node_list_new (lst, "mode", "daemon");
       if (arg)
-	mu_argp_node_list_new (&lst, "max-children", arg);
+	mu_argp_node_list_new (lst, "max-children", arg);
       break;
 
     case 'i':
-      mu_argp_node_list_new (&lst, "mode", "inetd");
+      mu_argp_node_list_new (lst, "mode", "inetd");
       break;
 
     case OPT_FOREGROUND:
-      mu_argp_node_list_new (&lst, "foreground", "yes");
+      mu_argp_node_list_new (lst, "foreground", "yes");
       break;
       
     case ARGP_KEY_INIT:
@@ -169,7 +169,7 @@ pop3d_parse_opt (int key, char *arg, struct argp_state *astate)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
       
     default:
diff --git a/readmsg/readmsg.c b/readmsg/readmsg.c
index 72406b5..b3e79dd 100644
--- a/readmsg/readmsg.c
+++ b/readmsg/readmsg.c
@@ -79,7 +79,7 @@ int show_all = 0;
 static error_t
 readmsg_parse_opt (int key, char *arg, struct argp_state *astate)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
 
   switch (key)
     {
@@ -88,27 +88,27 @@ readmsg_parse_opt (int key, char *arg, struct argp_state *astate)
       break;
 
     case 'h':
-      mu_argp_node_list_new (&lst, "header", "yes");
+      mu_argp_node_list_new (lst, "header", "yes");
       break;
 
     case 'f':
-      mu_argp_node_list_new (&lst, "folder", arg);
+      mu_argp_node_list_new (lst, "folder", arg);
       break;
 
     case 'w':
-      mu_argp_node_list_new (&lst, "weedlist", arg);
+      mu_argp_node_list_new (lst, "weedlist", arg);
       break;
 
     case 'n':
-      mu_argp_node_list_new (&lst, "no-header", "yes");
+      mu_argp_node_list_new (lst, "no-header", "yes");
       break;
 
     case 'p':
-      mu_argp_node_list_new (&lst, "form-feeds", "yes");
+      mu_argp_node_list_new (lst, "form-feeds", "yes");
       break;
 	  
     case 'a':
-      mu_argp_node_list_new (&lst, "show-all-match", "yes");
+      mu_argp_node_list_new (lst, "show-all-match", "yes");
       break;
 
     case ARGP_KEY_INIT:
@@ -117,8 +117,8 @@ readmsg_parse_opt (int key, char *arg, struct argp_state *astate)
       
     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);
+	mu_argp_node_list_new (lst, "debug", mu_umaxtostr (0, dbug));
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
       
     default:
diff --git a/sieve/sieve.c b/sieve/sieve.c
index 5aa3430..ce8b9c6 100644
--- a/sieve/sieve.c
+++ b/sieve/sieve.c
@@ -172,12 +172,12 @@ mu_compat_printer (void *data, mu_log_level_t level, const char *buf)
 static error_t
 parser (int key, char *arg, struct argp_state *state)
 {
-  static struct mu_argp_node_list lst;
+  static mu_list_t lst;
   
   switch (key)
     {
     case 'e':
-      mu_argp_node_list_new (&lst, "email", arg);
+      mu_argp_node_list_new (lst, "email", arg);
       break;
       
     case 'n':
@@ -185,7 +185,7 @@ parser (int key, char *arg, struct argp_state *state)
       break;
 
     case 'k':
-      mu_argp_node_list_new (&lst, "keep-going", "yes");
+      mu_argp_node_list_new (lst, "keep-going", "yes");
       break;
 
     case 'c':
@@ -197,23 +197,23 @@ parser (int key, char *arg, struct argp_state *state)
       break;
       
     case 'f':
-      mu_argp_node_list_new (&lst, "mbox-url", arg);
+      mu_argp_node_list_new (lst, "mbox-url", arg);
       break;
       
     case 't':
-      mu_argp_node_list_new (&lst, "ticket", arg);
+      mu_argp_node_list_new (lst, "ticket", arg);
       break;
       
     case 'd':
-      mu_argp_node_list_new (&lst, "debug", arg ? arg : D_DEFAULT);
+      mu_argp_node_list_new (lst, "debug", arg ? arg : D_DEFAULT);
       break;
 
     case 'v':
-      mu_argp_node_list_new (&lst, "verbose", "yes");
+      mu_argp_node_list_new (lst, "verbose", "yes");
       break;
 
     case ARG_LINE_INFO:
-      mu_argp_node_list_new (&lst, "line-info",
+      mu_argp_node_list_new (lst, "line-info",
 			     is_true_p (arg) ? "yes" : "no");
       break;
 
@@ -236,7 +236,7 @@ parser (int key, char *arg, struct argp_state *state)
       break;
       
     case ARGP_KEY_FINI:
-      mu_argp_node_list_finish (&lst, NULL, NULL);
+      mu_argp_node_list_finish (lst, NULL, NULL);
       break;
       
     default:


hooks/post-receive
-- 
GNU Mailutils



