commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. release-2.2-812-gfd19deb


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-812-gfd19deb
Date: Sat, 5 Nov 2016 18:27:15 +0000 (UTC)

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=fd19deb4391f18e1a752ae5cfe4a9d3155e97705

The branch, master has been updated
       via  fd19deb4391f18e1a752ae5cfe4a9d3155e97705 (commit)
       via  e8f82804806e94f9b6e4fc072d785e29ea099827 (commit)
       via  c8ae650738984896d1893bb570868f717410444d (commit)
      from  af20212718728b315449ff35685772302883fc3d (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 fd19deb4391f18e1a752ae5cfe4a9d3155e97705
Author: Sergey Poznyakoff <address@hidden>
Date:   Sat Nov 5 20:18:05 2016 +0200

    Fix option sorting.
    
    * libmailutils/opt/opt.c (sort_group): Don't assume stability of the sort.
    Use auxiliary data structure to sort array of options that contain aliases.
    * libmailutils/tests/parseopt.c (set_prog_args): Fix delimiter.
    * libmailutils/tests/strtoc.c (v_cidr_format): Error checking.
    * maidag/Makefile.am (maidag_LDADD): Reorder libraries to make sure maidag
    uses freshly built libraries (not the ones already installed in the system).
    * mh/pick.c (options): Bugfix.

commit e8f82804806e94f9b6e4fc072d785e29ea099827
Author: Sergey Poznyakoff <address@hidden>
Date:   Sat Nov 5 12:07:39 2016 +0200

    Add missing documentation

commit c8ae650738984896d1893bb570868f717410444d
Author: Sergey Poznyakoff <address@hidden>
Date:   Sat Nov 5 12:07:24 2016 +0200

    Minor changes

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

Summary of changes:
 doc/texinfo/mailutils.texi    |   44 ++-
 doc/texinfo/programs.texi     |  690 ++++++++++++++++++++++++++++++-----------
 doc/texinfo/sieve.texi        |   14 +-
 gint                          |    2 +-
 libmailutils/opt/opt.c        |   76 ++++-
 libmailutils/tests/parseopt.c |    2 +-
 libmailutils/tests/strtoc.c   |   18 +-
 libmu_scm/mu_mailbox.c        |   18 +-
 libmu_scm/mu_scm.c            |    1 +
 maidag/Makefile.am            |    8 +-
 mail/send.c                   |    2 +-
 mh/pick.c                     |    2 +-
 scheme/guimb.scmi             |   20 +-
 13 files changed, 655 insertions(+), 242 deletions(-)

diff --git a/doc/texinfo/mailutils.texi b/doc/texinfo/mailutils.texi
index 636b973..0da2fab 100644
--- a/doc/texinfo/mailutils.texi
+++ b/doc/texinfo/mailutils.texi
@@ -119,6 +119,13 @@ Introduction
 * Book Contents::               What this Book Contains
 * History::                     A bit of History
 
+Mailbox
+
+* Local Mailboxes::      Mailboxes stored on the local file system.
+* Remote Mailboxes::     Mailboxes stored on remote hosts.
+* SMTP Mailboxes::       Mailboxes that send mail.
+* Program Mailboxes::
+
 Mailutils Programs
 
 * command line::      Command Line Syntax.  
@@ -154,7 +161,9 @@ Command Line
 Mailutils Configuration File
 
 * conf-syntax::         Configuration File Syntax
+* Variables::           Variable Expansion
 * include::             Include Statement
+* program statement::
 * logging statement::
 * debug statement::
 * mailbox statement::
@@ -207,6 +216,7 @@ Composing Mail
 * Modifying the Headers::
 * Enclosing Another Message::
 * Adding a File to the Message::
+* Attaching a File to the Message::
 * Printing And Saving the Message::
 * Signing the Message::
 * Printing Another Message::
@@ -247,7 +257,7 @@ Reading Mail
 @command{sieve}
 
 * sieve interpreter::   A Sieve Interpreter
-* sieve.scm::           A Sieve to Scheme Translator and Filter
+* sieve2scm::           A Sieve to Scheme Translator and Filter
 
 A Sieve Interpreter
 
@@ -327,24 +337,24 @@ Major differences between Mailutils MH and other MH 
implementations
 * Profile Variable Diffs::
 * Program Diffs::
 
-MU
+mailutils
 
 * mailutils invocation syntax::
-* mailutils help::
-* mailutils info::
-* mailutils cflags::
-* mailutils ldflags::
-* mailutils query::
-* mailutils 2047::
-* mailutils filter::
-* mailutils acl::
-* mailutils wicket::
-* mailutils dbm::
-* mailutils logger::
-* mailutils pop::
-* mailutils imap::
-* mailutils send::
-* mailutils smtp::
+* mailutils help::                Display a terse help summary.
+* mailutils info::                Show Mailutils configuration.
+* mailutils cflags::              Show compiler options.
+* mailutils ldflags::             List libraries required to link.
+* mailutils query::               Query configuration values.
+* mailutils 2047::                Decode/encode email message headers.
+* mailutils filter::              Apply a chain of filters to the input.
+* mailutils acl::                 Test access control lists.
+* mailutils wicket::              Scan wickets for matching URLs.
+* mailutils dbm::                 DBM management tool.
+* mailutils logger::              Log data using Mailutils log facility.
+* mailutils pop::                 POP3 client shell.
+* mailutils imap::                IMAP4 client shell.
+* mailutils send::                Send a message.
+* mailutils smtp::                Run a SMTP session.
 
 mailutils dbm
 
diff --git a/doc/texinfo/programs.texi b/doc/texinfo/programs.texi
index d116fcc..2e4db32 100644
--- a/doc/texinfo/programs.texi
+++ b/doc/texinfo/programs.texi
@@ -5571,7 +5571,7 @@ utilities in detail.
 
 @menu
 * sieve interpreter::   A Sieve Interpreter
-* sieve.scm::           A Sieve to Scheme Translator and Filter
+* sieve2scm::           A Sieve to Scheme Translator and Filter
 @end menu
 
 @node sieve interpreter
@@ -5663,10 +5663,22 @@ Keep on going if execution fails on a message.  See also
 Append directory @var{dir} to the list of directories searched for
 library files.  See also @ref{Sieve Configuration, library-path}.
 
address@hidden address@hidden
+Add @var{dir} to the beginning of the list of directories searched for
+library files.
+
address@hidden -M @var{url}
address@hidden address@hidden
+Define the URL of the default mailer.
+
 @item -n
 @itemx --no-actions
address@hidden --dry-run
 Dry run: do not execute any actions, just print what would be done.
 
address@hidden --no-program-name
+Do not prefix diagnostic messages with the program name.
+
 @item -t @var{ticket}
 @itemx address@hidden
 Ticket file for mailbox authentication.  See also
@@ -5677,6 +5689,8 @@ Ticket file for mailbox authentication.  See also
 Log all actions executed.  See also @ref{Sieve Configuration, verbose}.
 @end table
 
+See also @ref{Common Options}.
+
 @node Sieve Configuration
 @subsubsection Sieve Configuration
 
@@ -5685,12 +5699,12 @@ configuration statements:
 
 @multitable @columnfractions 0.3 0.6
 @headitem Statement @tab Reference
address@hidden debug         @tab @xref{Debug Statement}.
address@hidden tls           @tab @xref{TLS Statement}.
address@hidden mailbox       @tab @xref{Mailbox Statement}.
address@hidden locking       @tab @xref{Locking Statement}.
address@hidden logging       @tab @xref{Logging Statement}.
address@hidden mailer        @tab @xref{Mailer Statement}.
address@hidden debug         @tab @xref{debug statement}.
address@hidden tls           @tab @xref{tls statement}.
address@hidden mailbox       @tab @xref{mailbox statement}.
address@hidden locking       @tab @xref{locking statement}.
address@hidden logging       @tab @xref{logging statement}.
address@hidden mailer        @tab @xref{mailer statement}.
 @end multitable
 
 The following statements configure sieve-specific features:
@@ -5698,38 +5712,33 @@ The following statements configure sieve-specific 
features:
 @deffn {Sieve Conf} sieve @{ ...  @}
 This block statement configures search paths @command{sieve} uses to
 locate its loadable modules.  @xref{Require Statement}, for a detailed
-information of this feature.
+information about loadable modules.
 
 This statement may contain the following sub-statements:
address@hidden, @code{clear-include-path},
address@hidden, @code{include-path}, which are described below.
address@hidden deffn
 
 @deffn {Sieve Conf} clear-library-path @var{bool}
-Used within the @code{sieve} block statement.
-
 If @var{bool} is @samp{true}, clear library search path.
 @end deffn
 
 @deffn {Sieve Conf} clear-include-path @var{bool}
-Used within the @code{sieve} block statement.
-
 If @var{bool} is @samp{true}, clear include search path.
 @end deffn
 
 @deffn {Sieve Conf} library-path @var{path}
-Used within the @code{sieve} block statement.
-
 Add directories to @command{sieve} library search path.  Argument is a
 string containing a colon-separated list of directories.
 @end deffn
 
address@hidden {Sieve Conf} include-path @var{path}
-Used within the @code{sieve} block statement.
address@hidden {Sieve Conf} library-path-prefix @var{path}
+Add directories to the beginning if the library search path.  Argument
+is a string containing a colon-separated list of directories.
address@hidden deffn
 
address@hidden {Sieve Conf} include-path @var{path}
 Add directories to the include search path.  Argument is a
 string containing a colon-separated list of directories.
 @end deffn
address@hidden deffn
 
 @deffn {Sieve Conf} keep-going @var{bool}
 If @var{bool} is @samp{true}, do not abort if execution of a Sieve
@@ -5781,21 +5790,21 @@ debugging level to be enabled.  The argument can 
consist of the
 following letters:
 
 @table @samp
address@hidden @samp{t}
address@hidden t
 This flag enables sieve tracing.  It means that every test will be logged
 when executed.
 
address@hidden @samp{T}
address@hidden T
 This flag enables debugging of underlying @code{mailutils} library.
 
address@hidden @samp{P}
address@hidden P
 Trace network protocols: produces log of network transactions executed
 while running the script.
 
address@hidden @samp{g}
address@hidden g
 Enable main parser traces.  This is useful for debugging the sieve grammar.
 
address@hidden @samp{i}
address@hidden i
 Trace the program instructions.  It is the most extensive debugging
 level.  It produces the full execution log of a sieve program, showing
 each instruction and states of the sieve machine.  It is only useful
@@ -5813,7 +5822,7 @@ If the argument to @option{--debug} is omitted, it 
defaults to
 Option @option{--dump} produces the disassembled dump of the compiled
 sieve program. 
 
-By default @command{sieve} output all diagnostics on standard error and verbose
+By default @command{sieve} outputs all diagnostics on standard error and 
verbose
 logs on standard output.  This behaviour is changed when
 @option{--log-facility} is given in the command line (@FIXME-pxref{logging}).
 This option causes @command{sieve} to output its diagnostics to
@@ -5823,7 +5832,7 @@ the given syslog facility.
 @subsubsection Extending @command{sieve}
 
 The basic set of sieve actions, tests and comparators may be extended
-using loadable extensions.  Usual @code{require} mechanism is used for
+using loadable extensions.  The usual @code{require} mechanism is used for
 that.
 
 When processing arguments for @code{require} statement, @command{sieve}
@@ -5832,7 +5841,7 @@ uses the following algorithm:
 @enumerate 1
 @item Look up the name in a symbol table.  If the name begins with
 @samp{comparator-} it is looked up in the comparator table.  If it
-begins with @samp{test-}, the test table is used instead.  Otherwise
+begins with @samp{test-}, the test table is searched instead.  Otherwise
 the name is looked up in the action table.
 
 @item If the name is found, the search is terminated.
@@ -5852,12 +5861,17 @@ following search paths (in the order given):
 
 @item The value of the environment variable @env{LTDL_LIBRARY_PATH}.
 
address@hidden Additional search directories specified with the.
address@hidden command line option (@pxref{Invoking Sieve,
+libdir-prefix}), or the @code{library-path-prefix} configuration
+statement (@pxref{Sieve Configuration,library-path-prefix}).
+
 @item Additional search directories specified with the
 @code{library-path} statement (@pxref{Sieve Configuration,
 library-path}) in Sieve configuration file.
 
 @item Additional search directories specified with the.
address@hidden command line option (@FIXME-pxref{libdir}).
address@hidden command line option (@pxref{Invoking Sieve,libdir}).
 
 @item Additional search directories specified with the
 @code{#searchpath} Sieve directive (@pxref{#searchpath}).
@@ -5900,11 +5914,11 @@ source for the required action NAME is not available
 @c ***********************************************************************
 
 @page
address@hidden sieve.scm
address@hidden sieve2scm
 @subsection A Sieve to Scheme Translator and Filter
 @UNREVISED
 
-A Sieve to Scheme Translator @command{sieve.scm} translates a given
+A Sieve to Scheme Translator @command{sieve2scm} translates a given
 Sieve script into an equivalent Scheme program and optionally executes
 it.  The program itself is written in Scheme and requires presence of
 Guile version 1.8 or newer on the system.  For more information on
@@ -5928,7 +5942,7 @@ Set sieve library directory name
 Set debugging level
 @end table            
 
-The Scheme programs produced by @command{sieve.scm} can be used with
+The Scheme programs produced by @command{sieve2scm} can be used with
 @command{guimb} or @command{maidag}.
 
 @c ***********************************************************************
@@ -5937,22 +5951,64 @@ The Scheme programs produced by @command{sieve.scm} can 
be used with
 @node guimb
 @section @command{guimb} --- A Mailbox Scanning and Processing Language
 @pindex guimb
address@hidden
 
address@hidden is for mailboxes what @command{awk} is for text files.
-It processes mailboxes, applying the user-supplied scheme procedures
-to each of them in turn and saves the resulting output in mailbox
-format.
address@hidden is an experimental tool that iterates over messages in
+a mailbox (or several mailboxes), applying a Scheme function to each
+of them.
 
-The following configuration statements affect the behavior of
address@hidden:
+A user-defined @dfn{scheme module} that supplies the function to apply
+is specified using the @option{--source} or @option{--file} option.
+The module must define at least the following function:
 
address@hidden @columnfractions 0.3 0.6
address@hidden Statement @tab Reference
address@hidden debug         @tab @xref{Debug Statement}.
address@hidden mailbox       @tab @xref{Mailbox Statement}.
address@hidden locking       @tab @xref{Locking Statement}.
address@hidden multitable
address@hidden {User function} guimb-message @var{msg}
+Processes message @var{msg}.  This function can alter the message
+using Guile primitives supplied by mailutils.
address@hidden deffn
+
+The following function definitions are optional:
+
address@hidden {User function} guimb-getopt @var{args}
+If defined, this function is called after @command{guimb} has finished
+processing the command line.  @var{args} is a list of unconsumed
+command line arguments.
+
+The function is intended to provide a way of configuring the module
+from the command line.
address@hidden deffn
+
address@hidden {User function} guimb-end
+If defined, this function is called after all mailboxes have been processed.
address@hidden deffn
+
+In the following example we define a module that prints
+information about each message is the input mailbox, in a way similar
+to @code{frm} utility:
+
address@hidden
address@hidden
+(define-module (frm)
+  :export (guimb-message))
+
+(use-modules (mailutils mailutils))
+             
+(define (guimb-message msg)
+  (display (mu-message-get-sender msg))
+  (display " ")
+  (display (mu-message-get-header msg "subject"))
+  (newline))
address@hidden group
address@hidden example
+
+The modules are looked up in directories listed in the global variable
address@hidden  New directories can be added to that variable on
+the fly using the @option{-L} (@option{--load-path}) option.  For
+example, if the sample module above was saved in a file
address@hidden somewhere in the load path, it can be applied to the
+current user inbox by running the following command:
+
address@hidden
+guimb --file frm
address@hidden example
 
 @menu
 * Specifying Scheme Program to Execute::
@@ -5964,37 +6020,35 @@ The following configuration statements affect the 
behavior of
 @node Specifying Scheme Program to Execute
 @subheading Specifying Scheme Program to Execute
 
-The Scheme program or expression to be executed is passed to
address@hidden via the following options:
+The Scheme module that defines message processing functions is given
+via the following options:
 
 @table @option
address@hidden -s @var{file}
address@hidden --source @var{file}
-Load Scheme source code from @var{file}.
address@hidden -c @var{expr}
address@hidden --code @var{expr}
-Execute given scheme expression.
address@hidden -s @var{module}
address@hidden --source @var{module}
+Load Scheme code from @var{module}.
+
+This option stops further argument processing, and passes all
+remaining arguments as the value of @var{args} argument to the
address@hidden function, if it is defined.
+
address@hidden -f @var{module}
address@hidden --file @var{module}
+Load Scheme source code from @var{module}.  The remaining arguments
+are processed in the usual way.  When using this option, you can pass
+additional options and or arguments to the module by enclosing them in
address@hidden@{} and @address@hidden options (@pxref{Passing Options to 
Scheme}).
 @end table
 
-The above switches stop further argument processing, and pass all
-remaining arguments as the value of @code{(command-line)}.
-
-If the remaining arguments must be processed by @command{guimb} itself,
-use following options:
+An experimental option is provided, that evaluates a supplied
+Scheme expression right after loading the module:
 
 @table @option
 @item -e @var{expr}
 @itemx --expression @var{expr}
-Execute scheme expression.
address@hidden -f @var{file}
address@hidden --file @var{file}
-Load Scheme source code from @var{file}.
+Evaluate scheme expression.
 @end table
 
-You can specify both of them.  In this case, the @var{file} is read
-first, then @var{expr} is executed.  You may still pass any additional
-arguments to the script using @option{--guile-arg} option.
-
 @node Specifying Mailboxes to Operate Upon
 @subheading Specifying Mailboxes to Operate Upon
 
@@ -6012,8 +6066,8 @@ The contents of specified mailboxes is processed, and the 
resulting
 mailbox contents is appended to @var{defmbox}.
 @item guimb address@hidden --user @var{username} address@hidden
 The contents of specified mailboxes is processed, and the resulting
-mailbox contents is appended to the user's system mailbox.  This allows
-to use @command{guimb} as a mail delivery agent.
+mailbox contents is appended to the user's system mailbox.  This makes
+it possible to use @command{guimb} as a mail delivery agent.
 @end table
 
 If no mailboxes are specified in the command line, @command{guimb} reads
@@ -6025,12 +6079,13 @@ and processes the system mailbox of the current user.
 Sometimes it is necessary to pass some command line options to the
 scheme procedure.  There are three ways of doing so.
 
-When using @option{--source} (@option{-s}) or @option{--code}
-(@option{-c}) options, all the rest of the command line following
-the option's argument is passed to Scheme program verbatim.  This
-allows for making guimb scripts executable by the shell.  If your system
-supports @samp{#!} magic at the start of scripts, add the following two
-lines to the beginning of your script to allow for its immediate execution:
+When using @option{--source} (@option{-s}) option, the rest of the
+command line following the option's argument is passed as the
address@hidden argument to the @code{guimb-getopt} function, if such
+function is defined.  This allows for making guimb scripts executable
+by the shell.  If your system supports @samp{#!} magic at the start of
+scripts, add the following two lines to the beginning of your script
+to allow for its immediate execution: 
 
 @example
 #! /usr/local/bin/guimb -s
@@ -6040,18 +6095,19 @@ lines to the beginning of your script to allow for its 
immediate execution:
 @noindent
 (replace @samp{/usr/local/bin/} with the actual path to the @command{guimb}).
 
-Otherwise, if you use @option{--file} or @option{--expression} options,
-the additional arguments may be passed to the Scheme program @option{-g}
+Otherwise, if you use the @option{--file} option, the additional
+arguments can be passed to the Scheme program @option{-g} 
 (@option{--guile-arg}) command line option.  For example:
 
 @example
 guimb --guile-arg -opt --guile-arg 24 --file @var{progfile}
 @end example
 
-In this example, the scheme procedure will see the following command line:
+In this example, the @code{guimb-getopt} function will get the
+following argument
 
 @example
address@hidden -opt 24
+( '-opt' 24 )
 @end example
 
 Finally, if there are many arguments to be passed to Scheme, it is more
@@ -6074,6 +6130,11 @@ Start with debugging evaluator and backtraces.
 @item -e @var{expr}
 @itemx --expression @var{expr}
 Execute given Scheme expression.
address@hidden -L @var{dir}
address@hidden --load-path @var{dir}
+Insert @var{dir} at the beginning of the @code{%load-path} list.  The
+argument is either a single directory name, or a list of such names,
+delimited by @samp{:} characters.
 @item -m @var{path}
 @itemx address@hidden
 Set path to the mailspool directory
@@ -6111,8 +6172,8 @@ is a general-purpose @acronym{MDA} offering a rich set of
 features.  It can operate both in traditional mode, reading the message
 from its standard input, and in @acronym{LMTP} mode.  @command{Maidag}
 is able to deliver mail to any mailbox format, supported by GNU
-Mailutils.  These formats, among others, include @samp{remote+smtp},
address@hidden and @samp{remote+sendmail} which are
+Mailutils.  These formats, among others, include @samp{smtp://},
address@hidden://} and @samp{sendmail://} which are
 equivalent to forwarding a message over @acronym{SMTP} to a remote
 node.  Thus, @command{maidag} supersedes both @command{mail.local} and
 @command{mail.remote} utilities from GNU Mailutils versions prior to
@@ -6203,7 +6264,7 @@ maidag:
 MeTA1 (@uref{http://meta1.org}) communicates with the delivery agent
 using @acronym{LMTP}.
 
-LMTP mode is enabled in @command{maidag} by the @samp{lmpt yes}
+LMTP mode is enabled in @command{maidag} by the @samp{lmtp yes}
 statement.  The socket to listen on must be specified using
 @code{server} statement (@pxref{Server Settings}).  For the purposes of
 this section, let's suppose @command{maidag} will listen on a
@@ -6411,7 +6472,7 @@ Expands to the recipient home directory.
 Expands to the recipient user name.
 @end table
 
-By default, a filename extension decide which scripting language will
+By default, the filename extension decides which scripting language will
 be used.  User can alter the choice using @samp{language} configuration
 statement.  For example:
 
@@ -6592,25 +6653,25 @@ $ maidag --url maildir:///home/smith/Mail
 @node Remote Mailbox Delivery
 @subsection Remote Mailbox Delivery
 @command{Maidag} can be used to deliver mail to remote mailboxes, such
-as @samp{imap} or @samp{remote+smtp}.  If the mailbox @acronym{URL}
-is @samp{remote+smtp} or @samp{remote+sendmail}, the message is
+as @samp{imap} or @samp{smtp}.  If the mailbox @acronym{URL}
+is @samp{smtp} or @samp{sendmail}, the message is
 actually forwarded over @acronym{SMTP} to the remote node, so
 @command{maidag} acts as a message transfer agent.  For example:
 
 @example
-$ maidag --url remote+smtp://10.10.1.100:24
+$ maidag --url smtp://10.10.1.100:24
 @end example
 
 This command line will send the message to the machine
 @samp{10.10.1.100} using port @samp{24} (private mail system).
 
-The @samp{remote+prog} mailbox may be of special use.  Delivering to
+The @samp{prog} mailbox may be of special use.  Delivering to
 this mailbox results in invoking the specified command with the given
 arguments and passing the message to its standard input.  There are two
-ways to specify a @samp{remote+prog} mailbox:
+ways to specify a @samp{prog} mailbox:
 
 @table @asis
address@hidden remote+prog://@address@hidden
address@hidden prog://@address@hidden
 Here, @var{program} is the absolute pathname of the program binary,
 and @var{args} are its arguments, separated by @samp{&} signs.
 
@@ -6621,7 +6682,7 @@ white space.
 
 In both cases, @var{args} do not include @code{argv[0]}.
 
-The @samp{remote+prog} mailbox may be used, in particular, to implement
+The @samp{prog} mailbox may be used, in particular, to implement
 mailing lists with MeTA1.
 
 For example, suppose that the @command{maidag} configuration contains:
@@ -6672,20 +6733,20 @@ statements:
 
 @multitable @columnfractions 0.3 0.6
 @headitem Statement @tab Reference
address@hidden debug         @tab @xref{Debug Statement}.
address@hidden mailbox       @tab @xref{Mailbox Statement}.
address@hidden locking       @tab @xref{Locking Statement}.
address@hidden pam           @tab @xref{PAM Statement}.
address@hidden sql           @tab @xref{SQL Statement}.
address@hidden virtdomain    @tab @xref{Virtdomain Statement}.
address@hidden radius        @tab @xref{Radius Statement}.
address@hidden ldap          @tab @xref{LDAP Statement}.
address@hidden auth          @tab @xref{Auth Statement}.
address@hidden mailer        @tab @xref{Mailer Statement}.
address@hidden debug         @tab @xref{debug statement}.
address@hidden mailbox       @tab @xref{mailbox statement}.
address@hidden locking       @tab @xref{locking statement}.
address@hidden pam           @tab @xref{pam statement}.
address@hidden sql           @tab @xref{sql statement}.
address@hidden virtdomain    @tab @xref{virtdomain statement}.
address@hidden radius        @tab @xref{radius statement}.
address@hidden ldap          @tab @xref{ldap statement}.
address@hidden auth          @tab @xref{auth statement}.
address@hidden mailer        @tab @xref{mailer statement}.
 @item server        @tab @xref{Server Settings}.  Used only in
 @acronym{LMTP} mode.
address@hidden acl           @tab @xref{ACL Statement}.
address@hidden tcp-wrappers  @tab @xref{Tcp-wrappers Statement}.
address@hidden acl           @tab @xref{acl statement}.
address@hidden tcp-wrappers  @tab @xref{tcp-wrappers statement}.
 @end multitable
 
 @deffn {Maidag Config} ex-multiple-delivery-success @var{bool}
@@ -6940,7 +7001,6 @@ Use @var{program} to display files.
 @node pop3d
 @section POP3 Daemon
 @pindex pop3d
address@hidden
 
 The @command{pop3d} daemon implements the Post Office Protocol
 Version 3 server.
@@ -7134,20 +7194,20 @@ The following configuration file statements affect the 
behavior of
 
 @multitable @columnfractions 0.3 0.6
 @headitem Statement @tab Reference
address@hidden debug         @tab @xref{Debug Statement}.
address@hidden tls           @tab @xref{TLS Statement}.
address@hidden mailbox       @tab @xref{Mailbox Statement}.
address@hidden locking       @tab @xref{Locking Statement}.
address@hidden logging       @tab @xref{Logging Statement}.
address@hidden pam           @tab @xref{PAM Statement}.
address@hidden sql           @tab @xref{SQL Statement}.
address@hidden virtdomain    @tab @xref{Virtdomain Statement}.
address@hidden radius        @tab @xref{Radius Statement}.
address@hidden ldap          @tab @xref{LDAP Statement}.
address@hidden auth          @tab @xref{Auth Statement}.
address@hidden debug         @tab @xref{debug statement}.
address@hidden tls           @tab @xref{tls statement}.
address@hidden mailbox       @tab @xref{mailbox statement}.
address@hidden locking       @tab @xref{locking statement}.
address@hidden logging       @tab @xref{logging statement}.
address@hidden pam           @tab @xref{pam statement}.
address@hidden sql           @tab @xref{sql statement}.
address@hidden virtdomain    @tab @xref{virtdomain statement}.
address@hidden radius        @tab @xref{radius statement}.
address@hidden ldap          @tab @xref{ldap statement}.
address@hidden auth          @tab @xref{auth statement}.
 @item server        @tab @xref{Server Settings}.
address@hidden acl           @tab @xref{ACL Statement}.
address@hidden tcp-wrappers  @tab @xref{Tcp-wrappers Statement}.
address@hidden acl           @tab @xref{acl statement}.
address@hidden tcp-wrappers  @tab @xref{tcp-wrappers statement}.
 @end multitable
 
 @deffn {Pop3d Conf} undelete @var{bool}
@@ -7207,26 +7267,15 @@ it defaults to 10 processes.
 @itemx --inetd
 Run in inetd mode.
 
address@hidden -h
address@hidden --help
-Display short help message and exit.
-
 @item --foreground
 Remain in foreground.
-
address@hidden address@hidden
-Enable TLS.  If optional argument is supplied and is @samp{false}, then
-disable it.
-
address@hidden --debug-auth
-Enable debugging of authentication functions.
 @end table
 
+The Mailutils common options are also understood.  @xref{Common Options}.
 @page
 @node imap4d
 @section IMAP4 Daemon
 @pindex imap4d
address@hidden
 
 GNU @command{imap4d} is a daemon implementing @sc{imap4} rev1 protocol
 for accessing and handling electronic mail messages on a server.  It can
@@ -7341,20 +7390,20 @@ configuration statements:
 
 @multitable @columnfractions 0.3 0.6
 @headitem Statement @tab Reference
address@hidden debug         @tab @xref{Debug Statement}.
address@hidden tls           @tab @xref{TLS Statement}.
address@hidden mailbox       @tab @xref{Mailbox Statement}.
address@hidden locking       @tab @xref{Locking Statement}.
address@hidden logging       @tab @xref{Logging Statement}.
address@hidden pam           @tab @xref{PAM Statement}.
address@hidden sql           @tab @xref{SQL Statement}.
address@hidden virtdomain    @tab @xref{Virtdomain Statement}.
address@hidden radius        @tab @xref{Radius Statement}.
address@hidden ldap          @tab @xref{LDAP Statement}.
address@hidden auth          @tab @xref{Auth Statement}.
address@hidden debug         @tab @xref{debug statement}.
address@hidden tls           @tab @xref{tls statement}.
address@hidden mailbox       @tab @xref{mailbox statement}.
address@hidden locking       @tab @xref{locking statement}.
address@hidden logging       @tab @xref{logging statement}.
address@hidden pam           @tab @xref{pam statement}.
address@hidden sql           @tab @xref{sql statement}.
address@hidden virtdomain    @tab @xref{virtdomain statement}.
address@hidden radius        @tab @xref{radius statement}.
address@hidden ldap          @tab @xref{ldap statement}.
address@hidden auth          @tab @xref{auth statement}.
 @item server        @tab @xref{Server Settings}.
address@hidden acl           @tab @xref{ACL Statement}.
address@hidden tcp-wrappers  @tab @xref{Tcp-wrappers Statement}.
address@hidden acl           @tab @xref{acl statement}.
address@hidden tcp-wrappers  @tab @xref{tcp-wrappers statement}.
 @end multitable
 
 @deffn {Imap4d Conf} shared-namespace @var{list}
@@ -7521,35 +7570,26 @@ it defaults to 20 processes.
 @emph{Please note}, that there should be no whitespace between the
 @option{-d} and its parameter.
 
address@hidden -h
address@hidden --help
-Display short help message and exit.
-
 @item -i
 @itemx --inetd
 Run in inetd mode.
+
 @item --foreground
 Run in foreground.
 
 @item --preauth
 Start in preauth mode
 
address@hidden address@hidden
-Enable TLS support
-
address@hidden --debug-auth
-Debug authentication functions.
-
address@hidden -v
address@hidden --version
-Display program version and exit.
address@hidden --test
+Run in test mode.
 @end table
 
+See also @ref{Common Options}.
+
 @page
 @node comsatd
 @section Comsat Daemon
 @pindex comsatd
address@hidden
 
 Comsatd is the server which receives reports of incoming mail and
 notifies users, wishing to get this service.  It can be started
@@ -7564,22 +7604,7 @@ either from @file{inetd.conf} or as a standalone daemon.
 @node Starting comsatd
 @subsection Starting @command{comsatd}
 
address@hidden uses following option groups: @FIXME-xref{mailbox},
address@hidden, @FIXME-xref{logging}.
-
 @table @option
address@hidden -C @var{file}
address@hidden address@hidden
-Convert the configuration file @var{file} to the new
-format.  @var{File} must be a @command{comsatd} configuration file in
-Mailutils v. 1.x format.  The converted file is printed on the standard
-output.  For example, the following command can be used to convert old
address@hidden configuration file to new format:
-
address@hidden
-$ comsatd --convert-config=/etc/comsatd.conf > /etc/mailutils.d/comsatd
address@hidden example
-
 @item -d
 @itemx --daemon
 Run as a standalone daemon.
@@ -7605,8 +7630,12 @@ mailbox, e.g.:
 $ comsatd --test /var/mail/root 34589
 @end example
 
address@hidden --foreground
+Don't detach from the controlling terminal, remain in foreground.
 @end table
 
+See also @ref{Common Options}.
+
 @node Configuring comsatd
 @subsection Configuring @command{comsatd}
 
@@ -7615,11 +7644,11 @@ Following configuration statements affect the behavior 
of
 
 @multitable @columnfractions 0.3 0.6
 @headitem Statement @tab Reference
address@hidden debug   @tab @xref{Debug Statement}.
address@hidden logging @tab @xref{Logging Statement}.
address@hidden mailbox @tab @xref{Mailbox Statement}.
address@hidden locking @tab @xref{Locking Statement}.
address@hidden acl     @tab @xref{ACL Statement}.
address@hidden debug   @tab @xref{debug statement}.
address@hidden logging @tab @xref{logging statement}.
address@hidden mailbox @tab @xref{mailbox statement}.
address@hidden locking @tab @xref{locking statement}.
address@hidden acl     @tab @xref{acl statement}.
 @end multitable
 
 @menu
@@ -7769,7 +7798,6 @@ $B(,5)\
 @page
 @node mh
 @section MH --- The MH Message Handling System
address@hidden
 
 @include mu-mh.texi
 
@@ -8839,14 +8867,320 @@ Shows command history.
 
 @node mailutils imap
 @subsection mailutils imap
-The @command{mailutils imap} command is reserved for an interactive IMAP4
-client shell.  It does not do much now (as of version @value{VERSION}.
+The @command{mailutils imap} command invokes an interactive IMAP4 client
+shell.  It reads commands from the standard input, executes them and
+displays the results on the standard output.  The shell is similar to
+the @command{mailutils pop} (@pxref{mailutils pop}) shell.
+
address@hidden IMAP protocol commands
+
+Most commands in this group correspond (with minor differences) to
+IMAP commands described in RFC address@hidden
address@hidden://www.faqs.org/rfcs/rfc3501.html}.}.
+
address@hidden {imap command} connect [-tls] @var{host} address@hidden
+Opens connection to the server @var{host}.  If the @option{-tls}
+option is given, TLS encryption (also known as IMAPS protocol) will be
+used.  If @var{port} argument is not supplied, the command uses port
+143 for a plain IMAP connection or 993 for IMAPS (if @option{-tls} is
+given).
address@hidden deffn
+
address@hidden {imap command} capability [-reread] address@hidden
+Lists server capabilities.  Any number of @var{name}s is accepted.  If
+at least one is given, the shell will display only the named
+capabilities, otherwise it displays the entire list.  By default,
address@hidden reuses the response of its previous invocation
+(if there was any), instead of resending the CAPABILITY command to the
+server.  To force it do so, use the @option{-reread} option. 
address@hidden deffn
+
address@hidden {imap command} starttls
+Starts TLS negotiation.  This command is valid only after unencrypted
+connection has been successfully initiated using connect without the
address@hidden option.
address@hidden deffn
+
address@hidden {imap command} login @var{user} address@hidden 
+Logs in to the server as @var{user} with optional @var{password}.  If
+the pass argument is omitted, the shell will ask you to enter it.
+While entering, both echoing and history recording will be disabled.
+Use this to avoid compromising your password.
address@hidden deffn
+
address@hidden {imap command} logout
address@hidden {imap command} quit
+Quits the imap session.
address@hidden deffn
+
address@hidden {imap command} id [-test @var{kw}] address@hidden
+Sends IMAP ID command.  See RFC
address@hidden@uref{http://www.faqs.org/rfcs/rfc2971.html}}, for a
+discussion of arguments.  By default, this command outputs entire ID
+list. If, however, the @option{-test} option is given, it will check whether
+the keyword @var{kw} is defined and display its value if so.  
address@hidden deffn
+
address@hidden {imap command} check
+Requests a server checkpoint.
address@hidden deffn
+
address@hidden {imap command} select address@hidden
+Selects the named mailbox. Without argument, selects @samp{INBOX}. 
address@hidden deffn
+
address@hidden {imap command} examine address@hidden
+Examines the named mailbox, i.e. selects it in read-only mode.  If
address@hidden is not given, @samp{INBOX} is assumed.
address@hidden deffn
+
address@hidden {imap command} status @var{mbox} @var{kw} address@hidden
+Gets mailbox status.  Valid keywords (@var{kw} arguments) are:
address@hidden, @samp{RECENT}, @samp{UIDNEXT}, @samp{UIDVALIDITY},
+and @samp{UNSEEN}.  Keywords are case-insensitive. 
address@hidden deffn
+
address@hidden {imap command} fetch @var{msgset} @var{items}
+Fetches message data.  See RFC 3501, section
address@hidden@uref{http://tools.ietf.org/html/rfc3501#section-6.4.5}},
+for a discussion of its arguments.
address@hidden deffn
+
address@hidden {imap command} store @var{msgset} @var{items}
+Alters mailbox data.  See RFC 3501, section
address@hidden@uref{http://tools.ietf.org/html/rfc3501#section-6.4.6}},
+for a discussion of its arguments. 
address@hidden deffn
+
address@hidden {imap command} close
+Closes the currently selected mailbox (with expunge). 
address@hidden deffn
+
address@hidden {imap command} unselect
+Closes the currently selected mailbox (without expunge). 
address@hidden deffn
+
address@hidden {imap command} delete @var{mbox}
+Deletes the mailbox @var{mbox}. 
address@hidden deffn
+
address@hidden {imap command} rename @var{old-name} @var{new-name}
+Renames existing mailbox @var{old-name} to @var{new-name}.
address@hidden deffn
+
address@hidden {imap command} expunge
+Permanently removes messages marked for deletion. 
address@hidden deffn
+
address@hidden {imap command} create @var{name}
+Creates new mailbox with the given @var{name}.
address@hidden deffn
+
address@hidden {imap command} append [-time @var{datetime}] [-flag @var{flag}] 
@var{mailbox} @var{file}
+Reads an RFC-822 message from @var{file} and appends it to the
address@hidden  Use the @option{-time} option to supply envelope date
+for the message.  Use the @option{-flag} option to supply message
+flags.  For example:  
+
address@hidden
+append -time "25-Aug-2002 18:00:00 +0200" -flag \Seen INBOX input.msg
address@hidden example
address@hidden deffn
+
address@hidden {imap command} list @var{ref} @var{mbox}
+Lists matching mailboxes.  See RFC 3501, section
address@hidden@uref{http://tools.ietf.org/html/rfc3501#section-6.3.8}},
+for a discussion of its arguments.
address@hidden deffn
+
address@hidden {imap command} lsub @var{ref} @var{mbox}
+Lists subscribed mailboxes (RFC 3501, section 
address@hidden@uref{http://tools.ietf.org/html/rfc3501#section-6.3.9}}). 
address@hidden deffn
+
address@hidden {imap command} subscribe @var{mbox}
+Subscribes to a mailbox. 
address@hidden deffn
+
address@hidden {imap command} unsubscribe @var{mbox}
+Removes mailbox @var{mbox} from the subscription list. 
address@hidden deffn
+
address@hidden {imap command} noop
+Sends a @dfn{no operation} command. 
address@hidden deffn
+
address@hidden {imap command} disconnect
+Closes existing connection. 
address@hidden deffn
+
address@hidden Internal commands
+The @code{imap} shell implements the same set of internal commands as
address@hidden shell: @xref{mailutils pop, Internal commands}.  There is
+only one imap-specific internal command:
+
address@hidden {imap command} uid [on|off]
+Controls the UID mode.  When the UID mode is on, the commands
address@hidden and @code{store} operate on and return message UIDs
+instead of their sequence numbers.  
+
+To examine the current state of the UID mode, issue the @code{uid}
+command without arguments.
address@hidden deffn
 
 @node mailutils send
 @subsection mailutils send
address@hidden
+Reads an RFC-822 message from a file and sends it over to a specified
+SMTP server.  The syntax is: 
+
address@hidden
+mailutils send address@hidden @var{host} @var{file}
address@hidden example
+
address@hidden
+where @var{host} defines the SMTP server through which to send the
+message, and @var{file} is the name of the input file containing the
+message.  For example, to send a message from file @file{input.msg}
+using SMTP service at localhost, one would write:
+
address@hidden
+$ mailutils send localhost input.msg
address@hidden example
+
+The @var{host} argument can be an IP address, hostname, or a
+valid SMTP URL. 
+
+The following command line options are understood:
 
address@hidden @option
address@hidden -F @var{address}
address@hidden address@hidden
+Supplies envelope sender address.
+
address@hidden -T @var{address}
address@hidden address@hidden
+Supplies envelope recipient address.  It can be specified multiple
+times.
+
address@hidden -t
address@hidden --read-recipients
+Instructs the program to read recipient email addresses from the
+message @samp{To:}, @samp{Cc:}, and @samp{Bcc:} headers.
address@hidden table
+    
 @node mailutils smtp
 @subsection mailutils smtp
address@hidden
+The @code{mailutils smtp} command invokes an interactive SMTP client
+shell.  It reads commands from the standard input, executes them and
+displays the results on the standard output.  If the standard input is
+connected to a terminal, the readline and history facilities are
+enabled (provided that Mailutils is configured with GNU Readline).
+
address@hidden Initializing connection
+
address@hidden {smtp command} connect [-tls] @var{host} address@hidden
+Connects to SMTP server at @var{host} (IP address or host name).  If
+the @option{-tls} option is given, TLS encryption (also known as SMTPS
+protocol) will be used.  The default port number is 25 for plain SMTP
+and 465 for SMTPS.  Explicit @var{port} argument overrides the default
+value.  
address@hidden deffn
+
address@hidden Connection parameters
+
+A number of parameters is associated with an open connection:
+
address@hidden @asis
address@hidden domain
+Domain name used in EHLO statement.  Defaults to the current host name. 
address@hidden table
+
+The following parameters are used for ESMTP authentication:
+
address@hidden @asis
address@hidden username
+User name. 
address@hidden password
+User password. 
address@hidden service
+GSASL service name. 
address@hidden realm
+Realm name. 
address@hidden host
+Host name.
address@hidden url
+SMTP URL.  It can contain all of the above. Default is smtp:// 
address@hidden table
+
+These parameters are manipulated using the following statements:
+
address@hidden {smtp command} set @var{param} @var{value} address@hidden 
@var{value}...]
+Sets parameter @var{param} to @var{value}.  Several parameters can be
+set with one @command{set} statement.  
address@hidden deffn
+
address@hidden {smtp command} clear address@hidden
+Unset the supplied connection parameters.  If used without arguments,
+unsets all parameters.  
address@hidden deffn
+
address@hidden {smtp command} list address@hidden
+Lists the values of the connection parameters.  If used without
+arguments, lists all parameters. 
address@hidden deffn
+
address@hidden SMTP commands
address@hidden {smtp command} ehlo address@hidden
+Sends the ESMTP greeting.  Unless @var{domain} is supplied, the
+connection parameter @samp{domain} is used.  
address@hidden deffn
+
address@hidden {smtp command} capa address@hidden
+Lists the server capabilities. 
address@hidden deffn
+
address@hidden {smtp command} starttls
+Initiates encrypted connection.  This command is disabled if the
+connection is opened with the @option{-tls} option.
address@hidden deffn
+
address@hidden {smtp command} auth @var{mech} address@hidden
+Authenticate using the supplied mechanisms.
address@hidden deffn
+
address@hidden {smtp command} rset
+Reset the session state.
address@hidden deffn
+
address@hidden {smtp command} from address@hidden
+Sets sender email address.  If used without arguments, prints the
+sender email address.
address@hidden deffn
+
address@hidden {smtp command} to address@hidden
+Sets recipient email address.  If used without arguments, prints all
+recepient names collected so far.
address@hidden deffn
+
address@hidden {smtp command} smtp @var{command} address@hidden
+Sends the @var{command} with its arguments verbatim. 
address@hidden deffn
+
address@hidden {smtp command} quit
+Quits the SMTP session. 
address@hidden deffn
+
address@hidden {smtp command} send address@hidden
+Reads the message from @var{file} and sends it.  If @var{file} is not
+supplied, the action depends on whether a @code{send} command was used
+prevously within the same session.  If so, @command{mailutils} will
+first ask whether to reuse the already supplied message.  If not, it
+will start an editor, allowing you to enter the new message.  When you
+exit from the editor, you will be prompted what to do with the
+message: send, edit, or quit (discard) it.
address@hidden deffn
+
address@hidden Internal commands
+
+Internal commands are the same as in @code{pop} shell: @xref{mailutils
+pop, Internal commands}.
 
diff --git a/doc/texinfo/sieve.texi b/doc/texinfo/sieve.texi
index 7ea8b99..6722970 100644
--- a/doc/texinfo/sieve.texi
+++ b/doc/texinfo/sieve.texi
@@ -970,7 +970,7 @@ If the tagged argument is not given, @samp{:over} is 
assumed.
 
 @deftypefn Test {} pipe [:envelope] [:header] [:body] @
                         [:exit @var{code}(number)] @
-                       [:signal @var{code}(number)] @
+                        [:signal @var{code}(number)] @
                         @var{command}(string)
 @*Synopsis:
 @smallexample
@@ -1489,14 +1489,14 @@ pipe "/usr/sbin/maidag --url smtp://gray@@mail.gnu.org"
                           [:noreply @var{noreply-address}(string-list)] @
                           [:reply_regex @var{expr}(string)] @
                           [:reply_prefix @var{prefix}(string)] @
-                         [:sender @var{email}(string)] @
-                         [:database @var{path}(string)] @
-                         [:return_address @var{email}(string)] @
+                          [:sender @var{email}(string)] @
+                          [:database @var{path}(string)] @
+                          [:return_address @var{email}(string)] @
                           [:header @var{headers}(string-list)] @
-                         [:mime] @
-                         [:always_reply] @
+                          [:mime] @
+                          [:always_reply] @
                           [:rfc2822] @
-                         [:file] @
+                          [:file] @
                           @var{text}(string)
 @*Syntax:
 @smallexample
diff --git a/gint b/gint
index fd86bf7..42f4712 160000
--- a/gint
+++ b/gint
@@ -1 +1 @@
-Subproject commit fd86bf7d44b0c970771830692ae7491447ebe8b1
+Subproject commit 42f4712085b40173eaea58e14b1a579291a6fe3a
diff --git a/libmailutils/opt/opt.c b/libmailutils/opt/opt.c
index 0a436c5..7a992f2 100644
--- a/libmailutils/opt/opt.c
+++ b/libmailutils/opt/opt.c
@@ -29,6 +29,14 @@
 #define EXIT_SUCCESS 0
 #define EXIT_ERROR   1
 
+/* Option and its aliases form a contiguous array.  Option slot is used
+   to preserve contiguity during sorting. */
+struct opt_slot
+{
+  struct mu_option **opt;   /* Points to the option */
+  int count;                /* Number of options in opt */
+};
+
 /* Compare pointers to two option structs */
 static int
 optcmp (const void *a, const void *b)
@@ -36,11 +44,6 @@ optcmp (const void *a, const void *b)
   struct mu_option const *ap = *(struct mu_option const **)a;
   struct mu_option const *bp = *(struct mu_option const **)b;
   
-  while (ap->opt_flags & MU_OPTION_ALIAS)
-    ap--;
-  while (bp->opt_flags & MU_OPTION_ALIAS)
-    bp--;
-
   if (!MU_OPTION_IS_VALID_SHORT_OPTION (ap)
       && MU_OPTION_IS_VALID_LONG_OPTION (ap)
       && !MU_OPTION_IS_VALID_SHORT_OPTION (bp)
@@ -60,18 +63,67 @@ optcmp (const void *a, const void *b)
     }
 }
 
+/* Compare pointers to two option slots */
+static int
+slotcmp (const void *a, const void *b)
+{
+  struct opt_slot const *ap = (struct opt_slot const *)a;
+  struct opt_slot const *bp = (struct opt_slot const *)b;
+  return optcmp (ap->opt, bp->opt);
+} 
 /* Sort a group of options in OPTBUF, starting at index START (first
    option slot after a group header (if any).  The group spans up to
    next group header or end of options */
 static size_t
 sort_group (struct mu_option **optbuf, size_t start)
 {
-  size_t i;
-  
+  size_t i, count = 0;
+
+  /* Make sure the first option in group is not an alias. */
+  optbuf[start]->opt_flags &= ~MU_OPTION_ALIAS;
   for (i = start; optbuf[i] && !MU_OPTION_IS_GROUP_HEADER (optbuf[i]); i++)
-    ;
-  
-  qsort (&optbuf[start], i - start, sizeof (optbuf[0]), optcmp);
+    {
+      if (!(optbuf[i]->opt_flags & MU_OPTION_ALIAS))
+       count++;
+    }
+  if (count == i - start)
+    /* Inplace sort */
+    qsort (&optbuf[start], count, sizeof (optbuf[0]), optcmp);
+  else
+    {
+      /* Option group contains aliases. Split it into option slots. */
+      struct mu_option **tmp;
+      struct opt_slot *slots;
+      size_t j, k, l;
+      
+      slots = mu_calloc (count, sizeof (slots[0]));
+      j = 0;
+      slots[0].opt = optbuf + start;
+      slots[0].count = 1;
+      for (k = start + 1; k < i; k++)
+       {
+         if (optbuf[k]->opt_flags & MU_OPTION_ALIAS)
+           slots[j].count++;
+         else
+           {
+             j++;
+             slots[j].opt = optbuf + k;
+             slots[j].count = 1;
+           }
+       }
+      /* Sort the slots */
+      qsort (slots, count, sizeof (slots[0]), slotcmp);
+      /* Create ordered array of option pointers */
+      tmp = mu_calloc (i - start, sizeof (tmp[0]));
+      for (k = l = 0; k < count; k++)
+       for (j = 0; j < slots[k].count; j++)
+         tmp[l++] = slots[k].opt[j];
+      /* Copy ordered pointers back and free temporary memory */
+      memcpy (optbuf + start, tmp, (i - start) * sizeof tmp[0]);
+      free (tmp);
+      free (slots);
+    }
+                    
   return i;
 }
 
@@ -648,9 +700,7 @@ parseopt_init (struct mu_parseopt *po, struct mu_option 
**options,
   
   po->po_optv[j] = NULL;
 
-  /* Ensure sane start of options.  This is necessary, in particular,
-     because optcmp backs up until it finds an element with cleared
-     MU_OPTION_ALIAS bit. */
+  /* Ensure sane start of options. */
   po->po_optv[0]->opt_flags &= ~MU_OPTION_ALIAS;
   if (!(flags & MU_PARSEOPT_NO_SORT))
     {
diff --git a/libmailutils/tests/parseopt.c b/libmailutils/tests/parseopt.c
index 7b2aade..cefffdd 100644
--- a/libmailutils/tests/parseopt.c
+++ b/libmailutils/tests/parseopt.c
@@ -90,7 +90,7 @@ set_prog_args (struct parseopt_param *param, char const *str, 
void *target)
 
   size = 1;
   for (i = 0; str[i]; i++)
-    if (str[i] == '\n')
+    if (str[i] == '|')
       size++;
 
   args = mu_calloc (size + 1, sizeof (args[0]));
diff --git a/libmailutils/tests/strtoc.c b/libmailutils/tests/strtoc.c
index 64c3cb4..8ac8637 100644
--- a/libmailutils/tests/strtoc.c
+++ b/libmailutils/tests/strtoc.c
@@ -161,10 +161,17 @@ static void
 v_cidr_format (union value *val, FILE *fp)
 {  
   char *buf;
-
-  mu_cidr_format (&val->v_cidr, 0, &buf);
-  fprintf (fp, "%s", buf);
-  free (buf);
+  int rc;
+  rc = mu_cidr_format (&val->v_cidr, 0, &buf);
+  if (rc)
+    {
+      fprintf (fp, "(can't convert value: %s)", mu_strerror (rc));
+    }
+  else
+    {
+      fprintf (fp, "%s", buf);
+      free (buf);
+    }
 }
 
 static int
@@ -259,6 +266,7 @@ struct testdata tests[] = {
        .len = 4,
        .address = { 127, 0, 0, 0 },
        .netmask = { 255 } } } },
+#ifdef MAILUTILS_IPV6  
   { mu_c_cidr,   "fe80::4a5b:39ff:fe09:97f0/64", 0,  { .v_cidr = {
        .family = 10,
        .len = 16,
@@ -266,7 +274,7 @@ struct testdata tests[] = {
                     0x4a, 0x5b, 0x39, 0xff, 0xfe, 0x9, 0x97, 0xf0 },
        .netmask = { 255, 255, 255, 255, 255, 255, 255, 255,
                     0,   0,   0,   0,   0,   0,   0,   0 } } } },
-  
+#endif  
   { mu_c_incr,   NULL,              0, { .v_int = 1 } },
   { mu_c_void }
 };
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index 6177b66..3b223a3 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -220,7 +220,7 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 
2, 0, 0,
   int status;
   SCM ret;
   
-  SCM_ASSERT (scm_is_string (url), url, SCM_ARG1, FUNC_NAME);
+  SCM_ASSERT (scm_is_bool (url) || scm_is_string (url), url, SCM_ARG1, 
FUNC_NAME);
   SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME);
   
   scm_dynwind_begin (0);
@@ -247,8 +247,20 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_open, "mu-mailbox-open", 
2, 0, 0,
   if (mode_bits & MU_STREAM_READ && mode_bits & MU_STREAM_WRITE)
     mode_bits = (mode_bits & ~(MU_STREAM_READ | MU_STREAM_WRITE)) | 
MU_STREAM_RDWR;
 
-  mode_str = scm_to_locale_string (url);
-  scm_dynwind_free (mode_str);
+  if (scm_is_bool (url))
+    {
+      if (url == SCM_BOOL_F)
+       mode_str = NULL;
+      else
+       mu_scm_error (FUNC_NAME, EINVAL,
+                     "value #t for URL is reserved for future use",
+                     scm_list_1 (url));
+    }
+  else
+    {
+      mode_str = scm_to_locale_string (url);
+      scm_dynwind_free (mode_str);
+    }
   
   status = mu_mailbox_create_default (&mbox, mode_str);
   if (status)
diff --git a/libmu_scm/mu_scm.c b/libmu_scm/mu_scm.c
index f605776..98b4fb1 100644
--- a/libmu_scm/mu_scm.c
+++ b/libmu_scm/mu_scm.c
@@ -111,6 +111,7 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, 
"mu-register-format", 0, 0, 1,
 {
   int status;
 
+  SCM_VALIDATE_REST_ARGUMENT (rest);
   if (scm_is_null (rest))
     {
       status = register_format (NULL);
diff --git a/maidag/Makefile.am b/maidag/Makefile.am
index 53c887e..d684f41 100644
--- a/maidag/Makefile.am
+++ b/maidag/Makefile.am
@@ -33,9 +33,6 @@ endif
 
 maidag_LDADD = \
  ../lib/libmuscript.a\
- @LIBMU_SCM@ @address@hidden
- @address@hidden
- @MU_LIB_PY@ @address@hidden
  ${MU_APP_LIBRARIES}\
  ${MU_LIB_SIEVE}\
  ${MU_LIB_MBOX}\
@@ -49,7 +46,12 @@ maidag_LDADD = \
  @address@hidden
  ${MU_LIB_MAILUTILS} \
  @address@hidden
+ @address@hidden
+ @address@hidden
+ @address@hidden
  $(LIBMU_DBM)\
+ @address@hidden
+ @address@hidden
  @address@hidden
  @MU_TCPWRAP_LIBRARIES@
 
diff --git a/mail/send.c b/mail/send.c
index 8a39d08..c27b1db 100644
--- a/mail/send.c
+++ b/mail/send.c
@@ -513,7 +513,7 @@ mail_send (int argc, char **argv)
                  mode = hp->mode;
                  if (mu_header_sget_value (env.header, hp->name, NULL) == 0)
                    mode = COMPOSE_REPLACE;
-                 compose_header_set (&env, hp->name, hp->value, hp->mode);
+                 compose_header_set (&env, hp->name, hp->value, mode);
                }
              mu_iterator_destroy (&itr);
            }
diff --git a/mh/pick.c b/mh/pick.c
index 9a78866..53e9d83 100644
--- a/mh/pick.c
+++ b/mh/pick.c
@@ -192,7 +192,7 @@ static struct mu_option options[] = {
   { ")",         0, NULL, MU_OPTION_ALIAS },
 
   MU_OPTION_GROUP (N_("Operations over the selected messages")),
-  { "list",      0, NULL, MU_OPTION_ALIAS,
+  { "list",      0, NULL, MU_OPTION_DEFAULT,
     N_("list the numbers of the selected messages (default)"),
     mu_c_bool, &list },
   { "sequence",  0, N_("NAME"), MU_OPTION_DEFAULT,
diff --git a/scheme/guimb.scmi b/scheme/guimb.scmi
index 45453cf..8a93b09 100644
--- a/scheme/guimb.scmi
+++ b/scheme/guimb.scmi
@@ -27,6 +27,7 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (list 
(command-line)))" "$@"
 
 (use-modules (ice-9 getopt-long)
             (ice-9 rdelim)
+            (ice-9 eval-string)
             (srfi srfi-1)
             (mailutils mailutils))
 
@@ -190,7 +191,7 @@ for any corresponding short options.
     guimb-module)
 
 (define-macro (bound? name)
-  `(and (module-defined? guimb-module ',name)
+  `(and (module-defined? (get-module) ',name)
        (procedure? ,name)))
 
 (define (guimb-parse-command-line cmdline)
@@ -219,17 +220,12 @@ for any corresponding short options.
     (if (not output-mailbox-mode)
        (set! output-mailbox-mode (if (null? input-mailbox-names) "wr" "a")))
     
-    (cond
-     (user-name
-      (set! output-mailbox
-           (mu-mailbox-open
-            (if (string? user-name)
-                (string-append "%" user-name)
-                "")
-            output-mailbox-mode)))
-     (output-mailbox-name
-      (set! output-mailbox (mu-mailbox-open output-mailbox-name
-                                           output-mailbox-mode))))
+    (if (and (not output-mailbox-name) user-name)
+       (set! output-mailbox-name (if (string? user-name)
+                        (string-append "%" user-name)
+                        #f)))
+    (set! output-mailbox (mu-mailbox-open output-mailbox-name
+                                                   output-mailbox-mode))
 ;    (write output-mailbox)(newline)
 
     (if source-file-name


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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