From MAILER-DAEMON Wed Feb 18 06:35:47 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LZkiR-0001Nu-85
	for mharc-commit-mailutils@gnu.org; Wed, 18 Feb 2009 06:35:47 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LZkiP-0001M2-O3
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 06:35:45 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LZkiO-0001Jk-8D
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 06:35:45 -0500
Received: from [199.232.76.173] (port=57128 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LZkiO-0001JY-5S
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 06:35:44 -0500
Received: from savannah.gnu.org ([199.232.41.3]:40895 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LZkiN-00022O-TA
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 06:35:43 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LZkiN-0001nq-9Y
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 11:35:43 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LZkiM-0001nM-7J
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 11:35:43 +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: 693a762247068c84ded36985b88ecd3af7040f5c
X-Git-Newrev: fad4a6d91ba4baa58613b5e70d21acc61d108206
Message-Id: <E1LZkiM-0001nM-7J@cvs.savannah.gnu.org>
Date: Wed, 18 Feb 2009 11:35:42 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-223-gfad4a6d
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, 18 Feb 2009 11:35:46 -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=fad4a6d91ba4baa58613b5e70d21acc61d108206

The branch, master has been updated
       via  fad4a6d91ba4baa58613b5e70d21acc61d108206 (commit)
      from  693a762247068c84ded36985b88ecd3af7040f5c (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 fad4a6d91ba4baa58613b5e70d21acc61d108206
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Feb 18 13:35:34 2009 +0200

    Update timestamp

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

Summary of changes:
 NEWS |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index f849ea4..dacd593 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2008-12-26
+GNU mailutils NEWS -- history of user-visible changes. 2009-02-18
 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 
 2008 Free Software Foundation, Inc.
 See the end of file for copying conditions.


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Wed Feb 18 19:41:03 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LZwyN-0000v2-0R
	for mharc-commit-mailutils@gnu.org; Wed, 18 Feb 2009 19:41:03 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LZwyL-0000ux-Bz
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 19:41:01 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LZwyJ-0000ul-Fy
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 19:41:00 -0500
Received: from [199.232.76.173] (port=43214 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LZwyJ-0000ui-Bx
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 19:40:59 -0500
Received: from savannah.gnu.org ([199.232.41.3]:43384 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LZwyJ-0001Vh-08
	for commit-mailutils@gnu.org; Wed, 18 Feb 2009 19:40:59 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LZwyI-0000YW-AT
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 00:40:58 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LZwyH-0000Y1-TE
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 00:40:58 +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: 72d640b2d7d0d4722890f443c2a55ac410bf6e7e
X-Git-Newrev: 45540e1d4744eaea8a86f7e7f03fc6f6f3000cf5
Message-Id: <E1LZwyH-0000Y1-TE@cvs.savannah.gnu.org>
Date: Thu, 19 Feb 2009 00:40:58 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-226-g45540e1
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Feb 2009 00:41: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=45540e1d4744eaea8a86f7e7f03fc6f6f3000cf5

The branch, master has been updated
       via  45540e1d4744eaea8a86f7e7f03fc6f6f3000cf5 (commit)
       via  c1851318b12fd5a77c6a2c30e7801f5faa9941b7 (commit)
      from  72d640b2d7d0d4722890f443c2a55ac410bf6e7e (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 45540e1d4744eaea8a86f7e7f03fc6f6f3000cf5
Merge: c1851318b12fd5a77c6a2c30e7801f5faa9941b7 72d640b2d7d0d4722890f443c2a55ac410bf6e7e
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Feb 19 02:40:33 2009 +0200

    Merge branch 'master' of ssh://gray@git.savannah.gnu.org/srv/git/mailutils

commit c1851318b12fd5a77c6a2c30e7801f5faa9941b7
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Thu Feb 19 02:40:07 2009 +0200

    Bugfix
    
    * libproto/mailer/prog.c (_expand_sender): Allocate memory.

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

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

diff --git a/libproto/mailer/prog.c b/libproto/mailer/prog.c
index 7d6666e..5884553 100644
--- a/libproto/mailer/prog.c
+++ b/libproto/mailer/prog.c
@@ -138,12 +138,12 @@ static int
 _expand_sender (const char *name, void *data, char **p)
 {
   mu_address_t addr = data;
-  const char *email;
-  int status = mu_address_sget_email (addr, 1, &email);
+  char *email;
+  int status = mu_address_aget_email (addr, 1, &email);
 
   if (status != 0)
     return status;
-  *(const char**)p = email;
+  *p = email;
   return 0;
 }
 


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Thu Feb 19 18:00:44 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LaHsq-0001r5-8p
	for mharc-commit-mailutils@gnu.org; Thu, 19 Feb 2009 18:00:44 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LaHsn-0001oN-Us
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 18:00:42 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LaHsl-0001oA-Fo
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 18:00:40 -0500
Received: from [199.232.76.173] (port=41933 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LaHsl-0001o7-6T
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 18:00:39 -0500
Received: from savannah.gnu.org ([199.232.41.3]:46560 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LaHsk-0007x0-8K
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 18:00:38 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LaHsj-0008Tg-OJ
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 23:00:37 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LaHse-0008Sh-UE
	for commit-mailutils@gnu.org; Thu, 19 Feb 2009 23:00:37 +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: 02ce501ad40d661045abc67f280bfd3d06bd81b7
X-Git-Newrev: a4e1e5e8481565d97804c083752ee3eea0ebf87e
Message-Id: <E1LaHse-0008Sh-UE@cvs.savannah.gnu.org>
Date: Thu, 19 Feb 2009 23:00:33 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-228-ga4e1e5e
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Feb 2009 23:00:42 -0000

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

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

The branch, master has been updated
       via  a4e1e5e8481565d97804c083752ee3eea0ebf87e (commit)
      from  02ce501ad40d661045abc67f280bfd3d06bd81b7 (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 a4e1e5e8481565d97804c083752ee3eea0ebf87e
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Feb 20 00:56:08 2009 +0200

    Remove leftover dependencies of libmailutils from gnulib
    
    * bootstrap.conf (gnulib_extra_files): Remove.
    * gnulib.modules (inttostr): Add module.
    * include/mailutils/io.h: New file.
    * include/mailutils/Makefile.am: Add io.h
    
    * mailbox/inttostr.c, mailbox/inttostr.h: Remove
    * mailbox/imaxtostr.c, mailbox/offtostr.c, mailbox/umaxtostr.c: Remove
    * mailbox/intprops.h: Remove
    * mailbox/asnprintf.c, mailbox/asprintf.c, mailbox/vasnprintf.c: New files.
    * mailbox/Makefile.am: Update.
    
    * mailbox/mu_umaxtostr.c: rename to lib/mu_umaxtostr.c
    * mailbox/mu_umaxtostr.h: rename to lib/mu_umaxtostr.h
    * lib/Makefile.am (libmuaux_la_SOURCES): Add mu_umaxtostr.[ch]
    
    * libmu_auth/radius.c, libmu_cfg/common.c, libmu_scm/mu_port.c,
    libproto/imap/folder.c, libproto/imap/mbox.c,
    libproto/mbox/mbox.c, libproto/mh/mbox.c, libproto/pop/mbox.c,
    mailbox/acl.c, mailbox/daemon.c, mailbox/mailer.c,
    mailbox/message.c, mailbox/mutil.c, mailbox/stream.c: Use mu_strerror.
    Avoid using mu_umaxtostr.

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

Summary of changes:
 bootstrap.conf                                     |    6 +-
 gnulib.modules                                     |    4 +-
 include/mailutils/Makefile.am                      |    3 +-
 .../include/monitor0.h => include/mailutils/io.h   |   25 +--
 include/mailutils/mailutils.h                      |    3 +-
 lib/Makefile.am                                    |    6 +-
 {mailbox => lib}/mu_umaxtostr.c                    |    0 
 {mailbox => lib}/mu_umaxtostr.h                    |    0 
 libmu_auth/radius.c                                |   26 +---
 libmu_cfg/common.c                                 |   20 +--
 libmu_scm/mu_port.c                                |   16 ++-
 libproto/imap/folder.c                             |   11 +-
 libproto/imap/mbox.c                               |  157 ++++++++++----------
 libproto/mbox/mbox.c                               |   18 +--
 libproto/mh/mbox.c                                 |   26 +++-
 libproto/pop/mbox.c                                |   26 ++--
 mailbox/Makefile.am                                |   18 +--
 mailbox/acl.c                                      |   36 +++--
 mailbox/{dbgstderr.c => asnprintf.c}               |   23 ++-
 mailbox/{dbgstderr.c => asprintf.c}                |   27 ++--
 mailbox/daemon.c                                   |   21 ++-
 mailbox/imaxtostr.c                                |    3 -
 mailbox/intprops.h                                 |   78 ----------
 mailbox/inttostr.c                                 |   52 -------
 mailbox/inttostr.h                                 |   29 ----
 mailbox/mailer.c                                   |   20 ++--
 mailbox/message.c                                  |    8 +-
 mailbox/mutil.c                                    |   17 +-
 mailbox/offtostr.c                                 |    3 -
 mailbox/stream.c                                   |   40 +----
 mailbox/umaxtostr.c                                |    3 -
 mailbox/vasnprintf.c                               |   87 +++++++++++
 32 files changed, 355 insertions(+), 457 deletions(-)
 copy libproto/include/monitor0.h => include/mailutils/io.h (74%)
 rename {mailbox => lib}/mu_umaxtostr.c (100%)
 rename {mailbox => lib}/mu_umaxtostr.h (100%)
 copy mailbox/{dbgstderr.c => asnprintf.c} (72%)
 copy mailbox/{dbgstderr.c => asprintf.c} (71%)
 delete mode 100644 mailbox/imaxtostr.c
 delete mode 100644 mailbox/intprops.h
 delete mode 100644 mailbox/inttostr.c
 delete mode 100644 mailbox/inttostr.h
 delete mode 100644 mailbox/offtostr.c
 delete mode 100644 mailbox/umaxtostr.c
 create mode 100644 mailbox/vasnprintf.c

diff --git a/bootstrap.conf b/bootstrap.conf
index 5590e51..3fa07af 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -1,6 +1,6 @@
 # Bootstrap configuration.
 
-# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -77,10 +77,6 @@ excluded_files='
     m4/visibility.m4
 '
 
-gnulib_extra_files="$gnulib_extra_files
-	m4/inttostr.m4
-"
-
 # Read local configuration file
 if [ -r .bootstrap ]; then
   echo "$0: Reading configuration file .bootstrap"
diff --git a/gnulib.modules b/gnulib.modules
index 972f3a5..1957954 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -2,9 +2,6 @@
 # A module name per line. Empty lines and comments are ignored.
 
 # FIXME: regex and glob are used by libmailutils...
-# FIXME: intprops and stdint are not used directly, they are needed for
-# inttostr, which is included in mailbox. Another inttostr dependency,
-# m4/inttostr.m4, is set in bootstrap.conf.
 
 alloca
 autobuild
@@ -16,6 +13,7 @@ getpass-gnu
 gettext
 gitlog-to-changelog
 intprops
+inttostr
 malloc
 mbswidth
 obstack
diff --git a/include/mailutils/Makefile.am b/include/mailutils/Makefile.am
index 78e5766..72ba80e 100644
--- a/include/mailutils/Makefile.am
+++ b/include/mailutils/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with GNU Automake to create Makefile.in
 
 ##   Copyright (C) 2000, 2001, 2002, 2003,
-##   2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+##   2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -53,6 +53,7 @@ pkginclude_HEADERS = \
  gsasl.h\
  guile.h\
  header.h\
+ io.h\
  iterator.h\
  kwd.h\
  ldap.h\
diff --git a/libproto/include/monitor0.h b/include/mailutils/io.h
similarity index 74%
copy from libproto/include/monitor0.h
copy to include/mailutils/io.h
index 079bf8a..b108743 100644
--- a/libproto/include/monitor0.h
+++ b/include/mailutils/io.h
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,26 +16,19 @@
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301 USA */
 
-#ifndef _MONITOR0_H
-#define _MONITOR0_H
-
-#ifdef DMALLOC
-#  include <dmalloc.h>
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <mailutils/monitor.h>
+#ifndef _MAILUTILS_IO_H
+#define _MAILUTILS_IO_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
-/* FIXME: any protos? */
+
+int mu_asprintf (char **pbuf, const char *fmt, ...);
+int mu_asnprintf (char **pbuf, size_t *psize, const char *fmt, ...);
+int mu_vasnprintf (char **pbuf, size_t *psize, const char *fmt, va_list ap);
+
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* _MONITOR0_H */
+#endif
diff --git a/include/mailutils/mailutils.h b/include/mailutils/mailutils.h
index 00d1240..b8b38dd 100644
--- a/include/mailutils/mailutils.h
+++ b/include/mailutils/mailutils.h
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2003,
-   2004, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -61,6 +61,7 @@
 #include <mailutils/gocs.h>
 #include <mailutils/version.h>
 #include <mailutils/vartab.h>
+#include <mailutils/io.h>
 
 #ifdef MU_COMPAT
 # error "Version 0.6 is no longer supported. Please, update your program."
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 037708d..0b6bbc7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with GNU Automake to create Makefile.in
 
 ##   Copyright (C) 1999, 2000, 2001, 2002, 2005,
-##   2007, 2008 Free Software Foundation, Inc.
+##   2007, 2008, 2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -29,7 +29,9 @@ libmuaux_la_SOURCES += \
  signal.c\
  strexit.c\
  tcpwrap.c\
- userprivs.c
+ userprivs.c\
+ mu_umaxtostr.c\
+ mu_umaxtostr.h
 
 noinst_HEADERS +=\
  mailcap.h\
diff --git a/mailbox/mu_umaxtostr.c b/lib/mu_umaxtostr.c
similarity index 100%
rename from mailbox/mu_umaxtostr.c
rename to lib/mu_umaxtostr.c
diff --git a/mailbox/mu_umaxtostr.h b/lib/mu_umaxtostr.h
similarity index 100%
rename from mailbox/mu_umaxtostr.h
rename to lib/mu_umaxtostr.h
diff --git a/libmu_auth/radius.c b/libmu_auth/radius.c
index b9e2f6c..a3f458a 100644
--- a/libmu_auth/radius.c
+++ b/libmu_auth/radius.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -183,26 +183,12 @@ mu_grad_logger(int level,
   char *pfx = NULL;
   if (loc)
     {
-      char buf[INT_STRLEN_BOUND(uintmax_t)];
-      char *p = umaxtostr (loc->line, buf);
-      size_t size = strlen (loc->file) + 1 + strlen (p) + 2 + strlen (fmt) + 1;
       if (func_name)
-	size += strlen (func_name) + 1;
-      pfx = malloc (size);
-      if (pfx)
-	{
-	  strcpy (pfx, loc->file);
-	  strcat (pfx, ":");
-	  strcat (pfx, p);
-	  strcat (pfx, ":");
-	  if (func_name)
-	    {
-	      strcat (pfx, func_name);
-	      strcat (pfx, ":");
-	    }
-	  strcat (pfx, " ");
-	  strcat (pfx, fmt);
-	}
+	mu_asprintf (&pfx, "%s:%lu:%s: %s",
+		     loc->file, (unsigned long) loc->line, func_name, fmt);
+      else
+	mu_asprintf (&pfx, "%s:%lu: %s",
+		     loc->file, (unsigned long) loc->line, fmt);
     }
   mu_diag_voutput (mlevel[level & GRAD_LOG_PRIMASK], pfx ? pfx : fmt, ap);
   if (pfx)
diff --git a/libmu_cfg/common.c b/libmu_cfg/common.c
index a5a3c6b..15a40f0 100644
--- a/libmu_cfg/common.c
+++ b/libmu_cfg/common.c
@@ -1,5 +1,5 @@
 /* This file is part of GNU Mailutils
-   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -24,7 +24,7 @@
 #include <mailutils/debug.h>
 #include <mailutils/syslog.h>
 #include <mailutils/mailbox.h>
-#include <mu_umaxtostr.h>
+#include <mailutils/io.h>
 
 static struct mu_gocs_locking locking_settings;
 static struct mu_gocs_logging logging_settings;
@@ -164,9 +164,6 @@ DCL_CFG_CAPA (logging);
 static int
 _cb2_debug_level (mu_debug_t debug, const char *arg, void *data MU_ARG_UNUSED)
 {
-  char buf[UINTMAX_STRSIZE_BOUND];
-  char *p;
-  size_t size;
   char *pfx;
   struct mu_debug_locus locus;
 
@@ -175,24 +172,21 @@ _cb2_debug_level (mu_debug_t debug, const char *arg, void *data MU_ARG_UNUSED)
   debug_settings.string = strdup (arg);
   if (mu_debug_get_locus (debug, &locus) == 0)
     {
-      p = umaxtostr (locus.line, buf);
-      size = strlen (locus.file) + 1 + strlen (p) + 1;
-      pfx = malloc (size);
-      if (!pfx)
+      int status = mu_asprintf (&pfx, "%s:%lu",
+				locus.file, (unsigned long) locus.line);
+      if (status)
 	{
 	  mu_cfg_format_error (debug, MU_DEBUG_ERROR,
-			       "%s", mu_strerror (errno));
+			       "%s", mu_strerror (status));
 	  return 1;
 	}
-      strcpy (pfx, locus.file);
-      strcat (pfx, ":");
-      strcat (pfx, p);
     }
   else
     pfx = strdup ("command line");/*FIXME*/
   /*FIXME: this is suboptimal, there's no use parsing 1st arg in
     mu_global_debug_from_string */
   mu_global_debug_from_string (debug_settings.string, pfx);
+  free (pfx);
   free (debug_settings.string);
   free (debug_settings.errpfx);
   memset (&debug_settings, 0, sizeof debug_settings);
diff --git a/libmu_scm/mu_port.c b/libmu_scm/mu_port.c
index 38071e1..c9ed35c 100644
--- a/libmu_scm/mu_port.c
+++ b/libmu_scm/mu_port.c
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2006, 2007, 
+   2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -17,7 +18,7 @@
    Boston, MA 02110-1301 USA */
 
 #include "mu_scm.h"
-#include <mu_umaxtostr.h>
+#include <mailutils/io.h>
 
 struct mu_port
 {
@@ -276,10 +277,13 @@ mu_port_print (SCM exp, SCM port, scm_print_state *pstate)
   scm_puts ("mu-port", port);
   if (mu_stream_size (mp->stream, &size) == 0)
     {
-      char buffer[64];
-      snprintf (buffer, sizeof (buffer), " %-5s", mu_umaxtostr (0, size));
-      scm_puts (buffer, port);
-      scm_puts (" chars", port);
+      char *buf;
+      if (mu_asprintf (&buf, " %5lu", (unsigned long) size) == 0)
+	{
+	  scm_puts (buf, port);
+	  scm_puts (" chars", port);
+	  free (buf);
+	}
     }
   scm_putc ('>', port);
   return 1;
diff --git a/libproto/imap/folder.c b/libproto/imap/folder.c
index 2a9e6bb..2fdda56 100644
--- a/libproto/imap/folder.c
+++ b/libproto/imap/folder.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2003, 2004, 
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -50,7 +50,6 @@
 #include <mailutils/argcv.h>
 #include <mailutils/tls.h>
 #include <mailutils/nls.h>
-#include <mu_umaxtostr.h>
 
 /* For dbg purposes set to one to see different level of traffic.  */
 /* Print to stderr the command sent to the IMAP server.  */
@@ -570,10 +569,10 @@ static int
 imap_writer (void *iodata, char *buf)
 {
   f_imap_t iop = iodata;
-  MU_DEBUG2 (iop->folder->debug, MU_DEBUG_PROT, "g%s %s\n",
-             mu_umaxtostr (0, iop->seq), buf);
-  int status = imap_writeline (iop, "g%s %s\r\n",
-                               mu_umaxtostr (0, iop->seq++), buf);
+  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);
   CHECK_ERROR (iop, status);
   status = imap_send (iop);
   CHECK_ERROR (iop, status);
diff --git a/libproto/imap/mbox.c b/libproto/imap/mbox.c
index 84e40dc..1ebf9ff 100644
--- a/libproto/imap/mbox.c
+++ b/libproto/imap/mbox.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2003, 2004, 
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,6 @@
 #include <assert.h>
 #include <time.h>
 
-#include <mu_umaxtostr.h>
 #include <mailutils/address.h>
 #include <mailutils/attribute.h>
 #include <mailutils/body.h>
@@ -46,6 +45,7 @@
 #include <mailutils/observer.h>
 #include <mailutils/property.h>
 #include <mailutils/stream.h>
+#include <mailutils/io.h>
 
 #include <imap0.h>
 #include <mailbox0.h>
@@ -393,8 +393,8 @@ mailbox_imap_close (mu_mailbox_t mailbox)
   switch (f_imap->state)
     {
     case IMAP_NO_STATE:
-      status = imap_writeline (f_imap, "g%s CLOSE\r\n",
-			       mu_umaxtostr (0, f_imap->seq++));
+      status = imap_writeline (f_imap, "g%lu CLOSE\r\n",
+			       (unsigned long) f_imap->seq++);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
       f_imap->state = IMAP_CLOSE;
@@ -682,8 +682,8 @@ imap_messages_count (mu_mailbox_t mailbox, size_t *pnum)
   switch (f_imap->state)
     {
     case IMAP_NO_STATE:
-      status = imap_writeline (f_imap, "g%s %s %s\r\n",
-			       mu_umaxtostr (0, f_imap->seq++), 
+      status = imap_writeline (f_imap, "g%lu %s %s\r\n",
+			       (unsigned long) f_imap->seq++, 
                                MBX_WRITABLE(mailbox) ? "SELECT" : "EXAMINE",
                                m_imap->name);
       CHECK_ERROR (f_imap, status);
@@ -751,8 +751,8 @@ imap_scan0 (mu_mailbox_t mailbox, size_t msgno, size_t *pcount, int notif)
     {
     case IMAP_NO_STATE:
       status = imap_writeline (f_imap,
-			       "g%s FETCH 1:* (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])\r\n",
-			       mu_umaxtostr (0, f_imap->seq++),
+			       "g%lu FETCH 1:* (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (%s)])\r\n",
+			       (unsigned long) f_imap->seq++,
 			       MU_IMAP_CACHE_HEADERS);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
@@ -827,8 +827,8 @@ imap_is_updated (mu_mailbox_t mailbox)
   switch (f_imap->state)
     {
     case IMAP_NO_STATE:
-      status = imap_writeline (f_imap, "g%s NOOP\r\n",
-			       mu_umaxtostr (0, f_imap->seq++));
+      status = imap_writeline (f_imap, "g%lu NOOP\r\n",
+			       (unsigned long) f_imap->seq++);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
       f_imap->state = IMAP_NOOP;
@@ -882,8 +882,8 @@ imap_expunge (mu_mailbox_t mailbox)
 	    return 0;
 	  }
 	status = imap_writeline (f_imap,
-				 "g%s STORE %s +FLAGS.SILENT (\\Deleted)\r\n",
-				 mu_umaxtostr (0, f_imap->seq++),
+				 "g%lu STORE %s +FLAGS.SILENT (\\Deleted)\r\n",
+				 (unsigned long) f_imap->seq++,
 				 set);
 	free (set);
 	CHECK_ERROR (f_imap, status);
@@ -905,8 +905,8 @@ imap_expunge (mu_mailbox_t mailbox)
 
     case IMAP_EXPUNGE:
     case IMAP_EXPUNGE_ACK:
-      status = imap_writeline (f_imap, "g%s EXPUNGE\r\n",
-			       mu_umaxtostr (0, f_imap->seq++));
+      status = imap_writeline (f_imap, "g%lu EXPUNGE\r\n",
+			       (unsigned long) f_imap->seq++);
       CHECK_ERROR (f_imap, status);
       status = imap_send (f_imap);
       CHECK_EAGAIN (f_imap, status);
@@ -1029,11 +1029,11 @@ imap_append_message0 (mu_mailbox_t mailbox, mu_message_t msg)
 	mu_message_size (msg, &size);
 	mu_message_lines (msg, &lines);
 	total = size + lines;
-	status = imap_writeline (f_imap, "g%s APPEND %s %s {%s}\r\n",
-				 mu_umaxtostr (0, f_imap->seq++),
+	status = imap_writeline (f_imap, "g%lu APPEND %s %s {%lu}\r\n",
+				 (unsigned long) f_imap->seq++,
 				 path,
 				 abuf,
-				 mu_umaxtostr (1, size + lines));
+				 (unsigned long) (size + lines));
 	free (abuf);
 	CHECK_ERROR (f_imap, status);
 	MU_DEBUG (mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
@@ -1124,9 +1124,9 @@ imap_copy_message (mu_mailbox_t mailbox, mu_message_t msg)
 	/* Check for a valid mailbox name.  */
 	status = mu_url_sget_path (mailbox->url, &path);
 	if (status == 0)
-  	  status = imap_writeline (f_imap, "g%s COPY %s %s\r\n",
-	 			   mu_umaxtostr (0, f_imap->seq++),
-				   mu_umaxtostr (1, msg_imap->num),
+  	  status = imap_writeline (f_imap, "g%lu COPY %lu %s\r\n",
+	 			   (unsigned long) f_imap->seq++,
+				   (unsigned long) msg_imap->num,
 				   path);
 	CHECK_ERROR (f_imap, status);
 	MU_DEBUG (mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
@@ -1195,13 +1195,13 @@ imap_message_read (mu_stream_t stream, char *buffer, size_t buflen,
       /* We have strip the \r, but the offset on the imap server is with that
 	 octet(CFLF) so add it in the offset, it's the number of lines.  */
       status = imap_writeline (f_imap,
-			       "g%s FETCH %s BODY.PEEK[%s]<%s.%s>\r\n",
-			       mu_umaxtostr (0, f_imap->seq++),
-			       mu_umaxtostr (1, msg_imap->num),
+			       "g%lu FETCH %lu BODY.PEEK[%s]<%lu.%lu>\r\n",
+			       (unsigned long) f_imap->seq++,
+			       (unsigned long) msg_imap->num,
 			       (section) ? section : "",
-			       mu_umaxtostr (2, offset +
-					     msg_imap->mu_message_lines),
-			       mu_umaxtostr (3, buflen));
+			       (unsigned long) (offset +
+						msg_imap->mu_message_lines),
+			       (unsigned long) buflen);
       if (section)
 	free (section);
       CHECK_ERROR (f_imap, status);
@@ -1283,9 +1283,9 @@ imap_message_size (mu_message_t msg, size_t *psize)
 	     that octet so add it in the offset, since it's the number of
 	     lines.  */
 	  status = imap_writeline (f_imap,
-				   "g%s FETCH %s RFC822.SIZE\r\n",
-				   mu_umaxtostr (0, f_imap->seq++),
-				   mu_umaxtostr (1, msg_imap->num));
+				   "g%lu FETCH %lu RFC822.SIZE\r\n",
+				   (unsigned long) f_imap->seq++,
+				   (unsigned long) msg_imap->num);
 	  CHECK_ERROR (f_imap, status);
 	  MU_DEBUG (m_imap->mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
 	  f_imap->state = IMAP_FETCH;
@@ -1324,9 +1324,9 @@ imap_message_uid (mu_message_t msg, size_t *puid)
 	  *puid = msg_imap->uid;
 	  return 0;
 	}
-      status = imap_writeline (f_imap, "g%s FETCH %s UID\r\n",
-			       mu_umaxtostr (0, f_imap->seq++),
-			       mu_umaxtostr (1, msg_imap->num));
+      status = imap_writeline (f_imap, "g%lu FETCH %lu UID\r\n",
+			       (unsigned long) f_imap->seq++,
+			       (unsigned long) msg_imap->num);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (m_imap->mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
       f_imap->state = IMAP_FETCH;
@@ -1369,9 +1369,9 @@ imap_is_multipart (mu_message_t msg, int *ismulti)
 	  return 0;
 	}
       status = imap_writeline (f_imap,
-			       "g%s FETCH %s BODYSTRUCTURE\r\n",
-			       mu_umaxtostr (0, f_imap->seq++),
-			       mu_umaxtostr (1, msg_imap->num));
+			       "g%lu FETCH %lu BODYSTRUCTURE\r\n",
+			       (unsigned long) f_imap->seq++,
+			       (unsigned long) msg_imap->num);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (m_imap->mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
       f_imap->state = IMAP_FETCH;
@@ -1509,9 +1509,9 @@ imap_envelope_date (mu_envelope_t envelope, char *buffer, size_t buflen,
       if (f_imap->state == IMAP_NO_STATE)
 	{
 	  status = imap_writeline (f_imap,
-				   "g%s FETCH %s INTERNALDATE\r\n",
-				   mu_umaxtostr (0, f_imap->seq++),
-				   mu_umaxtostr (1, msg_imap->num));
+				   "g%lu FETCH %lu INTERNALDATE\r\n",
+				   (unsigned long) f_imap->seq++,
+				   (unsigned long) msg_imap->num);
 	  CHECK_ERROR (f_imap, status);
 	  MU_DEBUG (m_imap->mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
 	  f_imap->state = IMAP_FETCH;
@@ -1580,9 +1580,9 @@ imap_attr_get_flags (mu_attribute_t attribute, int *pflags)
 
   if (f_imap->state == IMAP_NO_STATE)
     {
-      status = imap_writeline (f_imap, "g%s FETCH %s FLAGS\r\n",
-			       mu_umaxtostr (0, f_imap->seq++),
-			       mu_umaxtostr (1, msg_imap->num));
+      status = imap_writeline (f_imap, "g%lu FETCH %lu FLAGS\r\n",
+			       (unsigned long) f_imap->seq++,
+			       (unsigned long) msg_imap->num);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (m_imap->mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
       f_imap->state = IMAP_FETCH;
@@ -1636,9 +1636,9 @@ imap_attr_set_flags (mu_attribute_t attribute, int flag)
 	  free (abuf);
 	  return 0;
 	}
-      status = imap_writeline (f_imap, "g%s STORE %s +FLAGS.SILENT (%s)\r\n",
-			       mu_umaxtostr (0, f_imap->seq++),
-			       mu_umaxtostr (1, msg_imap->num),
+      status = imap_writeline (f_imap, "g%lu STORE %lu +FLAGS.SILENT (%s)\r\n",
+			       (unsigned long) f_imap->seq++,
+			       (unsigned long) msg_imap->num,
 			       abuf);
       free (abuf);
       CHECK_ERROR (f_imap, status);
@@ -1685,9 +1685,9 @@ imap_attr_unset_flags (mu_attribute_t attribute, int flag)
 	  free (abuf);
 	  return 0;
 	}
-      status = imap_writeline (f_imap, "g%s STORE %s -FLAGS.SILENT (%s)\r\n",
-			       mu_umaxtostr (0, f_imap->seq++),
-			       mu_umaxtostr (1, msg_imap->num),
+      status = imap_writeline (f_imap, "g%lu STORE %lu -FLAGS.SILENT (%s)\r\n",
+			       (unsigned long) f_imap->seq++,
+			       (unsigned long) msg_imap->num,
 			       abuf);
       free (abuf);
       CHECK_ERROR (f_imap, status);
@@ -1742,24 +1742,24 @@ imap_header_read (mu_header_t header, char *buffer,
         {
           char *section = section_name (msg_imap);
           status = imap_writeline (f_imap,
-                                   "g%s FETCH %s BODY.PEEK[%s.MIME]<%s.%s>\r\n",
-                                   mu_umaxtostr (0, f_imap->seq++),
-				   mu_umaxtostr (1, msg_imap->num),
+                                   "g%lu FETCH %lu BODY.PEEK[%s.MIME]<%lu.%lu>\r\n",
+                                   (unsigned long) f_imap->seq++,
+				   (unsigned long) msg_imap->num,
                                    (section) ? section : "",
-                                   mu_umaxtostr (2, offset +
-						 msg_imap->header_lines),
-				   mu_umaxtostr (3, buflen));
+                                   (unsigned long) (offset +
+						    msg_imap->header_lines),
+				   (unsigned long) buflen);
           if (section)
             free (section);
         }
       else
         status = imap_writeline (f_imap,
-                                 "g%s FETCH %s BODY.PEEK[HEADER]<%s.%s>\r\n",
-                                 mu_umaxtostr (0, f_imap->seq++),
-				 mu_umaxtostr (1, msg_imap->num),
-                                 mu_umaxtostr (2, offset +
-					       msg_imap->header_lines),
-				 mu_umaxtostr (3, buflen));
+                                 "g%lu FETCH %lu BODY.PEEK[HEADER]<%lu.%lu>\r\n",
+                                 (unsigned long) f_imap->seq++,
+				 (unsigned long) msg_imap->num,
+                                 (unsigned long) (offset +
+						  msg_imap->header_lines),
+				 (unsigned long) buflen);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (m_imap->mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
       f_imap->state = IMAP_FETCH;
@@ -1857,24 +1857,24 @@ imap_body_read (mu_stream_t stream, char *buffer, size_t buflen,
         {
           char *section = section_name (msg_imap);
           status = imap_writeline (f_imap,
-                                   "g%s FETCH %s BODY.PEEK[%s]<%s.%s>\r\n",
-                                   mu_umaxtostr (0, f_imap->seq++),
-				   mu_umaxtostr (1, msg_imap->num),
+                                   "g%lu FETCH %lu BODY.PEEK[%s]<%lu.%lu>\r\n",
+                                   (unsigned long) f_imap->seq++,
+				   (unsigned long) msg_imap->num,
                                    (section) ? section: "",
-                                   mu_umaxtostr (2, offset +
-						 msg_imap->body_lines),
-				   mu_umaxtostr (3, buflen));
+                                   (unsigned long) (offset +
+						    msg_imap->body_lines),
+				   (unsigned long) buflen);
           if (section)
             free (section);
         }
       else
         status = imap_writeline (f_imap,
-                                 "g%s FETCH %s BODY.PEEK[TEXT]<%s.%s>\r\n",
-                                 mu_umaxtostr (0, f_imap->seq++),
-				 mu_umaxtostr (1, msg_imap->num),
-                                 mu_umaxtostr (2, offset +
-					       msg_imap->body_lines),
-				 mu_umaxtostr (3, buflen));
+                                 "g%lu FETCH %lu BODY.PEEK[TEXT]<%lu.%lu>\r\n",
+                                 (unsigned long) f_imap->seq++,
+				 (unsigned long) msg_imap->num,
+                                 (unsigned long) (offset +
+						  msg_imap->body_lines),
+				 (unsigned long) buflen);
       CHECK_ERROR (f_imap, status);
       MU_DEBUG (m_imap->mailbox->debug, MU_DEBUG_PROT, f_imap->buffer);
       f_imap->state = IMAP_FETCH;
@@ -2047,7 +2047,7 @@ flags_to_string (char **pbuf, int flag)
 static int
 add_number (char **pset, size_t start, size_t end)
 {
-  char buf[2*UINTMAX_STRSIZE_BOUND+2];
+  char *buf = NULL;
   char *set;
   char *tmp;
   size_t set_len = 0;
@@ -2062,13 +2062,12 @@ add_number (char **pset, size_t start, size_t end)
 
   /* We had a previous seqence.  */
   if (start == 0)
-    *buf = '\0';
+    /* nothing */;
   else if (start != end)
-    snprintf (buf, sizeof buf, "%s:%s",
-	      mu_umaxtostr (0, start),
-	      mu_umaxtostr (1, end));
+    mu_asprintf (&buf, "%lu:%lu",
+		  (unsigned long) start, (unsigned long) end);
   else
-    snprintf (buf, sizeof buf, "%s", mu_umaxtostr (0, start));
+    mu_asprintf (&buf, "%lu", (unsigned long) start);
 
   if (set_len)
     tmp = realloc (set, set_len + strlen (buf) + 2 /* null and comma */);
@@ -2078,6 +2077,7 @@ add_number (char **pset, size_t start, size_t end)
   if (tmp == NULL)
     {
       free (set);
+      free (buf);
       return ENOMEM;
     }
   set = tmp;
@@ -2086,7 +2086,8 @@ add_number (char **pset, size_t start, size_t end)
   if (set_len)
     strcat (set, ",");
   strcat (set, buf);
-
+  free (buf);
+  
   *pset = set;
   return 0;
 }
diff --git a/libproto/mbox/mbox.c b/libproto/mbox/mbox.c
index 83d9a24..f3e8a25 100644
--- a/libproto/mbox/mbox.c
+++ b/libproto/mbox/mbox.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2003, 
-   2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -24,7 +24,7 @@
 #endif
 
 #include <mbox0.h>
-#include <mu_umaxtostr.h>
+#include <mailutils/io.h>
 
 #define ATTRIBUTE_IS_DELETED(flag)        (flag & MU_ATTRIBUTE_DELETED)
 #define ATTRIBUTE_IS_EQUAL(flag1, flag2)  (flag1 == flag2)
@@ -805,12 +805,7 @@ static int
 mbox_message_qid (mu_message_t msg, mu_message_qid_t *pqid)
 {
   mbox_message_t mum = mu_message_get_owner (msg);
-  char buf[UINTMAX_STRSIZE_BOUND];
-  const char *p = umaxtostr (mum->header_from, buf);
-  *pqid = strdup (p);
-  if (*pqid == NULL)
-    return ENOMEM;
-  return 0;
+  return mu_asprintf (pqid, "%lu", (unsigned long) mum->header_from);
 }
 
 static int
@@ -1303,9 +1298,10 @@ mbox_append_message (mu_mailbox_t mailbox, mu_message_t msg)
 
   if (mailbox->observable)
     {
-      char buf[UINTMAX_STRSIZE_BOUND];
-      mu_observable_notify (mailbox->observable, MU_EVT_MESSAGE_APPEND,
-			    umaxtostr (size, buf)); 
+      char *buf = NULL;
+      mu_asprintf (&buf, "%lu", (unsigned long) size);
+      mu_observable_notify (mailbox->observable, MU_EVT_MESSAGE_APPEND, buf);
+      free (buf);
     }
   
   return 0;
diff --git a/libproto/mh/mbox.c b/libproto/mh/mbox.c
index 97a8555..52e1129 100644
--- a/libproto/mh/mbox.c
+++ b/libproto/mh/mbox.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -63,10 +63,10 @@
 #include <mailutils/stream.h>
 #include <mailutils/url.h>
 #include <mailutils/observer.h>
+#include <mailutils/io.h>
 #include <mailbox0.h>
 #include <registrar0.h>
 #include <amd.h>
-#include <mu_umaxtostr.h>
 
 struct _mh_message
 {
@@ -102,9 +102,13 @@ _mh_cur_message_name (struct _amd_message *amsg, char **pname)
   int status = 0;
   struct _mh_message *mhm = (struct _mh_message *) amsg;
   char *filename;
-  char buf[UINTMAX_STRSIZE_BOUND];
-  char *pnum = umaxtostr (mhm->seq_number, buf);
-  size_t len = strlen (amsg->amd->name) + 1 + strlen (pnum) + 1;
+  char *pnum;
+  size_t len;
+
+  status = mu_asprintf (&pnum, "%lu", (unsigned long) mhm->seq_number);
+  if (status)
+    return status;
+  len = strlen (amsg->amd->name) + 1 + strlen (pnum) + 1;
   filename = malloc (len);
   if (filename)
     {
@@ -115,6 +119,7 @@ _mh_cur_message_name (struct _amd_message *amsg, char **pname)
     }
   else
     status = ENOMEM;
+  free (pnum);
   return status;
 }
 
@@ -126,9 +131,13 @@ _mh_new_message_name (struct _amd_message *amsg, int flags, char **pname)
   int status = 0;
   struct _mh_message *mhm = (struct _mh_message *) amsg;
   char *filename;
-  char buf[UINTMAX_STRSIZE_BOUND];
-  char *pnum = umaxtostr (mhm->seq_number, buf);
-  size_t len = strlen (amsg->amd->name) + 1 +
+  char *pnum;
+  size_t len;
+
+  status = mu_asprintf (&pnum, "%lu", (unsigned long) mhm->seq_number);
+  if (status)
+    return status;
+  len = strlen (amsg->amd->name) + 1 +
                ((flags & MU_ATTRIBUTE_DELETED) ? 1 : 0) + strlen (pnum) + 1;
   filename = malloc (len);
   if (filename)
@@ -142,6 +151,7 @@ _mh_new_message_name (struct _amd_message *amsg, int flags, char **pname)
     }
   else
     status = ENOMEM;
+  free (pnum);
   return status;
 }
 
diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index 9358835..1e5182e 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -1,5 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999,2000,2001,2003,2005,2007 Free Software Foundation, Inc.
+   Copyright (C) 1999,2000,2001,2003,2005,2007, 
+   2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -38,7 +39,6 @@
 # include <strings.h>
 #endif
 
-#include <mu_umaxtostr.h>
 #include <mailutils/attribute.h>
 #include <mailutils/auth.h>
 #include <mailutils/body.h>
@@ -53,6 +53,7 @@
 #include <mailutils/url.h>
 #include <mailutils/tls.h>
 #include <mailutils/md5.h>
+#include <mailutils/io.h>
 
 #include <folder0.h>
 #include <mailbox0.h>
@@ -147,7 +148,8 @@ static int fill_buffer         (pop_data_t, char *, size_t);
 static int pop_sleep           (int);
 static int pop_readline        (pop_data_t);
 static int pop_read_ack        (pop_data_t);
-static int pop_writeline       (pop_data_t, const char *, ...);
+static int pop_writeline       (pop_data_t, const char *, ...)
+                                 MU_PRINTFLIKE(2,3);
 static int pop_write           (pop_data_t);
 static int pop_get_user        (mu_authority_t);
 static int pop_get_passwd      (mu_authority_t);
@@ -1295,9 +1297,9 @@ pop_expunge (mu_mailbox_t mbox)
 	      switch (mpd->state)
 		{
 		case POP_NO_STATE:
-		  status = pop_writeline (mpd, "DELE %s\r\n",
-					  mu_umaxtostr (0,
-							mpd->pmessages[i]->num));
+		  status = pop_writeline (mpd, "DELE %lu\r\n",
+					  (unsigned long)
+					    mpd->pmessages[i]->num);
 		  CHECK_ERROR (mpd, status);
 		  MU_DEBUG (mbox->debug, MU_DEBUG_PROT, mpd->buffer);
 		  mpd->state = POP_DELE;
@@ -1391,7 +1393,7 @@ pop_message_size (mu_message_t msg, size_t *psize)
   switch (mpd->state)
     {
     case POP_NO_STATE:
-      status = pop_writeline (mpd, "LIST %s\r\n", mu_umaxtostr (0, mpm->num));
+      status = pop_writeline (mpd, "LIST %lu\r\n", (unsigned long) mpm->num);
       CHECK_ERROR (mpd, status);
       MU_DEBUG (mpd->mbox->debug, MU_DEBUG_PROT, mpd->buffer);
       mpd->state = POP_LIST;
@@ -1610,7 +1612,7 @@ pop_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pnwriten)
   switch (mpd->state)
     {
     case POP_NO_STATE:
-      status = pop_writeline (mpd, "UIDL %s\r\n", mu_umaxtostr (0, mpm->num));
+      status = pop_writeline (mpd, "UIDL %lu\r\n", (unsigned long) mpm->num);
       CHECK_ERROR (mpd, status);
       MU_DEBUG (mpd->mbox->debug, MU_DEBUG_PROT, mpd->buffer);
       mpd->state = POP_UIDL;
@@ -1705,8 +1707,8 @@ pop_top (mu_header_t header, char *buffer, size_t buflen,
     case POP_NO_STATE:
       if (mpd->capa & CAPA_TOP)
         {
-	  status = pop_writeline (mpd, "TOP %s 0\r\n",
-				  mu_umaxtostr (0, mpm->num));
+	  status = pop_writeline (mpd, "TOP %lu 0\r\n",
+				  (unsigned long) mpm->num);
 	  CHECK_ERROR (mpd, status);
 	  MU_DEBUG (mpd->mbox->debug, MU_DEBUG_PROT, mpd->buffer);
 	  mpd->state = POP_TOP;
@@ -1931,8 +1933,8 @@ pop_retr (pop_message_t mpm, char *buffer, size_t buflen,
     {
     case POP_NO_STATE:
       mpm->body_lines = mpm->body_size = 0;
-      status = pop_writeline (mpd, "RETR %s\r\n",
-			      mu_umaxtostr (0, mpm->num));
+      status = pop_writeline (mpd, "RETR %lu\r\n",
+			      (unsigned long) mpm->num);
       MU_DEBUG (mpd->mbox->debug, MU_DEBUG_PROT, mpd->buffer);
       CHECK_ERROR (mpd, status);
       mpd->state = POP_RETR;
diff --git a/mailbox/Makefile.am b/mailbox/Makefile.am
index 4e45f38..5d3a8e0 100644
--- a/mailbox/Makefile.am
+++ b/mailbox/Makefile.am
@@ -1,7 +1,7 @@
 ## Process this file with GNU Automake to create Makefile.in
 
-##   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008 
-##   Free Software Foundation, Inc.
+##   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 
+##   2009 Free Software Foundation, Inc.
 ##
 ##   GNU Mailutils is free software; you can redistribute it and/or
 ##   modify it under the terms of the GNU General Public License as
@@ -41,9 +41,7 @@ EXTRA_DIST = \
  fgetpwent.c\
  cfg_lexer.l\
  cfg_parser.y\
- cfg_parser.h\
- inttostr.c\
- inttostr.h 
+ cfg_parser.h
 
 libmailutils_la_SOURCES = \
  acl.c\
@@ -51,6 +49,8 @@ libmailutils_la_SOURCES = \
  alloc.c\
  amd.c\
  argcv.c\
+ asnprintf.c\
+ asprintf.c\
  assoc.c\
  attachment.c\
  attribute.c\
@@ -97,8 +97,6 @@ libmailutils_la_SOURCES = \
  monitor.c\
  msrv.c\
  mu_auth.c\
- mu_umaxtostr.h\
- mu_umaxtostr.c\
  munre.c\
  mutil.c\
  muerror.c\
@@ -124,10 +122,10 @@ libmailutils_la_SOURCES = \
  tcp.c\
  url.c\
  vartab.c\
+ vasnprintf.c\
  version.c\
- wicket.c\
- imaxtostr.c  offtostr.c  umaxtostr.c intprops.h
-
+ wicket.c
+ 
 BUILT_SOURCES = parsedate.c muerrno.c cfg_parser.c cfg_parser.h cfg_lexer.c
 MOSTLYCLEANFILES=
 
diff --git a/mailbox/acl.c b/mailbox/acl.c
index 34f1f50..42d89a9 100644
--- a/mailbox/acl.c
+++ b/mailbox/acl.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -36,7 +36,7 @@
 #include <mailutils/errno.h>
 #include <mailutils/kwd.h>
 #include <mailutils/vartab.h>
-#include <mu_umaxtostr.h>
+#include <mailutils/io.h>
 
 struct _mu_acl_entry
 {
@@ -368,7 +368,7 @@ mu_sockaddr_to_str (const struct sockaddr *sa, int salen,
 		    char *bufptr, size_t buflen,
 		    size_t *plen)
 {
-  char buf[UINTMAX_STRSIZE_BOUND]; /* FIXME: too much */
+  char *nbuf;
   size_t len = 0;
   switch (sa->sa_family)
     {
@@ -377,8 +377,11 @@ mu_sockaddr_to_str (const struct sockaddr *sa, int salen,
 	struct sockaddr_in s_in = *(struct sockaddr_in *)sa;
 	len += mu_stpcpy (&bufptr, &buflen, inet_ntoa (s_in.sin_addr));
 	len += mu_stpcpy (&bufptr, &buflen, ":");
-	len += mu_stpcpy (&bufptr, &buflen, umaxtostr (ntohs (s_in.sin_port),
-						       buf));
+	if (mu_asprintf (&nbuf, "%hu", ntohs (s_in.sin_port)) == 0)
+	  {
+	    len += mu_stpcpy (&bufptr, &buflen, nbuf);
+	    free (nbuf);
+	  }
 	break;
       }
 
@@ -396,8 +399,12 @@ mu_sockaddr_to_str (const struct sockaddr *sa, int salen,
       }
 
     default:
-      len += mu_stpcpy (&bufptr, &buflen, "{Unsupported family: ");
-      len += mu_stpcpy (&bufptr, &buflen, umaxtostr (sa->sa_family, buf));
+      len += mu_stpcpy (&bufptr, &buflen, "{Unsupported family");
+      if (mu_asprintf (&nbuf, ": %d", sa->sa_family) == 0)
+	{
+	  len += mu_stpcpy (&bufptr, &buflen, nbuf);
+	  free (nbuf);
+	}
       len += mu_stpcpy (&bufptr, &buflen, "}");
     }
   if (plen)
@@ -500,10 +507,8 @@ static int
 _expand_aclno (const char *name, void *data, char **p)
 {
   struct run_closure *rp = data;
-  char buf[UINTMAX_STRSIZE_BOUND];
   /*FIXME: memory leak*/
-  *p = strdup (umaxtostr (rp->idx, buf));
-  return 0;
+  return mu_asprintf (p, "%u", rp->idx);
 }
 
 #if defined (HAVE_SYSCONF) && defined (_SC_OPEN_MAX)
@@ -530,14 +535,13 @@ expand_arg (const char *cmdline, struct run_closure *rp, char **s)
       {
 	struct sockaddr_in *s_in = (struct sockaddr_in *)rp->sa;
 	struct in_addr addr = s_in->sin_addr;
-	char buf[UINTMAX_STRSIZE_BOUND];
-	unsigned n;
-
+	char *p;
+	
 	mu_vartab_define (vtab, "family", "AF_INET", 1);
 	addr.s_addr = htonl (addr.s_addr);
 	mu_vartab_define (vtab, "address", inet_ntoa (addr), 0);
-	n = ntohs (s_in->sin_port);
-	mu_vartab_define (vtab, "port", umaxtostr (n, buf), 0);
+	if (mu_asprintf (&p, "%hu", ntohs (s_in->sin_port)) == 0)
+	  mu_vartab_define (vtab, "port", p, 0);
       }
       break;
       
@@ -768,7 +772,7 @@ mu_acl_check_fd (mu_acl_t acl, int fd, mu_acl_result_t *pres)
     {
       MU_DEBUG1 (acl->debug, MU_DEBUG_ERROR, 
 		 "Cannot obtain IP address of client: %s",
-		 strerror (errno));
+		 mu_strerror (errno));
       return MU_ERR_FAILURE;
     }
 
diff --git a/mailbox/dbgstderr.c b/mailbox/asnprintf.c
similarity index 72%
copy from mailbox/dbgstderr.c
copy to mailbox/asnprintf.c
index 2e02a98..e3413af 100644
--- a/mailbox/dbgstderr.c
+++ b/mailbox/asnprintf.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007  Free Software Foundation, Inc.
+   Copyright (C) 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,20 +16,25 @@
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301 USA */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include <mailutils/debug.h>
+#include <stdlib.h>
+#include <stdarg.h>
 #include <stdio.h>
 
+#include <mailutils/io.h>
+
 int
-mu_debug_stderr_printer (void *unused, mu_log_level_t level, const char *str)
+mu_asnprintf (char **pbuf, size_t *psize, const char *fmt, ...)
 {
-  fprintf (stderr, "%s: %s",
-	   (level == MU_DEBUG_ERROR) ? "ERROR" : "DEBUG",
-	   str);
-  return 0;
-}
+  int rc;
+  va_list ap;
 
+  va_start (ap, fmt);
+  rc = mu_vasnprintf (pbuf, psize, fmt, ap);
+  va_end (ap);
+  return rc;
+}
 
diff --git a/mailbox/dbgstderr.c b/mailbox/asprintf.c
similarity index 71%
copy from mailbox/dbgstderr.c
copy to mailbox/asprintf.c
index 2e02a98..2bcd61d 100644
--- a/mailbox/dbgstderr.c
+++ b/mailbox/asprintf.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007  Free Software Foundation, Inc.
+   Copyright (C) 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -16,20 +16,27 @@
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301 USA */
 
-#ifdef HAVE_CONFIG_H
+#if HAVE_CONFIG_H
 # include <config.h>
 #endif
 
-#include <mailutils/debug.h>
+#include <stdlib.h>
+#include <stdarg.h>
 #include <stdio.h>
 
+#include <mailutils/io.h>
+
 int
-mu_debug_stderr_printer (void *unused, mu_log_level_t level, const char *str)
+mu_asprintf (char **pbuf, const char *fmt, ...)
 {
-  fprintf (stderr, "%s: %s",
-	   (level == MU_DEBUG_ERROR) ? "ERROR" : "DEBUG",
-	   str);
-  return 0;
+  va_list ap;
+  size_t size;
+  int rc;
+  
+  va_start (ap, fmt);
+  *pbuf = NULL;
+  size = 0;
+  rc = mu_vasnprintf (pbuf, &size, fmt, ap);
+  va_end (ap);
+  return rc;
 }
-
-
diff --git a/mailbox/daemon.c b/mailbox/daemon.c
index 795d854..8f83254 100644
--- a/mailbox/daemon.c
+++ b/mailbox/daemon.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,6 @@
 #include <mailutils/errno.h>
 #include <mailutils/error.h>
 #include <mailutils/nls.h>
-#include <mu_umaxtostr.h>
 
 static char *pidfile;
 static pid_t current_pid;
@@ -80,7 +79,6 @@ int
 mu_daemon_create_pidfile (const char *filename)
 {
   char *p;
-  const char *pid_string; 
   int fd;
   uid_t uid = 0;
   int rc;
@@ -122,10 +120,19 @@ mu_daemon_create_pidfile (const char *filename)
   
   if ((fd = open (pidfile, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644)) != -1)
     {
-      pid_string = mu_umaxtostr (0, current_pid);
-      write (fd, pid_string, strlen (pid_string));
-      close (fd);
-      atexit (mu_daemon_remove_pidfile);
+      FILE *fp = fdopen (fd, "w");
+      if (!fp)
+	{
+	  rc = errno;
+	  free (pidfile);
+	  close (fd);
+	}
+      else
+	{
+	  fprintf (fp, "%lu", (unsigned long) current_pid);
+	  fclose (fp);
+	  atexit (mu_daemon_remove_pidfile);
+	}
     }
   else
     {
diff --git a/mailbox/imaxtostr.c b/mailbox/imaxtostr.c
deleted file mode 100644
index 5e87ad5..0000000
--- a/mailbox/imaxtostr.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define inttostr imaxtostr
-#define inttype intmax_t
-#include "inttostr.c"
diff --git a/mailbox/intprops.h b/mailbox/intprops.h
deleted file mode 100644
index 34f971c..0000000
--- a/mailbox/intprops.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* intprops.h -- properties of integer types
-
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert.  */
-
-#include <limits.h>
-
-/* The extra casts in the following macros work around compiler bugs,
-   e.g., in Cray C 5.0.3.0.  */
-
-/* True if the arithmetic type T is an integer type.  bool counts as
-   an integer.  */
-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
-
-/* True if negative values of the signed integer type T use two's
-   complement, ones' complement, or signed magnitude representation,
-   respectively.  Much GNU code assumes two's complement, but some
-   people like to be portable to all possible C hosts.  */
-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
-
-/* True if the arithmetic type T is signed.  */
-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-
-/* The maximum and minimum values for the integer type T.  These
-   macros have undefined behavior if T is signed and has padding bits.
-   If this is a problem for you, please let us know how to fix it for
-   your host.  */
-#define TYPE_MINIMUM(t) \
-  ((t) (! TYPE_SIGNED (t) \
-	? (t) 0 \
-	: TYPE_SIGNED_MAGNITUDE (t) \
-	? ~ (t) 0 \
-	: ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
-#define TYPE_MAXIMUM(t) \
-  ((t) (! TYPE_SIGNED (t) \
-	? (t) -1 \
-	: ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
-
-/* Return zero if T can be determined to be an unsigned type.
-   Otherwise, return 1.
-   When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a
-   tighter bound.  Otherwise, it overestimates the true bound by one byte
-   when applied to unsigned types of size 2, 4, 16, ... bytes.
-   The symbol signed_type_or_expr__ is private to this header file.  */
-#if __GNUC__ >= 2
-# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t))
-#else
-# define signed_type_or_expr__(t) 1
-#endif
-
-/* Bound on length of the string representing an integer type or expression T.
-   Subtract 1 for the sign bit if T is signed; log10 (2.0) < 146/485;
-   add 1 for integer division truncation; add 1 more for a minus sign
-   if needed.  */
-#define INT_STRLEN_BOUND(t) \
-  ((sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) * 146 / 485 \
-   + signed_type_or_expr__ (t) + 1)
-
-/* Bound on buffer size needed to represent an integer type or expression T,
-   including the terminating null.  */
-#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
diff --git a/mailbox/inttostr.c b/mailbox/inttostr.c
deleted file mode 100644
index 2adcd2c..0000000
--- a/mailbox/inttostr.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* inttostr.c -- convert integers to printable strings
-
-   Copyright (C) 2001 Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include "inttostr.h"
-
-/* Convert I to a printable string in BUF, which must be at least
-   INT_BUFSIZE_BOUND (INTTYPE) bytes long.  Return the address of the
-   printable string, which need not start at BUF.  */
-
-char *
-inttostr (inttype i, char *buf)
-{
-  char *p = buf + INT_STRLEN_BOUND (inttype);
-  *p = 0;
-
-  if (i < 0)
-    {
-      do
-	*--p = '0' - i % 10;
-      while ((i /= 10) != 0);
-
-      *--p = '-';
-    }
-  else
-    {
-      do
-	*--p = '0' + i % 10;
-      while ((i /= 10) != 0);
-    }
-
-  return p;
-}
diff --git a/mailbox/inttostr.h b/mailbox/inttostr.h
deleted file mode 100644
index 3988a6d..0000000
--- a/mailbox/inttostr.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* inttostr.h -- convert integers to printable strings
-
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
-   Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-
-/* Written by Paul Eggert */
-
-#include <stdint.h>
-#include <sys/types.h>
-
-#include "intprops.h"
-
-char *offtostr (off_t, char *);
-char *imaxtostr (intmax_t, char *);
-char *umaxtostr (uintmax_t, char *);
diff --git a/mailbox/mailer.c b/mailbox/mailer.c
index 8f2e486..33cd37c 100644
--- a/mailbox/mailer.c
+++ b/mailbox/mailer.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2004, 2005, 2006,
-   2007 Free Software Foundation, Inc.
+   2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@
 #include <mailutils/argcv.h>
 #include <mailutils/mutil.h>
 #include <mailutils/mime.h>
-#include <mu_umaxtostr.h>
+#include <mailutils/io.h>
 
 #include <mailer0.h>
 
@@ -404,19 +404,19 @@ create_part (mu_mime_t mime, mu_stream_t istr,
   mu_body_t body;
   mu_stream_t ostr;
   char buffer[512], *str;
-  const char *nstr, *npartstr;
+  size_t slen;
   
   mu_message_create (&newmsg, NULL);
   mu_message_get_header (newmsg, &newhdr); 
 
-  nstr = mu_umaxtostr (0, n);
-  npartstr = mu_umaxtostr (1, nparts);
-  asprintf (&str,
-	    "message/partial; id=\"%s\"; number=%s; total=%s",
-	    msgid, nstr, npartstr);
+  str = NULL;
+  slen = 0;
+  mu_asnprintf (&str, &slen,
+		"message/partial; id=\"%s\"; number=%lu; total=%lu",
+		msgid, (unsigned long)n, (unsigned long)nparts);
   mu_header_append (newhdr, MU_HEADER_CONTENT_TYPE, str);
-  free (str);
-  asprintf (&str, "part %s of %s", nstr, npartstr);
+  mu_asnprintf (&str, &slen, "part %lu of %lu",
+		(unsigned long)n, (unsigned long)nparts);
   mu_header_append (newhdr, MU_HEADER_CONTENT_DESCRIPTION, str);
   free (str);
   
diff --git a/mailbox/message.c b/mailbox/message.c
index 5343799..dd8ff89 100644
--- a/mailbox/message.c
+++ b/mailbox/message.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2004, 
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -50,7 +50,7 @@
 #include <mailutils/mu_auth.h>
 #include <mailutils/nls.h>
 #include <mailutils/md5.h>
-#include <mu_umaxtostr.h>
+#include <mailutils/io.h>
 
 #define MESSAGE_MODIFIED 0x10000;
 
@@ -638,8 +638,8 @@ mu_message_get_uidl (mu_message_t msg, char *buffer, size_t buflen, size_t *pwri
 	sprintf (tmp, "%02x", md5digest[n]);
       *tmp = '\0';
       /* POP3 rfc says that an UID should not be longer than 70.  */
-      snprintf (buf + 32, 70, ".%lu.%s", (unsigned long)time (NULL), 
-                mu_umaxtostr (0, uid));
+      snprintf (buf + 32, 70, ".%lu.%lu", (unsigned long)time (NULL), 
+                (unsigned long) uid);
 
       mu_header_set_value (header, "X-UIDL", buf, 1);
       buflen--; /* leave space for the NULL.  */
diff --git a/mailbox/mutil.c b/mailbox/mutil.c
index 19d6b36..31a5e94 100644
--- a/mailbox/mutil.c
+++ b/mailbox/mutil.c
@@ -1,6 +1,6 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
    Copyright (C) 1999, 2000, 2001, 2002, 2003,
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2009 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -60,6 +60,7 @@
 #include <mailutils/filter.h>
 #include <mailutils/sql.h>
 #include <mailutils/url.h>
+#include <mailutils/io.h>
 
 #include <registrar0.h>
 
@@ -611,7 +612,7 @@ mu_tempfile (const char *tmpdir, char **namep)
 
   if (fd == -1)
     {
-      mu_error (_("Cannot open temporary file: %s"), strerror (errno));
+      mu_error (_("Cannot open temporary file: %s"), mu_strerror (errno));
       free (filename);
       return -1;
     }
@@ -1031,14 +1032,14 @@ mu_rfc2822_msg_id (int subpart, char **pval)
     {
       struct timeval tv;
       gettimeofday (&tv, NULL);
-      asprintf (&p, "<%s.%lu.%d@%s>",
-		date,
-		(unsigned long) getpid (),
-		subpart,
-		host);
+      mu_asprintf (&p, "<%s.%lu.%d@%s>",
+		   date,
+		   (unsigned long) getpid (),
+		   subpart,
+		   host);
     }
   else
-    asprintf (&p, "<%s.%lu@%s>", date, (unsigned long) getpid (), host);
+    mu_asprintf (&p, "<%s.%lu@%s>", date, (unsigned long) getpid (), host);
   free (host);
   *pval = p;
   return 0;
diff --git a/mailbox/offtostr.c b/mailbox/offtostr.c
deleted file mode 100644
index 45196e2..0000000
--- a/mailbox/offtostr.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define inttostr offtostr
-#define inttype off_t
-#include "inttostr.c"
diff --git a/mailbox/stream.c b/mailbox/stream.c
index 56e8bbe..edd4076 100644
--- a/mailbox/stream.c
+++ b/mailbox/stream.c
@@ -40,6 +40,7 @@
 
 #include <mailutils/property.h>
 #include <mailutils/errno.h>
+#include <mailutils/io.h>
 #include <stream0.h>
 
 static int refill (mu_stream_t, mu_off_t);
@@ -493,43 +494,16 @@ mu_stream_write (mu_stream_t os, const char *buf, size_t count,
 int
 mu_stream_vprintf (mu_stream_t os, mu_off_t *poff, const char *fmt, va_list ap)
 {
-  char *buf, *p;
-  size_t buflen = 512;
+  char *buf = NULL, *p;
+  size_t buflen = 0;
   size_t n;
-  int done = 0;
   int rc;
 
-  buf = calloc (1, buflen);
-  if (buf == NULL)
-    return ENOMEM;
-
-  do
-    {
-      n = vsnprintf (buf, buflen, fmt, ap);
-      if (n < 0 || n >= buflen || !memchr (buf, '\0', n + 1))
-	{
-	  char *newbuf;
-	  size_t newlen = buflen * 2;
-	  if (newlen < buflen)
-	    {
-	      free (buf);
-	      return ENOMEM;
-	    }
-	  newbuf = realloc (buf, newlen);
-	  if (newbuf == NULL)
-	    {
-	      free (buf);
-	      return ENOMEM;
-	    }
-	  buflen = newlen;
-	  buf = newbuf;
-	}
-      else
-	done = 1;
-    }
-  while (!done);
-
+  rc = mu_vasnprintf (&buf, &buflen, fmt, ap);
+  if (rc)
+    return rc;
   p = buf;
+  n = strlen (buf);
   do
     {
       size_t wrs;
diff --git a/mailbox/umaxtostr.c b/mailbox/umaxtostr.c
deleted file mode 100644
index 4f49a7f..0000000
--- a/mailbox/umaxtostr.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define inttostr umaxtostr
-#define inttype uintmax_t
-#include "inttostr.c"
diff --git a/mailbox/vasnprintf.c b/mailbox/vasnprintf.c
new file mode 100644
index 0000000..ca3b067
--- /dev/null
+++ b/mailbox/vasnprintf.c
@@ -0,0 +1,87 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2009 Free Software Foundation, Inc.
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General
+   Public License along with this library; if not, write to the
+   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301 USA */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include <mailutils/io.h>
+
+int
+mu_vasnprintf (char **pbuf, size_t *psize, const char *fmt, va_list ap)
+{
+  char *buf = *pbuf;
+  size_t buflen = *psize;
+  int rc = 0;
+  
+  if (!buf)
+    {
+      if (buflen == 0)
+	buflen = 512; /* Initial allocation */
+      
+      buf = calloc (1, buflen);
+      if (buf == NULL)
+	return ENOMEM;
+    }
+  
+  for (;;)
+    {
+      ssize_t n = vsnprintf (buf, buflen, fmt, ap);
+      if (n < 0 || n >= buflen || !memchr (buf, '\0', n + 1))
+	{
+	  char *newbuf;
+	  size_t newlen = buflen * 2;
+	  if (newlen < buflen)
+	    {
+	      rc = ENOMEM;
+	      break;
+	    }
+	  newbuf = realloc (buf, newlen);
+	  if (newbuf == NULL)
+	    {
+	      rc = ENOMEM;
+	      break;
+	    }
+	  buflen = newlen;
+	  buf = newbuf;
+	}
+      else
+	break;
+    }
+
+  if (rc)
+    {
+      if (!*pbuf)
+	{
+	  /* We made first allocation, now free it */
+	  free (buf);
+	  buf = NULL;
+	  buflen = 0;
+	}
+    }
+
+  *pbuf = buf;
+  *psize = buflen;
+  return rc;
+}


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Fri Feb 20 03:56:19 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LaRBD-0007DT-PP
	for mharc-commit-mailutils@gnu.org; Fri, 20 Feb 2009 03:56:19 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LaRBB-0007DF-T6
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 03:56:17 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LaRBB-0007D3-Dp
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 03:56:17 -0500
Received: from [199.232.76.173] (port=51506 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LaRBB-0007D0-At
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 03:56:17 -0500
Received: from savannah.gnu.org ([199.232.41.3]:57781 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LaRBB-0001Mh-5J
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 03:56:17 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LaRBA-0001vQ-G8
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 08:56:16 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LaRB9-0001uw-Mv
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 08:56:16 +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: a4e1e5e8481565d97804c083752ee3eea0ebf87e
X-Git-Newrev: 47b3b9bc2a40c03e9bbf73b33592a9538fed34a0
Message-Id: <E1LaRB9-0001uw-Mv@cvs.savannah.gnu.org>
Date: Fri, 20 Feb 2009 08:56:15 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-229-g47b3b9b
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, 20 Feb 2009 08:56: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=47b3b9bc2a40c03e9bbf73b33592a9538fed34a0

The branch, master has been updated
       via  47b3b9bc2a40c03e9bbf73b33592a9538fed34a0 (commit)
      from  a4e1e5e8481565d97804c083752ee3eea0ebf87e (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 47b3b9bc2a40c03e9bbf73b33592a9538fed34a0
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Feb 20 10:24:49 2009 +0200

    Define LOG_AUTHPRIV if syslog.h does not

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

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

diff --git a/mailbox/syslog.c b/mailbox/syslog.c
index 3ff522e..953167b 100644
--- a/mailbox/syslog.c
+++ b/mailbox/syslog.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -23,6 +23,10 @@
 #include <mailutils/kwd.h>
 #include <mailutils/syslog.h>
 
+#ifndef LOG_AUTHPRIV
+# define LOG_AUTHPRIV
+#endif
+
 static mu_kwd_t kw_facility[] = {
   { "USER",    LOG_USER },   
   { "DAEMON",  LOG_DAEMON },


hooks/post-receive
--
GNU Mailutils



From MAILER-DAEMON Fri Feb 20 09:23:15 2009
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1LaWHb-0002Ls-6O
	for mharc-commit-mailutils@gnu.org; Fri, 20 Feb 2009 09:23:15 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1LaWHZ-0002LK-Pr
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 09:23:13 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1LaWHZ-0002Ks-6G
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 09:23:13 -0500
Received: from [199.232.76.173] (port=33605 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1LaWHY-0002Kk-Ld
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 09:23:12 -0500
Received: from savannah.gnu.org ([199.232.41.3]:55252 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1LaWHY-0004qV-8S
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 09:23:12 -0500
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LaWHX-0000Xl-Hp
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 14:23:11 +0000
Received: from gray by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1LaWHU-0000XF-MH
	for commit-mailutils@gnu.org; Fri, 20 Feb 2009 14: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: 47b3b9bc2a40c03e9bbf73b33592a9538fed34a0
X-Git-Newrev: 5b3ac30a697287b6b72e3d7f717e19a159cae821
Message-Id: <E1LaWHU-0000XF-MH@cvs.savannah.gnu.org>
Date: Fri, 20 Feb 2009 14:23:09 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [SCM] GNU Mailutils branch, master,
	updated. mu-1-2-90-separate-argp-cfg-230-g5b3ac30
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, 20 Feb 2009 14:23:14 -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=5b3ac30a697287b6b72e3d7f717e19a159cae821

The branch, master has been updated
       via  5b3ac30a697287b6b72e3d7f717e19a159cae821 (commit)
      from  47b3b9bc2a40c03e9bbf73b33592a9538fed34a0 (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 5b3ac30a697287b6b72e3d7f717e19a159cae821
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Fri Feb 20 16:22:53 2009 +0200

    Bugfixes in AMD code.
    
    * libproto/include/amd.h (new_msg_file_name): Add an argument indicating
    whether an actual expunsion is going to take place, as opposed to saving
    message flags.
    * libproto/maildir/mbox.c (maildir_new_message_name): Sync with above changes.
    * libproto/mh/mbox.c (_mh_new_message_name): Likewise.
    * mailbox/amd.c (_amd_message_save): Handle unlink requests
    (new_msg_file_name returning NULL name). This avoids creating temp files.
    (amd_expunge): Remove messages that have had MU_ATTRIBUTE_DELETED on mailbox
    open, if the underlying mailbox implementation allows that.

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

Summary of changes:
 libproto/include/amd.h  |    2 +-
 libproto/maildir/mbox.c |    9 ++--
 libproto/mh/mbox.c      |    4 +-
 mailbox/amd.c           |  135 +++++++++++++++++++++++++++-------------------
 4 files changed, 87 insertions(+), 63 deletions(-)

diff --git a/libproto/include/amd.h b/libproto/include/amd.h
index fde8cfd..6f4a866 100644
--- a/libproto/include/amd.h
+++ b/libproto/include/amd.h
@@ -72,7 +72,7 @@ struct _amd_data
 			      const mu_message_t);
   void (*msg_free) (struct _amd_message *);
   int (*cur_msg_file_name) (struct _amd_message *, char **);	
-  int (*new_msg_file_name) (struct _amd_message *, int attr_flags, char **);
+  int (*new_msg_file_name) (struct _amd_message *, int, int, char **);
   int (*scan0)     (mu_mailbox_t mailbox, size_t msgno, size_t *pcount,
 		    int do_notify);
   int (*mailbox_size) (mu_mailbox_t mailbox, mu_off_t *psize);
diff --git a/libproto/maildir/mbox.c b/libproto/maildir/mbox.c
index 86cacae..de2ed03 100644
--- a/libproto/maildir/mbox.c
+++ b/libproto/maildir/mbox.c
@@ -342,14 +342,13 @@ maildir_cur_message_name (struct _amd_message *amsg, char **pname)
 }
 
 static int
-maildir_new_message_name (struct _amd_message *amsg, int flags, char **pname)
+maildir_new_message_name (struct _amd_message *amsg, int flags, int expunge,
+			  char **pname)
 {
   struct _maildir_message *msg = (struct _maildir_message *) amsg;
-  if (flags & MU_ATTRIBUTE_DELETED)
+  if (expunge && (flags & MU_ATTRIBUTE_DELETED))
     {
-      /* Force amd.c to unlink the file.
-	 FIXME: We could also add a 'T' info to it. Should
-	 we have an option deciding which approach to take? */
+      /* Force amd.c to unlink the file. */
       *pname = NULL;
     }
   else if (strcmp (msg->dir, CURSUF) == 0)
diff --git a/libproto/mh/mbox.c b/libproto/mh/mbox.c
index 52e1129..f2bdb9c 100644
--- a/libproto/mh/mbox.c
+++ b/libproto/mh/mbox.c
@@ -126,7 +126,9 @@ _mh_cur_message_name (struct _amd_message *amsg, char **pname)
 /* Return newfilename for the message.
    NOTE: Allocates memory. */
 static int
-_mh_new_message_name (struct _amd_message *amsg, int flags, char **pname)
+_mh_new_message_name (struct _amd_message *amsg, int flags,
+		      int expunge MU_ARG_UNUSED,
+		      char **pname)
 {
   int status = 0;
   struct _mh_message *mhm = (struct _mh_message *) amsg;
diff --git a/mailbox/amd.c b/mailbox/amd.c
index 4f72a05..8066518 100644
--- a/mailbox/amd.c
+++ b/mailbox/amd.c
@@ -600,7 +600,7 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
 		   int expunge)
 {
   mu_stream_t stream = NULL;
-  char *name = NULL, *buf = NULL, *msg_name;
+  char *name = NULL, *buf = NULL, *msg_name, *old_name;
   size_t n, off = 0;
   size_t bsize;
   size_t nlines, nbytes;
@@ -618,9 +618,27 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
   if (status)
     return status;
 
+  status = amd->new_msg_file_name (mhm, mhm->attr_flags, expunge, &msg_name);
+  if (status)
+    return status;
+  if (!msg_name)
+    {
+      /* Unlink the original file */
+      char *old_name;
+      status = amd->cur_msg_file_name (mhm, &old_name);
+      free (msg_name);
+      if (status == 0 && unlink (old_name))
+	status = errno;
+      free (old_name);
+      return status;
+    }      
+    
   fp = _amd_tempfile (mhm->amd, &name);
   if (!fp)
-    return errno;
+    {
+      free (msg_name);
+      return errno;
+    }
 
   /* Try to allocate large buffer */
   for (; bsize > 1; bsize /= 2)
@@ -628,7 +646,12 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
       break;
 
   if (!bsize)
-    return ENOMEM;
+    {
+      unlink (name);
+      free (name);
+      free (msg_name);
+      return ENOMEM;
+    }
 
   /* Copy flags */
   mu_message_get_header (msg, &hdr);
@@ -724,42 +747,37 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
   free (buf);
   fclose (fp);
 
-  status = amd->new_msg_file_name (mhm, mhm->attr_flags, &msg_name);
+  status = amd->cur_msg_file_name (mhm, &old_name);
   if (status == 0)
     {
-      char *old_name;
-      status = amd->cur_msg_file_name (mhm, &old_name);
-      if (status == 0)
+      if (rename (name, msg_name))
+	status = errno;
+      else
 	{
-	  if (rename (name, msg_name))
-	    status = errno;
-	  else
-	    {
-	      mode_t perms;
+	  mode_t perms;
 	  
-	      perms = mu_stream_flags_to_mode (amd->mailbox->flags, 0);
-	      if (perms != 0)
-		{
-		  /* It is documented that the mailbox permissions are
-		     affected by the current umask, so take it into account
-		     here.
-		     FIXME: I'm still not sure we should honor umask, though.
-		     --gray
-		  */
-		  mode_t mask = umask (0);
-		  chmod (msg_name, (0600 | perms) & ~mask);
-		  umask (mask);
-		}
-	      if (strcmp (old_name, msg_name))
-		/* Unlink original message */
-		unlink (old_name);
+	  perms = mu_stream_flags_to_mode (amd->mailbox->flags, 0);
+	  if (perms != 0)
+	    {
+	      /* It is documented that the mailbox permissions are
+		 affected by the current umask, so take it into account
+		 here.
+		 FIXME: I'm still not sure we should honor umask, though.
+		 --gray
+	      */
+	      mode_t mask = umask (0);
+	      chmod (msg_name, (0600 | perms) & ~mask);
+	      umask (mask);
 	    }
-	  free (old_name);
-
-	  mhm->orig_flags = mhm->attr_flags;
+	  if (strcmp (old_name, msg_name))
+	    /* Unlink original message */
+	    unlink (old_name);
 	}
-      free (msg_name);
+      free (old_name);
+      
+      mhm->orig_flags = mhm->attr_flags;
     }
+  free (msg_name);
   free (name);
 
   return status;
@@ -1065,33 +1083,38 @@ amd_expunge (mu_mailbox_t mailbox)
       
       if (mhm->attr_flags & MU_ATTRIBUTE_DELETED)
 	{
-	  if (!(mhm->orig_flags & MU_ATTRIBUTE_DELETED))
+	  int rc;
+	  char *old_name;
+	  char *new_name;
+
+	  rc = amd->cur_msg_file_name (mhm, &old_name);
+	  if (rc)
+	    return rc;
+	  rc = amd->new_msg_file_name (mhm, mhm->attr_flags, 1,
+				       &new_name);
+	  if (rc)
 	    {
-	      int rc;
-	      char *old_name;
-	      char *new_name;
-
-	      rc = amd->cur_msg_file_name (mhm, &old_name);
-	      if (rc)
-		return rc;
-	      rc = amd->new_msg_file_name (mhm, mhm->attr_flags, &new_name);
-	      if (rc)
-		{
-		  free (old_name);
-		  return rc;
-		}
-	      
-	      if (new_name)
-		{
-		  /* Rename original message */
-		  rename (old_name, new_name);
-		  free (new_name);
-		}
-	      else
-		/* Unlink original file */
-		unlink (old_name);
 	      free (old_name);
+	      return rc;
+	    }
+
+	  if (new_name)
+	    {
+	      /* FIXME: It may be a good idea to have a capability flag
+		 in struct _amd_data indicating that no actual removal
+		 is needed (e.g. for traditional MH). It will allow to
+		 bypass lots of no-op code here. */
+	      if (strcmp (old_name, new_name))
+		/* Rename original message */
+		rename (old_name, new_name);
 	    }
+	  else
+	    /* Unlink original file */
+	    unlink (old_name);
+	  
+	  free (old_name);
+	  free (new_name);
+
 	  _amd_message_delete (amd, mhm);
 	  updated = 1;
 	  /* Do not increase i! */


hooks/post-receive
--
GNU Mailutils



