From MAILER-DAEMON Sun Aug 05 09:05:01 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sy0Vx-00055b-9H
	for mharc-commit-mailutils@gnu.org; Sun, 05 Aug 2012 09:05:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:51897)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sy0Vv-00055G-7h
	for commit-mailutils@gnu.org; Sun, 05 Aug 2012 09:05:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sy0Vt-0001kG-QA
	for commit-mailutils@gnu.org; Sun, 05 Aug 2012 09:04:59 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:48557)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sy0Vt-0001kB-Mn
	for commit-mailutils@gnu.org; Sun, 05 Aug 2012 09:04:57 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sy0Vt-0000eo-8L
	for commit-mailutils@gnu.org; Sun, 05 Aug 2012 13:04:57 +0000
Date: Sun, 05 Aug 2012 13:04:57 +0000
Message-Id: <E1Sy0Vt-0000eo-8L@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-628-g1cbbd57
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 6e2a37582ae89b43438952059412ea4a994d546c
X-Git-Newrev: 1cbbd572d56b7a77362992181ef008db8a11688f
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 05 Aug 2012 13:05:00 -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=1cbbd572d56b7a77362992181ef008db8a11688f

The branch, master has been updated
       via  1cbbd572d56b7a77362992181ef008db8a11688f (commit)
      from  6e2a37582ae89b43438952059412ea4a994d546c (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 1cbbd572d56b7a77362992181ef008db8a11688f
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Sat Aug 4 20:04:01 2012 +0300

    Ensure consisten stream state before calling its ctl method.
    
    Prior to calling ctl method, mu_stream_ioctl flushes stream
    buffer.
    
    * libmailutils/stream/fltstream.c (filter_ctl)
    <MU_IOCTL_FILTER_SET_DISABLED>: Flush internal buffer prior to
    setting the flag.
    * libmailutils/stream/stream.c (mu_stream_ioctl): Flush stream
    buffer.

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

Summary of changes:
 libmailutils/stream/fltstream.c |    5 +++++
 libmailutils/stream/stream.c    |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libmailutils/stream/fltstream.c b/libmailutils/stream/fltstream.c
index 9a8e4b5..36e9c5e 100644
--- a/libmailutils/stream/fltstream.c
+++ b/libmailutils/stream/fltstream.c
@@ -399,6 +399,7 @@ filter_ctl (struct _mu_stream *stream, int code, int opcode, void *ptr)
 {
   struct _mu_filter_stream *fs = (struct _mu_filter_stream *)stream;
   int status;
+  size_t dummy;
   
   switch (code)
     {
@@ -406,6 +407,10 @@ filter_ctl (struct _mu_stream *stream, int code, int opcode, void *ptr)
       switch (opcode)
 	{
 	case MU_IOCTL_FILTER_SET_DISABLED:
+	  status = filter_write_internal (stream, mu_filter_flush,
+					  NULL, 0, &dummy);
+	  if (status)
+	    return status;
 	  if (ptr && *(int*)ptr)
 	    fs->fltflag |= _MU_FILTER_DISABLED;
 	  else
diff --git a/libmailutils/stream/stream.c b/libmailutils/stream/stream.c
index 7272269..a7dabbf 100644
--- a/libmailutils/stream/stream.c
+++ b/libmailutils/stream/stream.c
@@ -1156,7 +1156,10 @@ mu_stream_size (mu_stream_t stream, mu_off_t *psize)
 int
 mu_stream_ioctl (mu_stream_t stream, int family, int opcode, void *ptr)
 {
+  int rc;
   _bootstrap_event (stream);
+  if ((rc = _stream_flush_buffer (stream, _MU_STR_FLUSH_ALL)))
+    return rc;
   if (stream->ctl == NULL)
     return ENOSYS;
   return stream->ctl (stream, family, opcode, ptr);


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Mon Aug 06 01:22:06 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1SyFlW-0000sp-B6
	for mharc-commit-mailutils@gnu.org; Mon, 06 Aug 2012 01:22:06 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44394)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SyFlU-0000sN-1P
	for commit-mailutils@gnu.org; Mon, 06 Aug 2012 01:22:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SyFlS-0004kQ-JF
	for commit-mailutils@gnu.org; Mon, 06 Aug 2012 01:22:03 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:43844)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SyFlS-0004kM-FU
	for commit-mailutils@gnu.org; Mon, 06 Aug 2012 01:22:02 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SyFlR-0004ZN-Qv
	for commit-mailutils@gnu.org; Mon, 06 Aug 2012 05:22:02 +0000
Date: Mon, 06 Aug 2012 05:22:01 +0000
Message-Id: <E1SyFlR-0004ZN-Qv@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-630-g83f7cbe
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 1cbbd572d56b7a77362992181ef008db8a11688f
X-Git-Newrev: 83f7cbe72032cf88b24039fee63efb44e79c18de
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 06 Aug 2012 05:22:05 -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=83f7cbe72032cf88b24039fee63efb44e79c18de

The branch, master has been updated
       via  83f7cbe72032cf88b24039fee63efb44e79c18de (commit)
       via  7080a2ee6d381f39b3cce24dbb6cef6d311dbec8 (commit)
      from  1cbbd572d56b7a77362992181ef008db8a11688f (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 83f7cbe72032cf88b24039fee63efb44e79c18de
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Aug 6 08:21:58 2012 +0300

    Fix a typo.

commit 7080a2ee6d381f39b3cce24dbb6cef6d311dbec8
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Mon Aug 6 08:12:40 2012 +0300

    mailutils-config: reflect eventual rename of mu, so that AM_GNU_MAILUTILS works.
    
    * mu/.gitignore: Update.
    * mu/Makefile.am: Build mailutils-config
    * mu/mailutils-config.in: New file.
    * mu/mailutils-config: Remove.

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

Summary of changes:
 ChangeLog.amend                              |    3 +++
 mu/.gitignore                                |    1 +
 mu/Makefile.am                               |   12 ++++++++++--
 mu/{mailutils-config => mailutils-config.in} |   21 +++++++++++++--------
 4 files changed, 27 insertions(+), 10 deletions(-)
 rename mu/{mailutils-config => mailutils-config.in} (75%)
 mode change 100755 => 100644

diff --git a/ChangeLog.amend b/ChangeLog.amend
index 8c6d963..6b35ac9 100644
--- a/ChangeLog.amend
+++ b/ChangeLog.amend
@@ -1,5 +1,8 @@
 # Spelling corrections for GNU Mailutils ChangeLog
 
+1cbbd572d56b7a77362992181ef008db8a11688f
+s/consisten/consistent/
+
 e02df56cb384465b3238c46c6f214f27ee8431ab
 s/command on 64 boxes/command on 64-bit boxes/
 
diff --git a/mu/.gitignore b/mu/.gitignore
index c159d48..de89b9a 100644
--- a/mu/.gitignore
+++ b/mu/.gitignore
@@ -1,3 +1,4 @@
 mu
 mu-setup.c
 mu-setup.h
+mailutils-config
diff --git a/mu/Makefile.am b/mu/Makefile.am
index 4ca4100..ae307ea 100644
--- a/mu/Makefile.am
+++ b/mu/Makefile.am
@@ -16,7 +16,15 @@
 ## along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
 bin_PROGRAMS = mu
-dist_bin_SCRIPTS = mailutils-config
+bin_SCRIPTS = mailutils-config
+
+CLEANFILES=mailutils-config
+mailutils-config: $(top_srcdir)/mu/mailutils-config.in
+	$(AM_V_GEN)muname=`echo mu | \
+              sed -e 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+              sed 'N;N;N;s,\n, ,g'`; \
+	sed 's/MUNAME/'$$muname'/g' $(top_srcdir)/mu/mailutils-config.in > mailutils-config
+
 
 IDLE_MODULES=
 
@@ -101,7 +109,7 @@ AM_CPPFLAGS = \
   -DDBMLIBS="\"$(DBMLIBS)\""
 
 BUILT_SOURCES=mu-setup.c mu-setup.h
-EXTRA_DIST=mu-setup.awk mu-setup.c mu-setup.h template.c
+EXTRA_DIST=mu-setup.awk mu-setup.c mu-setup.h template.c mailutils-config.in
 
 mu-setup.h: Makefile.am $(MODULES) $(IDLE_MODULES) 
 	$(AM_V_GEN)$(AWK) -f $(top_srcdir)/mu/mu-setup.awk -v mode=h \
diff --git a/mu/mailutils-config b/mu/mailutils-config.in
old mode 100755
new mode 100644
similarity index 75%
rename from mu/mailutils-config
rename to mu/mailutils-config.in
index 5e05b9d..b7e3661
--- a/mu/mailutils-config
+++ b/mu/mailutils-config.in
@@ -15,6 +15,11 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
+# Despite being deprecated, this script is retained as an intermediate
+# layer between mu and the AM_GNU_MAILUTILS macro.  This is important,
+# because some distros prefer to rename mu when installing.  Using this 
+# script allows AM_GNU_MAILUTILS to find mu even if it was renamed.
+
 mode=
 file=
 dir=`expr "$0" : '\(.*\)/.*'`
@@ -29,13 +34,13 @@ alternatives instead:
 
        Traditional usage          |   Use instead
     ------------------------------+-------------------
-    mailutils-config --compile    | mu cflags
-    mailutils-config --link       | mu ldflags
-    mailutils-config --info       | mu info
-    mailutils-config --query      | mu query
-    mailutils-config --query=FILE | mu query -f FILE
+    mailutils-config --compile    | MUNAME cflags
+    mailutils-config --link       | MUNAME ldflags
+    mailutils-config --info       | MUNAME info
+    mailutils-config --query      | MUNAME query
+    mailutils-config --query=FILE | MUNAME query -f FILE
 
-For more information, try \`mu --help'.
+For more information, try \`MUNAME --help'.
 
 EOT
     exit 0
@@ -88,7 +93,7 @@ do
     usage
     ;;
   -V|--version|--versio|--versi|--vers|--ver|--ve|--v)
-    mu --version | sed -n '1{s/^mu/mailutils-config/;s/(\(GNU Mailutils\)) \([0-9][0-9.]*\).*/(\1 \2)/;p}'
+    MUNAME --version | sed -n '1{s/^MUNAME/mailutils-config/;s/(\(GNU Mailutils\)) \([0-9][0-9.]*\).*/(\1 \2)/;p}'
     exit 0
     ;;
   *)
@@ -106,4 +111,4 @@ if test -n "$file"; then
   set -- -f"$file" $*
 fi
 
-mu $mode $*
+MUNAME $mode $*


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Tue Aug 07 06:13:00 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sygma-00027p-IK
	for mharc-commit-mailutils@gnu.org; Tue, 07 Aug 2012 06:13:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45262)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SygmV-00027T-4p
	for commit-mailutils@gnu.org; Tue, 07 Aug 2012 06:12:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SygmQ-00022n-CI
	for commit-mailutils@gnu.org; Tue, 07 Aug 2012 06:12:55 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:59736)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SygmQ-00022i-8h
	for commit-mailutils@gnu.org; Tue, 07 Aug 2012 06:12:50 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1SygmP-0001kc-GK
	for commit-mailutils@gnu.org; Tue, 07 Aug 2012 10:12:49 +0000
Date: Tue, 07 Aug 2012 10:12:49 +0000
Message-Id: <E1SygmP-0001kc-GK@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-631-gb9f1052
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 83f7cbe72032cf88b24039fee63efb44e79c18de
X-Git-Newrev: b9f10525a3fb6167b0588c988f0aec4507c2c0f0
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 07 Aug 2012 10:12:59 -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=b9f10525a3fb6167b0588c988f0aec4507c2c0f0

The branch, master has been updated
       via  b9f10525a3fb6167b0588c988f0aec4507c2c0f0 (commit)
      from  83f7cbe72032cf88b24039fee63efb44e79c18de (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 b9f10525a3fb6167b0588c988f0aec4507c2c0f0
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Aug 7 13:02:41 2012 +0300

    mail: provide a way to set return address.
    
    * mail/mail.c: New option -r (--return-address).
    * mail/mailvar.c: New variable "return-address".
    * mail/send.c (send_message): Obtain the return mail address
    from the "return-address" variable (if set).
    
    * NEWS: Update.
    * doc/texinfo/programs.texi: Update.

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

Summary of changes:
 NEWS                      |   13 ++++++++++++-
 doc/texinfo/programs.texi |   14 +++++++++++++-
 mail/mail.c               |    9 +++++++--
 mail/mailvar.c            |    3 +++
 mail/send.c               |   31 +++++++++++++++++++++++++------
 5 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index 7e55823..ac7dbdf 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2012-07-19
+GNU mailutils NEWS -- history of user-visible changes. 2012-08-07
 Copyright (C) 2002-2012 Free Software Foundation, Inc.
 See the end of file for copying conditions.
 
@@ -149,6 +149,17 @@ The mail shell provides the following new escapes to handle attachments:
  ~^ N
     Delete Nth attachment.
 
+** mail: the -r option
+
+The meaning of the `-r' option has changed.  Now it introduces the
+return address to use when sending mail.  This is an incompatible
+change.
+
+The return address can also be set from the mail shell, by assigning
+to the `return-address' variable, e.g.:
+
+ set return-address "gray@gnu.org"
+    
 ** MH: improved compatibility with other implementations
 
 ** MH inc: new option --moveto
diff --git a/doc/texinfo/programs.texi b/doc/texinfo/programs.texi
index aaa66f5..4ba978d 100644
--- a/doc/texinfo/programs.texi
+++ b/doc/texinfo/programs.texi
@@ -2489,7 +2489,6 @@ Do not read the system-wide mailrc file.  @xref{Mail Configuration Files}.
 Do not display initial header summary.
 @item -p
 @itemx --print
-@itemx -r
 @itemx --read
 Print all mail to standard output.  It is equivalent to issuing following
 commands after starting @samp{mail -N}:
@@ -2499,6 +2498,9 @@ print *
 quit
 @end group
 @end example
+@item -r @var{address}
+@itemx --return-address=@var{address}
+Sets the return email address for outgoing mail.  @xref{return-address}.
 @item -q
 @itemx --quit
 Cause interrupts to terminate program.
@@ -4371,6 +4373,16 @@ set replyregex="^(re|odp|aw|ang)(\\[[0-9]+\\])?:[[:blank:]]"
 @noindent
 (Notice the quoting of backslash characters).
 
+@anchor{return-address}
+@kwindex return-address
+@item return-address
+@*Type: String
+@*Default: unset
+@vrindex return-address, mail variable.
+
+Sets the return email address to use when sending messages.  If unset,
+the address is composed from the current user name and the host name.
+
 @kwindex save
 @item save
 @*Type: Boolean.
diff --git a/mail/mail.c b/mail/mail.c
index 400bb0c..aad4246 100644
--- a/mail/mail.c
+++ b/mail/mail.c
@@ -47,7 +47,9 @@ static struct argp_option options[] = {
   {"nosum",   'N', NULL,      0,
    N_("do not display initial header summary"), 0},
   {"print",   'p', NULL,      0, N_("print all mail to standard output"), 0},
-  {"read",    'r', NULL,      OPTION_ALIAS },
+  {"read",    NULL, NULL,      OPTION_ALIAS },
+  {"return-address", 'r', N_("ADDRESS"), 0,
+   N_("use address as the return address when sending mail"), 0},
   {"quit",    'q', NULL,      0,
    N_("cause interrupts to terminate program"), 0},
   {"subject", 's', N_("SUBJ"), 0,
@@ -117,10 +119,13 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
       
     case 'p':
-    case 'r':
       util_cache_command (&command_list, "setq mode=print");
       break;
       
+    case 'r':
+      util_cache_command (&command_list, "set return-address=%s", arg);
+      break;
+      
     case 'q':
       util_cache_command (&command_list, "set quit");
       break;
diff --git a/mail/mailvar.c b/mail/mailvar.c
index e0d1306..d74ccea 100644
--- a/mail/mailvar.c
+++ b/mail/mailvar.c
@@ -215,6 +215,9 @@ struct mailvar_symbol mailvar_tab[] =
       MAILVAR_TYPEMASK (mailvar_type_string),
       N_("regexp for recognizing subject lines of reply messages"),
       set_replyregex },
+    { { "return-address" },
+      MAILVAR_TYPEMASK (mailvar_type_string),
+      N_("return address for outgoing messages") },
     { { "save", },
       MAILVAR_TYPEMASK (mailvar_type_boolean),
       N_("store aborted messages in the user's dead.file") },
diff --git a/mail/send.c b/mail/send.c
index 053a289..55fc246 100644
--- a/mail/send.c
+++ b/mail/send.c
@@ -185,7 +185,7 @@ send_attach_file (const char *name,
   if (!encoding)
     encoding = "base64";
   mu_filter_get_list (&list);
-  rc = mu_list_locate (list, encoding, NULL);
+  rc = mu_list_locate (list, (void*) encoding, NULL);
   if (rc)
     {
       mu_error (_("unsupported encoding: %s"), encoding);
@@ -777,24 +777,43 @@ send_message (mu_message_t msg)
 	  status = mu_mailer_create (&mailer, sendmail);
 	  if (status == 0)
 	    {
+	      const char *return_address_str;
+	      mu_address_t return_address = NULL;
+	      
+	      if (mailvar_get (&return_address_str, "return-address",
+			       mailvar_type_string, 0) == 0)
+		{
+		  status = mu_address_create (&return_address,
+					      return_address_str);
+		  if (status)
+		    {
+		      mu_error (_("invalid return address: %s"),
+				mu_strerror (status));
+		      mu_mailer_destroy (&mailer);
+		      return status;
+		    }
+		} 
+
 	      if (mailvar_get (NULL, "verbose", mailvar_type_boolean, 0) == 0)
 		{
 		  mu_debug_set_category_level (MU_DEBCAT_MAILER,
-				      MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
+					  MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT));
 		}
 	      status = mu_mailer_open (mailer, MU_STREAM_RDWR);
 	      if (status == 0)
 		{
-		  status = mu_mailer_send_message (mailer, msg, NULL, NULL);
+		  status = mu_mailer_send_message (mailer, msg,
+						   return_address, NULL);
 		  mu_mailer_close (mailer);
 		}
 	      else
-		mu_error (_("Cannot open mailer: %s"), mu_strerror (status));
+		mu_error (_("Cannot open mailer: %s"),
+			  mu_strerror (status));
 	      mu_mailer_destroy (&mailer);
+	      mu_address_destroy (&return_address);
 	    }
 	  else
-	    mu_error (_("Cannot create mailer: %s"),
-			mu_strerror (status));
+	    mu_error (_("Cannot create mailer: %s"), mu_strerror (status));
 	}
     }
   else


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Wed Aug 08 08:17:25 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Sz5CX-0007GL-3t
	for mharc-commit-mailutils@gnu.org; Wed, 08 Aug 2012 08:17:25 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52725)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sz5CU-0007Fy-RQ
	for commit-mailutils@gnu.org; Wed, 08 Aug 2012 08:17:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sz5CO-00088Q-7b
	for commit-mailutils@gnu.org; Wed, 08 Aug 2012 08:17:22 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:60691)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sz5CO-00088L-2J
	for commit-mailutils@gnu.org; Wed, 08 Aug 2012 08:17:16 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Sz5CN-0007g3-Ar
	for commit-mailutils@gnu.org; Wed, 08 Aug 2012 12:17:15 +0000
Date: Wed, 08 Aug 2012 12:17:15 +0000
Message-Id: <E1Sz5CN-0007g3-Ar@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-632-ga7a174d
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: b9f10525a3fb6167b0588c988f0aec4507c2c0f0
X-Git-Newrev: a7a174d51ca7845f9eda854709258d64e5d0077e
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Received-From: 140.186.70.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 08 Aug 2012 12:17:24 -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=a7a174d51ca7845f9eda854709258d64e5d0077e

The branch, master has been updated
       via  a7a174d51ca7845f9eda854709258d64e5d0077e (commit)
      from  b9f10525a3fb6167b0588c988f0aec4507c2c0f0 (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 a7a174d51ca7845f9eda854709258d64e5d0077e
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Aug 8 14:46:54 2012 +0300

    Improve header stream write method.
    
    * libmailutils/mailbox/header.c (HEADER_STREAMMOD): New flag.
    (mu_header_fill): Read data back from mstream if it was
    modified.
    (mu_header_destroy): Destroy mstream.
    (header_write): Rewrite from scratch. Allow for writing at
    arbitrary offsets.
    * examples/header.c: New commands: "overwrite" and "append",
    for testing the new functionality.

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

Summary of changes:
 examples/header.c             |   71 ++++++++++++++++++++++++-
 libmailutils/mailbox/header.c |  115 ++++++++++++++++++++++------------------
 2 files changed, 132 insertions(+), 54 deletions(-)

diff --git a/examples/header.c b/examples/header.c
index f25d5df..bde8b82 100644
--- a/examples/header.c
+++ b/examples/header.c
@@ -283,7 +283,7 @@ cmd_write (int argc, char **argv)
       mu_error ("%u: cannot get stream: %s", line_num, mu_strerror (status));
       return;
     }
-  printf("[reading headers; end with an empty line]\n");
+  printf ("[reading headers; end with an empty line]\n");
   mu_stream_seek (str, 0, SEEK_SET, NULL);
   while (prompt (1), fgets(buf, sizeof buf, stdin))
     {
@@ -296,6 +296,71 @@ cmd_write (int argc, char **argv)
 }
 
 void
+cmd_overwrite (int argc, char **argv)
+{
+  char buf[512];
+  mu_stream_t str;
+  int status;
+  mu_off_t off;
+  
+  if (check_args (argv[0], argc, 2, 2))
+    return;
+
+  off = strtoul (argv[1], NULL, 0);
+  
+  status = mu_header_get_streamref (header, &str);
+  if (status)
+    {
+      mu_error ("%u: cannot get stream: %s", line_num, mu_strerror (status));
+      return;
+    }
+  status = mu_stream_seek (str, off, SEEK_SET, NULL);
+  if (status)
+    {
+      mu_error ("seek error: %s", mu_strerror (status));
+      return;
+    }
+
+  printf ("[reading headers; end with an empty line]\n");
+  while (prompt (1), fgets(buf, sizeof buf, stdin))
+    {
+      if (buf[0] == '\n')
+	break;
+      mu_stream_write (str, buf, strlen (buf), NULL);
+    }
+  mu_stream_destroy (&str);
+  mu_stream_destroy (&hstream);
+}
+
+void
+cmd_append (int argc, char **argv)
+{
+  char buf[512];
+  mu_stream_t str;
+  int status;
+  
+  if (check_args (argv[0], argc, 1, 1))
+    return;
+
+  status = mu_header_get_streamref (header, &str);
+  if (status)
+    {
+      mu_error ("%u: cannot get stream: %s", line_num, mu_strerror (status));
+      return;
+    }
+  printf ("[reading headers; end with an empty line]\n");
+  mu_stream_seek (str, 0, SEEK_END, NULL);
+  while (prompt (1), fgets(buf, sizeof buf, stdin))
+    {
+      mu_stream_write (str, buf, strlen (buf), NULL);
+      if (buf[0] == '\n')
+	break;
+    }
+  mu_stream_destroy (&str);
+  mu_stream_destroy (&hstream);
+}
+
+void
 cmd_iterate (int argc, char **argv)
 {
   if (check_args (argv[0], argc, 1, 2))
@@ -379,7 +444,7 @@ static struct cmdtab cmdtab[] = {
   { "free", cmd_free, NULL, "discard all headers" },
   { "print", cmd_print, "NAME [N]",
     "find and print the Nth (by default, 1st) instance of header named NAME" },
-  { "dump", cmd_dump, NULL, "dump all headers on screen" },
+  { "dump", cmd_dump, "[OFF]", "dump all headers on screen" },
   { "itr", cmd_iterate, "[first|1|next|n]", "iterate over headers" },
   { "readline", cmd_readline, "[SIZE]", "read line" },
   { "remove", cmd_remove, "NAME [N]",
@@ -387,6 +452,8 @@ static struct cmdtab cmdtab[] = {
   { "insert", cmd_insert, "NAME VALUE [REF [NUM] [before|after] [replace]]",
     "insert new header" },
   { "write", cmd_write, NULL, "accept headers from raw stream" },
+  { "overwrite", cmd_overwrite, "OFF", "overwrite raw data from offset OFF" },
+  { "append", cmd_append, NULL, "append raw data" },
   { "help", cmd_help, "[COMMAND]", "print short usage message" },
   { NULL }
 };
diff --git a/libmailutils/mailbox/header.c b/libmailutils/mailbox/header.c
index f889b4c..1c76421 100644
--- a/libmailutils/mailbox/header.c
+++ b/libmailutils/mailbox/header.c
@@ -50,6 +50,7 @@
 
 #define HEADER_MODIFIED   0x01
 #define HEADER_INVALIDATE 0x02
+#define HEADER_STREAMMOD  0x04
 
 #define HEADER_SET_MODIFIED(h) \
   ((h)->flags |= (HEADER_MODIFIED|HEADER_INVALIDATE))
@@ -412,6 +413,33 @@ mu_header_fill (mu_header_t header)
   size_t blurb_len = 0;
   char *blurb = NULL;
   
+  if (header->mstream && header->flags & HEADER_STREAMMOD)
+    {
+      mu_off_t end;
+
+      mu_header_invalidate (header);
+      status = mu_stream_size (header->mstream, &end);
+      if (status)
+	return status;
+      status = mu_stream_seek (header->mstream, 0, MU_SEEK_SET, NULL);
+      if (status)
+	return status;      
+      blurb_len = end;
+      blurb = malloc (blurb_len + 1);
+      if (!blurb)
+	return ENOMEM;
+      status = mu_stream_read (header->mstream, blurb, blurb_len, NULL);
+      if (status)
+	{
+	  free (blurb);
+	  return status;
+	}
+      status = header_parse (header, blurb, blurb_len);
+      free (blurb);
+      if (status == 0)
+	header->flags &= ~HEADER_STREAMMOD;
+      return status;
+    }
   if (header->spool_used)
     return 0;
   
@@ -452,6 +480,7 @@ mu_header_destroy (mu_header_t *ph)
     {  
       mu_header_t header = *ph;
 
+      mu_stream_destroy (&header->mstream);
       mu_stream_destroy (&header->stream);
       mu_hdrent_free_list (header);
       free (header->spool);
@@ -1091,68 +1120,50 @@ _header_readline (mu_stream_t is, char *buffer, size_t buflen, size_t *pnread)
 static int
 header_write (mu_stream_t os, const char *buf, size_t buflen, size_t *pnwrite)
 {
-  struct _mu_header_stream *hstr;
+  struct _mu_header_stream *hstr = (struct _mu_header_stream *) os;
   mu_header_t header;
-  int status;
-  mu_off_t mstream_size;
+  int rc;
   
-  if (!os || !buf)
+  if (os == NULL)
     return EINVAL;
-
-  hstr = (struct _mu_header_stream *) os;
   header = hstr->hdr;
-  if (header == NULL)
-    return EINVAL;
-  
-  /* Skip the obvious.  */
-  if (*buf == '\0' || buflen == 0)
-    {
-      if (pnwrite)
-        *pnwrite = 0;
-      return 0;
-    }
-
-  if (!header->mstream)
+  if (!(header->flags & HEADER_STREAMMOD))
     {
-      status = mu_memory_stream_create (&header->mstream, MU_STREAM_RDWR);
-      if (status)
-	return status;
-    }
-
-  status = mu_stream_write (header->mstream, buf, buflen, NULL);
-  if (status)
-    {
-      mu_stream_destroy (&header->mstream);
-      return status;
-    }
-
-  status = mu_stream_size (header->mstream, &mstream_size);
-  if (status == 0 && mstream_size > 1)
-    {
-      char nlbuf[2];
+      struct mu_hdrent *ent;
+	
+      rc = mu_header_fill (header);
+      if (rc)
+	return rc;
 
-      status = mu_stream_seek (header->mstream, -2, MU_SEEK_END, NULL);
-      if (status == 0)
-	status = mu_stream_read (header->mstream, nlbuf, 2, NULL);
-      if (status == 0 && memcmp (nlbuf, "\n\n", 2) == 0)
+      if (!header->mstream)
 	{
-	  char *blurb;
-
-	  blurb = calloc (1, mstream_size + 1);
-	  if (blurb)
-	    {
-	      mu_stream_read (header->mstream, blurb, mstream_size, NULL);
-	      status = header_parse (header, blurb, mstream_size);
-	    }
-	  free (blurb);
-	  mu_stream_destroy (&header->mstream);
+	  rc = mu_memory_stream_create (&header->mstream, MU_STREAM_RDWR);
+	  if (rc)
+	    return rc;
 	}
+      mu_stream_seek (header->mstream, 0, MU_SEEK_SET, NULL);
+      if (header->spool_used)
+	{
+	  for (ent = header->head; ent; ent = ent->next)
+	    mu_hdrent_fixup (header, ent);
+	  rc = mu_stream_write (header->mstream, header->spool,
+				header->spool_used, NULL);
+	  for (ent = header->head; ent; ent = ent->next)
+	    mu_hdrent_unroll_fixup (header, ent);
+	  if (rc)
+	    return rc;
+	  mu_stream_truncate (header->mstream, header->spool_used);
+	  if (hstr->off > header->spool_used)
+	    hstr->off = header->spool_used;
+	}
+      header->flags |= HEADER_STREAMMOD;
     }
+
+  rc = mu_stream_seek (header->mstream, hstr->off, MU_SEEK_SET, NULL);
+  if (rc)
+    return rc;
   
-  if (pnwrite)
-    *pnwrite = buflen;
-  
-  return status;
+  return mu_stream_write (header->mstream, buf, buflen, pnwrite);
 }
 
 static int


hooks/post-receive
-- 
GNU Mailutils


