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-263-g1f44f1a


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-263-g1f44f1a
Date: Mon, 06 Dec 2010 14:34: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=1f44f1ad1f04c4d11ae4f56d2595a6126b223540

The branch, master has been updated
       via  1f44f1ad1f04c4d11ae4f56d2595a6126b223540 (commit)
       via  ec3fa1b18321ac99a62a00321ad6a059b6d30a27 (commit)
       via  7fbb4fd0cfb723d7a130e7e50ade3742cdcbce79 (commit)
       via  0611cd202d4bc40becd9ed148d4a2adf6c4541fa (commit)
       via  8bff160caebe10ffc0e0c36e88f4cd30f3fd2bf5 (commit)
      from  b38cfa7aeb7042dfd7c084e298f575c3c1121e0c (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 1f44f1ad1f04c4d11ae4f56d2595a6126b223540
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 6 15:01:33 2010 +0200

    Revise stream ioctl support.
    
    The mu_stream_ioctl function gets two argument that identify the ioctl
    in question: "family", which identifies a family of ioctls in question,
    and "opcode", which indicates the requested operation within that family.
    
    * include/mailutils/stream.h: Define ioctl families and opcodes.
    (mu_stream_ioctl): Change signature.
    * include/mailutils/sys/stream.h (_mu_stream)<ctl>: Change signature.
    
    * include/mailutils/log.h (mu_severity_from_string)
    (mu_severity_to_string): New protos.
    
    * libmailutils/stream/stream.c (mu_stream_ioctl): Change signature.
    
    * libmailutils/filter/filter_iconv.c: Rewrite ioctl support.
    * libmailutils/stream/file_stream.c: Likewise.
    * libmailutils/stream/fltstream.c: Likewise.
    * libmailutils/stream/iostream.c: Likewise.
    * libmailutils/stream/logstream.c: Likewise.
    * libmailutils/stream/mapfile_stream.c: Likewise.
    * libmailutils/stream/memory_stream.c: Likewise.
    * libmailutils/stream/nullstream.c: Likewise.
    * libmailutils/stream/prog_stream.c: Likewise.
    * libmailutils/stream/rdcache_stream.c: Likewise.
    * libmailutils/stream/streamref.c: Likewise.
    * libmailutils/stream/syslogstream.c: Likewise.
    * libmailutils/stream/tcp.c: Likewise.
    * libmailutils/stream/xscript-stream.c: Likewise.
    * libmu_auth/tls.c: Likewise.
    
    * comsat/action.c: Change calls to mu_stream_ioctl.
    * imap4d/auth_gsasl.c: Likewise.
    * imap4d/io.c: Likewise.
    * imap4d/util.c: Likewise.
    * libmailutils/base/getpass.c: Likewise.
    * libmailutils/cfg/parser.y: Likewise.
    * libmailutils/mailbox/body.c: Likewise.
    * libmailutils/mime/mime.c: Likewise.
    * libmailutils/stdstream/dbgstream.c: Likewise.
    * libmailutils/stdstream/strerr.c: Likewise.
    * libmu_sieve/runtime.c: Likewise.
    * libmu_sieve/sieve.y: Likewise.
    * libmu_sieve/util.c: Likewise.
    * libproto/imap/trace.c: Likewise.
    * libproto/mailer/smtp_data.c: Likewise.
    * libproto/mailer/smtp_starttls.c: Likewise.
    * libproto/mailer/smtp_trace.c: Likewise.
    * libproto/pop/pop3_stls.c: Likewise.
    * libproto/pop/pop3_stream.c: Likewise.
    * libproto/pop/pop3_trace.c: Likewise.
    * maidag/lmtp.c: Likewise.
    * mail/source.c: Likewise.
    * mu/logger.c: Likewise.
    * pop3d/extra.c: Likewise.
    * pop3d/retr.c: Likewise.
    
    * TODO: Update.
    * doc/texinfo/nullstream.texi: Update.

commit ec3fa1b18321ac99a62a00321ad6a059b6d30a27
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 6 12:25:29 2010 +0200

    Implement severity suppression in log streams; other minor fixes.
    
    * include/mailutils/stream.h (MU_LOGSTREAM_ADVANCE_LOCUS_LINE)
    (MU_LOGSTREAM_ADVANCE_LOCUS_COL): Rename to MU_IOCTL_.*.  All
    uses updated.
    (MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY)
    (MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME): New ioctls.
    * include/mailutils/sys/logstream.h (_mu_log_stream)<threshold>: New
    member.
    * include/mailutils/syslog.h (mu_log_severity_threshold): New extern.
    * libmailutils/cfg/parser.y (_cfg_default_printer): Remove leftover
    static function.
    * libmailutils/stream/logstream.c (mu_severity_from_string)
    (mu_severity_to_string): New functions.
    (_log_write): Fix double free.
    Implement severity suppression.
    (_log_ioctl): Handle MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY.
    * libmu_cfg/common.c (mu_logging_param): New parameter
    "severity".

commit 7fbb4fd0cfb723d7a130e7e50ade3742cdcbce79
Merge: 0611cd2 b38cfa7
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 6 11:35:02 2010 +0200

    Merge branch 'master' of ssh://address@hidden/srv/git/mailutils

commit 0611cd202d4bc40becd9ed148d4a2adf6c4541fa
Merge: 8bff160 60610d8
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Dec 6 01:50:31 2010 +0200

    Merge branch 'master' of ssh://address@hidden/srv/git/mailutils

commit 8bff160caebe10ffc0e0c36e88f4cd30f3fd2bf5
Author: Sergey Poznyakoff <address@hidden>
Date:   Fri Dec 3 12:17:29 2010 +0200

    streams: introduce setbuf hooks.
    
    * include/mailutils/sys/stream.h (_mu_stream) <setbuf_hook>: New member.
    * libmailutils/stream/stream.c (mu_stream_set_buffer): Use setbuf_hook
    to decide whether the operation is allowed.

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

Summary of changes:
 TODO                                 |    2 +
 comsat/action.c                      |    6 +-
 doc/texinfo/nullstream.texi          |   48 +++++--
 imap4d/auth_gsasl.c                  |    6 +-
 imap4d/io.c                          |    4 +-
 imap4d/util.c                        |    3 +-
 include/mailutils/log.h              |    3 +
 include/mailutils/stream.h           |   87 +++++++-----
 include/mailutils/sys/logstream.h    |   12 +-
 include/mailutils/sys/stream.h       |    2 +-
 include/mailutils/syslog.h           |    2 +
 libmailutils/base/getpass.c          |    4 +-
 libmailutils/cfg/parser.y            |   45 ++++---
 libmailutils/diag/syslog.c           |    1 +
 libmailutils/filter/filter_iconv.c   |   26 ++--
 libmailutils/mailbox/body.c          |    6 +-
 libmailutils/mime/mime.c             |   32 +++--
 libmailutils/stdstream/dbgstream.c   |    5 +-
 libmailutils/stdstream/strerr.c      |    7 +-
 libmailutils/stream/file_stream.c    |  156 ++++++++++----------
 libmailutils/stream/fltstream.c      |   30 +++--
 libmailutils/stream/iostream.c       |   84 ++++++-----
 libmailutils/stream/logstream.c      |  262 +++++++++++++++++++++-------------
 libmailutils/stream/mapfile_stream.c |   52 +++++--
 libmailutils/stream/memory_stream.c  |   53 +++++---
 libmailutils/stream/nullstream.c     |    7 +-
 libmailutils/stream/prog_stream.c    |   51 +++++--
 libmailutils/stream/rdcache_stream.c |   33 +++--
 libmailutils/stream/stream.c         |    6 +-
 libmailutils/stream/streamref.c      |   40 +++--
 libmailutils/stream/syslogstream.c   |    7 +-
 libmailutils/stream/tcp.c            |   25 +++-
 libmailutils/stream/xscript-stream.c |  151 +++++++++++---------
 libmu_auth/tls.c                     |  110 +++++++++------
 libmu_cfg/common.c                   |   19 +++
 libmu_sieve/runtime.c                |    6 +-
 libmu_sieve/sieve.y                  |    3 +-
 libmu_sieve/util.c                   |    3 +-
 libproto/imap/trace.c                |    5 +-
 libproto/mailer/smtp_data.c          |   12 +-
 libproto/mailer/smtp_starttls.c      |    6 +-
 libproto/mailer/smtp_trace.c         |    5 +-
 libproto/pop/pop3_stls.c             |    6 +-
 libproto/pop/pop3_stream.c           |   11 +-
 libproto/pop/pop3_trace.c            |    5 +-
 maidag/lmtp.c                        |   15 ++-
 mail/source.c                        |    9 +-
 mu/logger.c                          |    9 +-
 pop3d/extra.c                        |    7 +-
 pop3d/retr.c                         |    6 +-
 50 files changed, 924 insertions(+), 571 deletions(-)

diff --git a/TODO b/TODO
index f5a8c72..d4f7883 100644
--- a/TODO
+++ b/TODO
@@ -14,6 +14,8 @@ Software Foundation, Inc.
 
 See also mu_rfc2822_in_reply_to.
 
+* Check id _mu_smtp_trace_disable correctly dereferences streams.
+
 * mail: rewrite I/O support using streams.
 
 * re-implement imap4 client (in progress)
diff --git a/comsat/action.c b/comsat/action.c
index 020079f..1ec5840 100644
--- a/comsat/action.c
+++ b/comsat/action.c
@@ -396,7 +396,8 @@ run_user_action (FILE *tty, const char *cr, mu_message_t 
msg)
          if (mu_wordsplit (stmt, &ws, MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT)
              && ws.ws_wordc)
            {
-             mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus);
+             mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                               MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus);
              if (strcmp (ws.ws_wordv[0], "beep") == 0)
                {
                  /* FIXME: excess arguments are ignored */
@@ -445,7 +446,8 @@ run_user_action (FILE *tty, const char *cr, mu_message_t 
msg)
          locus.mu_line += n;
        }
       fclose (fp);
-      mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL);
+      mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                       MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL);
       free (rcname);
     }
 
diff --git a/doc/texinfo/nullstream.texi b/doc/texinfo/nullstream.texi
index a140150..a368b74 100644
--- a/doc/texinfo/nullstream.texi
+++ b/doc/texinfo/nullstream.texi
@@ -51,9 +51,22 @@ with @file{/dev/null}, or @file{/dev/zero}.  We refer to 
these devices
 only to illustrate the behavior of @dfn{null streams}.}.
 
 This is the default behavior when reading.  It can be altered using
-the following @dfn{ioctls}.
+the @samp{MU_IOCTL_NULLSTREAM} ioctl.
 
address@hidden {ioctl} MU_IOCTL_NULLSTREAM_SET_PATTERN
address@hidden {ioctl} MU_IOCTL_NULLSTREAM
+This ioctl controls various parameters of a null stream.  Synopsis:
+
address@hidden
+mu_stream_ioctl (@var{stream}, MU_IOCTL_NULLSTREAM, @var{opcode}, @var{arg});
address@hidden example
+
address@hidden
+where @var{opcode} is the operation code specific to null streams and
address@hidden is the operation argument.  Supported operation codes and
+their arguments are discussed below in this document.
address@hidden defvr
+
address@hidden {ioctl opcode} MU_IOCTL_NULLSTREAM_SET_PATTERN
 Set the @dfn{pattern} for reads.  The argument is a pointer to
 @dfn{struct mu_nullstream_pattern}, defined as:
 
@@ -78,7 +91,10 @@ are returned cyclically at each read.  For example, suppose 
that
   
   pat.pattern = "01234567";
   pat.size = 8;
-  mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATTERN, &pat);
+  mu_stream_ioctl (str,
+                   MU_IOCTL_NULLSTREAM,
+                   MU_IOCTL_NULLSTREAM_SET_PATTERN,
+                   &pat);
 
   mu_stream_read (str, buf, sizeof (buf), &n);
 @end smallexample
@@ -115,7 +131,10 @@ The default behavior corresponds to the following 
initialization:
 @group
   pat.pattern = "";
   pat.size = 1;
-  mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATTERN, &pat);
+  mu_stream_ioctl (str,
+                   MU_IOCTL_NULLSTREAM,
+                   MU_IOCTL_NULLSTREAM_SET_PATTERN,
+                   &pat);
 @end group  
 @end smallexample
 
@@ -124,7 +143,10 @@ argument causes all subsequent reads from that stream to 
return @samp{EOF}:
 
 @smallexample
 @group
-  mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATTERN, NULL);
+  mu_stream_ioctl (str,
+                   MU_IOCTL_NULLSTREAM,
+                   MU_IOCTL_NULLSTREAM_SET_PATTERN,
+                   NULL);
   @dots{}
   rc = mu_stream_read (str, buf, sizeof (buf), &n);
 
@@ -134,7 +156,7 @@ argument causes all subsequent reads from that stream to 
return @samp{EOF}:
 @end smallexample
 @end defvr
 
address@hidden {ioctl} MU_IOCTL_NULLSTREAM_SET_PATCLASS
address@hidden {ioctl opcode} MU_IOCTL_NULLSTREAM_SET_PATCLASS
 Set read pattern in terms of @dfn{C character classes}
 (@FIXME-pxref{C character classes}).  Argument is a pointer
 to an integer containing a bitwise @samp{OR} of the desired
@@ -143,7 +165,10 @@ the following code:
 
 @smallexample
   int class = MU_CTYPE_DIGIT|MU_CTYPE_XLETR;
-  mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SET_PATCLASS, &class);
+  mu_stream_ioctl (str,
+                   MU_IOCTL_NULLSTREAM,
+                   MU_IOCTL_NULLSTREAM_SET_PATCLASS,
+                   &class);
 @end smallexample
 
 @noindent
@@ -157,7 +182,7 @@ initializes the read pattern to the following string:
 Two ioctls are provided to control the @dfn{size} of a null stream
 available to seek and read operations.
 
address@hidden {ioctl} MU_IOCTL_NULLSTREAM_SETSIZE
address@hidden {ioctl opcode} MU_IOCTL_NULLSTREAM_SETSIZE
 Limit the addressable size of a null stream.  Argument is a pointer
 to @samp{mu_off_t} object specifying the new size.  The example below
 limits the stream size to 32 bytes:
@@ -165,7 +190,10 @@ limits the stream size to 32 bytes:
 @smallexample
 @group
   mu_off_t limit = 32;
-  mu_stream_ioctl (str, MU_IOCTL_NULLSTREAM_SETSIZE, &limit);
+  mu_stream_ioctl (str,
+                   MU_IOCTL_NULLSTREAM,
+                   MU_IOCTL_NULLSTREAM_SETSIZE,
+                   &limit);
 @end group  
 @end smallexample
 @end defvr
@@ -181,7 +209,7 @@ Setting the stream size to @samp{0} causes all subsequent 
reads from
 that stream to return @samp{EOF}.  The similar effect has the
 @samp{MU_IOCTL_NULLSTREAM_SET_PATTERN} ioctl with the @samp{NULL} argument.
 
address@hidden {ioctl} MU_IOCTL_NULLSTREAM_CLRSIZE
address@hidden {ioctl opcode} MU_IOCTL_NULLSTREAM_CLRSIZE
 Cancel the size limitation imposed by a previous
 @samp{MU_IOCTL_NULLSTREAM_SETSIZE} ioctl or a call to
 @samp{mu_stream_truncate}.  Argument must be @samp{NULL}.
diff --git a/imap4d/auth_gsasl.c b/imap4d/auth_gsasl.c
index 54e206a..d516d31 100644
--- a/imap4d/auth_gsasl.c
+++ b/imap4d/auth_gsasl.c
@@ -111,7 +111,8 @@ auth_gsasl (struct imap4d_auth *ap)
     {
       mu_stream_t stream[2], newstream[2];
 
-      rc = mu_stream_ioctl (iostream, MU_IOCTL_GET_STREAM, stream);
+      rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET, 
+                            stream);
       if (rc)
        {
          mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM",
@@ -157,7 +158,8 @@ auth_gsasl (struct imap4d_auth *ap)
       mu_stream_unref (stream[0]);
       mu_stream_unref (stream[1]);
       
-      rc = mu_stream_ioctl (iostream, MU_IOCTL_SET_STREAM, newstream);
+      rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, 
+                            MU_IOCTL_OP_SET, newstream);
       if (rc)
        {
          mu_error (_("%s failed when it should not: %s"),
diff --git a/imap4d/io.c b/imap4d/io.c
index 9ed4f46..0e9d71a 100644
--- a/imap4d/io.c
+++ b/imap4d/io.c
@@ -83,7 +83,7 @@ imap4d_init_tls_server ()
   mu_stream_t tlsstream, stream[2];
   int rc;
 
-  rc = mu_stream_ioctl (iostream, MU_IOCTL_GET_STREAM, stream);
+  rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET, stream);
   if (rc)
     {
       mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM",
@@ -103,7 +103,7 @@ imap4d_init_tls_server ()
   mu_stream_unref (stream[1]);
   stream[0] = stream[1] = tlsstream;
 
-  rc = mu_stream_ioctl (iostream, MU_IOCTL_SET_STREAM, stream);
+  rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_SET, stream);
   if (rc)
     {
       mu_error (_("%s failed: %s"), "MU_IOCTL_SET_STREAM",
diff --git a/imap4d/util.c b/imap4d/util.c
index 6d3ebcb..81faaf9 100644
--- a/imap4d/util.c
+++ b/imap4d/util.c
@@ -683,7 +683,8 @@ set_xscript_level (int xlev)
            return MU_XSCRIPT_NORMAL;
        }
 
-      if (mu_stream_ioctl (iostream, MU_IOCTL_LEVEL, &xlev) == 0)
+      if (mu_stream_ioctl (iostream, MU_IOCTL_XSCRIPTSTREAM,
+                           MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0)
        return xlev;
     }
   return 0;
diff --git a/include/mailutils/log.h b/include/mailutils/log.h
index a36b85a..0b989cf 100644
--- a/include/mailutils/log.h
+++ b/include/mailutils/log.h
@@ -38,6 +38,9 @@ extern "C" {
 int mu_log_stream_create (mu_stream_t *, mu_stream_t); 
 int mu_syslog_stream_create (mu_stream_t *, int);
 
+int mu_severity_from_string (const char *str, unsigned *pn);
+int mu_severity_to_string (unsigned n, const char **pstr);
+  
 extern char *_mu_severity_str[];
 extern int _mu_severity_num;
   
diff --git a/include/mailutils/stream.h b/include/mailutils/stream.h
index d46cb37..300639e 100644
--- a/include/mailutils/stream.h
+++ b/include/mailutils/stream.h
@@ -59,64 +59,83 @@ enum mu_buffer_type
 #define MU_STREAM_IWOTH       0x00008000
 #define MU_STREAM_IMASK       0x0000F000
 
-#define MU_IOCTL_GET_TRANSPORT   1
-#define MU_IOCTL_GET_STATUS      2
-#define MU_IOCTL_GET_PID         3
-#define MU_IOCTL_SET_SEEK_LIMITS 4
-#define MU_IOCTL_ABRIDGE_SEEK MU_IOCTL_SET_SEEK_LIMITS
-#define MU_IOCTL_GET_SEEK_LIMITS 5
-#define MU_IOCTL_SET_TRANSPORT   6
-#define MU_IOCTL_GET_STREAM      7
-#define MU_IOCTL_SET_STREAM      8  
-
-#define MU_IOCTL_LEVEL           9
-
-#define MU_IOCTL_GET_TRANSPORT_BUFFER 10
-#define MU_IOCTL_SET_TRANSPORT_BUFFER 11
-
-#define MU_IOCTL_GET_ECHO        12     
-#define MU_IOCTL_SET_ECHO        13  
+  /* Ioctl families */
+#define MU_IOCTL_TRANSPORT        0  
+#define MU_IOCTL_PROGSTREAM       1 /* Program stream */
+#define MU_IOCTL_SEEK_LIMITS      2 /* Seek limits (get/set),
+                                      Arg: mu_off_t[2] */
+#define MU_IOCTL_SUBSTREAM        3 /* Substream (get/set) */
+#define MU_IOCTL_TRANSPORT_BUFFER 4 /* get/set */
+#define MU_IOCTL_ECHO             5 /* get/set */
+#define MU_IOCTL_NULLSTREAM       6 /* Null stream (see below) */
+#define MU_IOCTL_LOGSTREAM        7 /* Log stream (see below) */
+#define MU_IOCTL_XSCRIPTSTREAM    8 /* Transcript stream (see below) */
+
+  /* Opcodes common for various families */
+#define MU_IOCTL_OP_GET 0
+#define MU_IOCTL_OP_SET 1  
   
-/* The following ioctls are for nullstreams only: */  
-#define MU_IOCTL_NULLSTREAM_SET_PATTERN 14
+  /* Opcodes for MU_IOCTL_PROGSTREAM */  
+#define MU_IOCTL_PROG_STATUS 0
+#define MU_IOCTL_PROG_PID    1
+
+  /* Opcodes for MU_IOCTL_NULLSTREAM */
   /* Set read pattern.
      Argument: struct mu_nullstream_pattern *pat.
      If pat==NULL, any reads from that stream will return EOF. */
-#define MU_IOCTL_NULLSTREAM_SET_PATCLASS 15
+#define MU_IOCTL_NULLSTREAM_SET_PATTERN 0
   /* Set pattern class for reads:  Argument int *pclass (a class mask
      from mailutils/cctype.h */
-#define MU_IOCTL_NULLSTREAM_SETSIZE 16
+#define MU_IOCTL_NULLSTREAM_SET_PATCLASS 1
   /* Limit stream size.  Argument: mu_off_t *psize; */
-#define MU_IOCTL_NULLSTREAM_CLRSIZE 17
+#define MU_IOCTL_NULLSTREAM_SETSIZE 2
   /* Lift the size limit.  Argument: NULL */
-
-/* The following are for logstreams */
-  /* Get or set logging severity.
+#define MU_IOCTL_NULLSTREAM_CLRSIZE 3
+  
+    /* Get or set logging severity.
      Arg: unsigned *
   */
-#define MU_IOCTL_LOGSTREAM_GET_SEVERITY 18
-#define MU_IOCTL_LOGSTREAM_SET_SEVERITY 19
+#define MU_IOCTL_LOGSTREAM_GET_SEVERITY 0
+#define MU_IOCTL_LOGSTREAM_SET_SEVERITY 1
   /* Get or set locus.
      Arg: struct mu_locus *
   */
-#define MU_IOCTL_LOGSTREAM_GET_LOCUS    20
-#define MU_IOCTL_LOGSTREAM_SET_LOCUS    21
+#define MU_IOCTL_LOGSTREAM_GET_LOCUS    2
+#define MU_IOCTL_LOGSTREAM_SET_LOCUS    3
   /* Get or set log mode.
      Arg: int *
   */
-#define MU_IOCTL_LOGSTREAM_GET_MODE     22
-#define MU_IOCTL_LOGSTREAM_SET_MODE     23
+#define MU_IOCTL_LOGSTREAM_GET_MODE     4
+#define MU_IOCTL_LOGSTREAM_SET_MODE     5
 
   /* Advance locus line.
      Arg: NULL (increment by 1)
           int *
   */
-#define MU_LOGSTREAM_ADVANCE_LOCUS_LINE 24
+#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE 6
   /* Advance locus column.
      Arg: NULL (increment by 1)
           int *
   */
-#define MU_LOGSTREAM_ADVANCE_LOCUS_COL  25
+#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL  7
+
+  /* Suppress output of messages having severity lower than the
+     given threshold.
+     Arg: int *
+  */
+#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY  8
+  /* Same as above, but:
+     Arg: const char *
+  */
+#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME 9
+
+  /* Opcodes for MU_IOCTL_XSCRIPTSTREAM */
+  /* Swap transcript levels.
+     Arg: int *X
+
+     New transcript level is set to *X.  Previous level is stored in X.
+  */
+#define MU_IOCTL_XSCRIPTSTREAM_LEVEL 0  
   
 #define MU_TRANSPORT_INPUT  0
 #define MU_TRANSPORT_OUTPUT 1
@@ -196,7 +215,7 @@ int mu_stream_writeline (mu_stream_t stream, const char 
*buf, size_t size);
 int mu_stream_flush (mu_stream_t stream);
 int mu_stream_close (mu_stream_t stream);
 int mu_stream_size (mu_stream_t stream, mu_off_t *psize);
-int mu_stream_ioctl (mu_stream_t stream, int code, void *ptr);
+int mu_stream_ioctl (mu_stream_t stream, int family, int opcode, void *ptr);
 int mu_stream_truncate (mu_stream_t stream, mu_off_t);
 int mu_stream_shutdown (mu_stream_t stream, int how);
 
diff --git a/include/mailutils/sys/logstream.h 
b/include/mailutils/sys/logstream.h
index 57db6db..6946e66 100644
--- a/include/mailutils/sys/logstream.h
+++ b/include/mailutils/sys/logstream.h
@@ -22,11 +22,13 @@
 
 struct _mu_log_stream
 {
-  struct _mu_stream base;
-  mu_stream_t transport;
-  unsigned severity;
-  int logmode;
-  struct mu_locus locus;
+  struct _mu_stream base;  /* Base stream */
+  mu_stream_t transport;   /* Transport stream */
+  unsigned severity;       /* Default severity */
+  unsigned threshold;      /* Suppress the output of severities below 
+                             this threshold */
+  int logmode;             /* Mode flags */
+  struct mu_locus locus;   /* Location */
 };
 
 #endif
diff --git a/include/mailutils/sys/stream.h b/include/mailutils/sys/stream.h
index f4217da..964c01f 100644
--- a/include/mailutils/sys/stream.h
+++ b/include/mailutils/sys/stream.h
@@ -60,7 +60,7 @@ struct _mu_stream
   void (*done) (struct _mu_stream *);
   int (*seek) (struct _mu_stream *, mu_off_t, mu_off_t *);
   int (*size) (struct _mu_stream *, mu_off_t *);
-  int (*ctl) (struct _mu_stream *, int, void *);
+  int (*ctl) (struct _mu_stream *, int, int, void *);
   int (*wait) (struct _mu_stream *, int *, struct timeval *);
   int (*truncate) (struct _mu_stream *, mu_off_t);
   int (*shutdown) (struct _mu_stream *, int);
diff --git a/include/mailutils/syslog.h b/include/mailutils/syslog.h
index 28ca308..60570b4 100644
--- a/include/mailutils/syslog.h
+++ b/include/mailutils/syslog.h
@@ -28,6 +28,8 @@ extern int mu_log_syslog;
 extern int mu_log_facility;
 extern char *mu_log_tag;
 extern int mu_log_print_severity;
+extern unsigned mu_log_severity_threshold;
+
 #define MU_LOG_TAG() (mu_log_tag ? mu_log_tag : mu_program_name)
   
 int mu_string_to_syslog_facility (const char *str, int *pfacility);
diff --git a/libmailutils/base/getpass.c b/libmailutils/base/getpass.c
index ec88b0e..2c6fcaa 100644
--- a/libmailutils/base/getpass.c
+++ b/libmailutils/base/getpass.c
@@ -40,13 +40,13 @@ mu_getpass (mu_stream_t in, mu_stream_t out, const char 
*prompt,
   if (status)
     return status;
   mu_stream_flush (out);
-  status = mu_stream_ioctl (in, MU_IOCTL_SET_ECHO, &echo_state);
+  status = mu_stream_ioctl (in, MU_IOCTL_ECHO, MU_IOCTL_OP_SET, &echo_state);
   if (status == 0)
     echo_state = 1;
   status = mu_stream_getline (in, &buf, &size, NULL);
   if (echo_state)
     {
-      mu_stream_ioctl (in, MU_IOCTL_SET_ECHO, &echo_state);
+      mu_stream_ioctl (in, MU_IOCTL_ECHO, MU_IOCTL_OP_SET, &echo_state);
       mu_stream_write (out, "\n", 1, NULL);
     }
   if (status == 0)
diff --git a/libmailutils/cfg/parser.y b/libmailutils/cfg/parser.y
index 09f0d9d..603351d 100644
--- a/libmailutils/cfg/parser.y
+++ b/libmailutils/cfg/parser.y
@@ -379,13 +379,6 @@ opt_sc  : /* empty */
 
 %%
 
-static int
-_cfg_default_printer (void *unused, mu_log_level_t level, const char *str)
-{
-  fprintf (stderr, "%s", str);
-  return 0;
-}
-
 void
 mu_cfg_set_debug ()
 {
@@ -402,12 +395,15 @@ mu_cfg_parse (mu_cfg_tree_t **ptree)
   int save_mode = 0, mode;
   struct mu_locus save_locus = { NULL, };
 
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_MODE, &save_mode);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_GET_MODE, 
+                   &save_mode);
   mode = save_mode | MU_LOGMODE_LOCUS;
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &mode);
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_MODE,
+                   &mode);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_GET_LOCUS,
+                   &save_locus);
   
-  mu_cfg_set_debug ();//FIXME
+  mu_cfg_set_debug ();
   _mu_cfg_errcnt = 0;
 
   rc = yyparse ();
@@ -426,8 +422,10 @@ mu_cfg_parse (mu_cfg_tree_t **ptree)
       *ptree = tree;
     }
 
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &save_mode);
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_MODE,
+                   &save_mode);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_LOCUS,
+                   &save_locus);
   free (save_locus.mu_file);
 
   return rc;
@@ -1253,7 +1251,8 @@ parse_param (struct scan_tree_data *sdata, const 
mu_cfg_node_t *node)
                            node->tag);
          abort ();
        }
-      mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS,
+      mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 
+                       MU_IOCTL_LOGSTREAM_SET_LOCUS,
                       (void*) &node->locus);
       if (param->callback (tgt, node->label))
        return 1;
@@ -1296,7 +1295,8 @@ _scan_tree_helper (const mu_cfg_node_t *node, void *data)
        sec->target = (char*)sdata->target + sec->offset;
       if (sec->parser)
        {
-         mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS,
+         mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 
+                           MU_IOCTL_LOGSTREAM_SET_LOCUS,
                           (void*) &node->locus);
          if (sec->parser (mu_cfg_section_start, node,
                           sec->label, &sec->target,
@@ -1362,10 +1362,13 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct 
mu_cfg_section *sections,
   dat.call_data = data;
   dat.target = target;
 
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_MODE, &save_mode);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 
+                   MU_IOCTL_LOGSTREAM_GET_MODE, &save_mode);
   mode = save_mode | MU_LOGMODE_LOCUS;
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &mode);
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 
+                   MU_IOCTL_LOGSTREAM_SET_MODE, &mode);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 
+                   MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus);
   
   if (push_section (&dat, sections))
     return 1;
@@ -1375,8 +1378,10 @@ mu_cfg_scan_tree (mu_cfg_tree_t *tree, struct 
mu_cfg_section *sections,
   mu_cfg_preorder (tree->nodes, &clos);
   pop_section (&dat);
 
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_MODE, &save_mode);
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_GET_LOCUS, &save_locus);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 
+                   MU_IOCTL_LOGSTREAM_SET_MODE, &save_mode);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 
+                   MU_IOCTL_LOGSTREAM_SET_LOCUS, &save_locus);
   free (save_locus.mu_file);
   
   return dat.error;
diff --git a/libmailutils/diag/syslog.c b/libmailutils/diag/syslog.c
index 4b769c3..9247953 100644
--- a/libmailutils/diag/syslog.c
+++ b/libmailutils/diag/syslog.c
@@ -132,3 +132,4 @@ int mu_log_syslog = 0;
 int mu_log_facility = LOG_FACILITY;
 char *mu_log_tag = NULL;
 int mu_log_print_severity = 0;
+unsigned mu_log_severity_threshold = MU_LOG_DEBUG;
diff --git a/libmailutils/filter/filter_iconv.c 
b/libmailutils/filter/filter_iconv.c
index 79835a5..cab442d 100644
--- a/libmailutils/filter/filter_iconv.c
+++ b/libmailutils/filter/filter_iconv.c
@@ -384,26 +384,32 @@ _icvt_strerror (mu_stream_t stream, int rc)
 }
 
 static int
-_icvt_ioctl (mu_stream_t stream, int code, void *ptr)
+_icvt_ioctl (mu_stream_t stream, int code, int opcode, void *ptr)
 {
   struct icvt_stream *s = (struct icvt_stream *)stream;
   mu_transport_t *ptrans;
   
   switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!ptr)
        return EINVAL;
-      ptrans = ptr;
-      ptrans[0] = (mu_transport_t) s->transport;
-      ptrans[1] = NULL;
+      switch (opcode)
+       {
+       case MU_IOCTL_OP_GET:
+         ptrans = ptr;
+         ptrans[0] = (mu_transport_t) s->transport;
+         ptrans[1] = NULL;
+         break;
+
+       default:
+         return ENOSYS;
+       }
       break;
 
-    case MU_IOCTL_GET_STREAM:
-    case MU_IOCTL_SET_STREAM:
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
-      return mu_stream_ioctl (s->transport, code, ptr);
+    case MU_IOCTL_SUBSTREAM:
+    case MU_IOCTL_TRANSPORT_BUFFER:
+      return mu_stream_ioctl (s->transport, code, opcode, ptr);
       
     default:
       return ENOSYS;
diff --git a/libmailutils/mailbox/body.c b/libmailutils/mailbox/body.c
index 5db2216..ceaa309 100644
--- a/libmailutils/mailbox/body.c
+++ b/libmailutils/mailbox/body.c
@@ -42,7 +42,7 @@ static int _body_read     (mu_stream_t, char *, size_t, 
size_t *);
 static int _body_truncate (mu_stream_t, mu_off_t);
 static int _body_size     (mu_stream_t, mu_off_t *);
 static int _body_write    (mu_stream_t, const char *, size_t, size_t *);
-static int _body_ioctl    (mu_stream_t, int, void *);
+static int _body_ioctl    (mu_stream_t, int, int, void *);
 static int _body_seek     (mu_stream_t, mu_off_t, mu_off_t *);
 static const char *_body_error_string (mu_stream_t, int);
 
@@ -289,11 +289,11 @@ _body_error_string (mu_stream_t stream, int rc)
 }
 
 static int
-_body_ioctl (mu_stream_t stream, int code, void *ptr)
+_body_ioctl (mu_stream_t stream, int code, int opcode, void *ptr)
 {
   struct _mu_body_stream *str = (struct _mu_body_stream*) stream;
   mu_body_t body = str->body;
-  return mu_stream_ioctl (body->fstream, code, ptr);
+  return mu_stream_ioctl (body->fstream, code, opcode, ptr);
 }
 
 static int
diff --git a/libmailutils/mime/mime.c b/libmailutils/mime/mime.c
index be75b31..c3bec6f 100644
--- a/libmailutils/mime/mime.c
+++ b/libmailutils/mime/mime.c
@@ -759,7 +759,7 @@ _mime_body_stream_read (mu_stream_t stream, char *buf, 
size_t buflen, size_t *nb
 }
 
 static int
-_mime_body_stream_ioctl (mu_stream_t stream, int code, void *arg)
+_mime_body_stream_ioctl (mu_stream_t stream, int code, int opcode, void *arg)
 {
   struct _mime_body_stream *mstr = (struct _mime_body_stream *)stream;
   mu_mime_t mime = mstr->mime;
@@ -768,18 +768,28 @@ _mime_body_stream_ioctl (mu_stream_t stream, int code, 
void *arg)
   
   switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!arg)
        return EINVAL;
-      
-      if (mime->nmtp_parts == 0 || mime->cur_offset == 0)
-       return EINVAL;
-      rc = mu_message_get_streamref (mime->mtp_parts[mime->cur_part]->msg,
-                                    &msg_stream);
-      if (rc)
-       break;
-      rc = mu_stream_ioctl (msg_stream, code, arg);
-      mu_stream_destroy (&msg_stream);
+      switch (opcode)
+        {
+        case MU_IOCTL_OP_GET:
+          if (mime->nmtp_parts == 0 || mime->cur_offset == 0)
+           return EINVAL;
+          rc = mu_message_get_streamref (mime->mtp_parts[mime->cur_part]->msg,
+                                        &msg_stream);
+          if (rc)
+           break;
+          rc = mu_stream_ioctl (msg_stream, code, opcode, arg);
+          mu_stream_destroy (&msg_stream);
+          break;
+         
+       case MU_IOCTL_OP_SET:
+         return ENOSYS;
+         
+       default:
+         return EINVAL;
+       }
       break;
 
     default:
diff --git a/libmailutils/stdstream/dbgstream.c 
b/libmailutils/stdstream/dbgstream.c
index 72a0398..e18bfb6 100644
--- a/libmailutils/stdstream/dbgstream.c
+++ b/libmailutils/stdstream/dbgstream.c
@@ -29,13 +29,14 @@ mu_dbgstream_create (mu_stream_t *pstr, int severity)
   int rc;
   mu_transport_t trans[2];
 
-  rc = mu_stream_ioctl (mu_strerr, MU_IOCTL_GET_TRANSPORT, trans);
+  rc = mu_stream_ioctl (mu_strerr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, trans);
   if (rc)
     return rc;
   rc = mu_log_stream_create (pstr, (mu_stream_t) trans[0]);
   if (rc)
     return rc;
-  mu_stream_ioctl (*pstr, MU_IOCTL_LOGSTREAM_SET_SEVERITY, &severity);
+  mu_stream_ioctl (*pstr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_SEVERITY, 
+                   &severity);
   return 0;
 }
 
diff --git a/libmailutils/stdstream/strerr.c b/libmailutils/stdstream/strerr.c
index cde76af..9028ae9 100644
--- a/libmailutils/stdstream/strerr.c
+++ b/libmailutils/stdstream/strerr.c
@@ -117,8 +117,13 @@ mu_stdstream_strerr_setup (int type)
       if (mu_log_print_severity)
        {
          int mode = MU_LOGMODE_SEVERITY;
-         mu_stream_ioctl (str, MU_IOCTL_LOGSTREAM_SET_MODE, &mode);
+         mu_stream_ioctl (str, MU_IOCTL_LOGSTREAM, 
+                           MU_IOCTL_LOGSTREAM_SET_MODE, &mode);
        }
+      if (mu_log_severity_threshold > MU_LOG_DEBUG)
+       mu_stream_ioctl (str, MU_IOCTL_LOGSTREAM,
+                         MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY,
+                        &mu_log_severity_threshold);
       mu_stream_destroy (&mu_strerr);
       mu_strerr = str;
     }
diff --git a/libmailutils/stream/file_stream.c 
b/libmailutils/stream/file_stream.c
index 73a2990..b978392 100644
--- a/libmailutils/stream/file_stream.c
+++ b/libmailutils/stream/file_stream.c
@@ -204,109 +204,111 @@ fd_error_string (struct _mu_stream *str, int rc)
 #endif
 
 static int
-fd_ioctl (struct _mu_stream *str, int code, void *ptr)
+fd_ioctl (struct _mu_stream *str, int code, int opcode, void *ptr)
 {
   struct _mu_file_stream *fstr = (struct _mu_file_stream *) str;
   mu_transport_t *ptrans;
   
   switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!ptr)
        return EINVAL;
-      ptrans = ptr;
-      ptrans[0] = (mu_transport_t) fstr->fd;
-      ptrans[1] = NULL;
-      break;
-
-    case MU_IOCTL_SET_TRANSPORT:
-      if (!ptr)
-       return EINVAL;
-      ptrans = ptr;
-      fstr->fd = (int) ptrans[0];
-      break;
-      
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
-      if (!ptr)
-       return EINVAL;
-      else
+      switch (opcode)
        {
-         struct mu_buffer_query *qp = ptr;
-         return mu_stream_get_buffer (str, qp);
+       case MU_IOCTL_OP_GET:
+         ptrans = ptr;
+         ptrans[0] = (mu_transport_t) fstr->fd;
+         ptrans[1] = NULL;
+         break;
+
+       case MU_IOCTL_OP_SET:
+         ptrans = ptr;
+         fstr->fd = (int) ptrans[0];
+         break;
        }
-      
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
+      break;
+
+    case MU_IOCTL_TRANSPORT_BUFFER:
       if (!ptr)
        return EINVAL;
       else
        {
          struct mu_buffer_query *qp = ptr;
-         return mu_stream_set_buffer (str, qp->buftype, qp->bufsize);
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             return mu_stream_get_buffer (str, qp);
+           case MU_IOCTL_OP_SET:
+             return mu_stream_set_buffer (str, qp->buftype, qp->bufsize);
+           }
        }
+      break;
 
-    case MU_IOCTL_SET_ECHO:
+    case MU_IOCTL_ECHO:
       if (!ptr)
        return EINVAL;
-      else
+      switch (opcode)
        {
-         int status;
-         struct termios t;
-         int state = *(int*)ptr;
+       case MU_IOCTL_OP_GET:
+         *(int*)ptr = fstr->flags & _MU_FILE_STREAM_ECHO_OFF;
+         break;
+       case MU_IOCTL_OP_SET:
+         {
+           int status;
+           struct termios t;
+           int state = *(int*)ptr;
 #if HAVE_TCGETATTR
-         if (state == 0)
-           {
-             if (fstr->flags & _MU_FILE_STREAM_ECHO_OFF)
-               return 0;
-             status = tcgetattr (fstr->fd, &t);
-             if (status == 0)
-               {
-                 fstr->echo_state = malloc (sizeof (t));
-                 if (!fstr->echo_state)
-                   return ENOMEM;
-                 memcpy (fstr->echo_state, &t, sizeof (t));
-
-                 t.c_lflag &= ~(ECHO | ISIG);
-                 status = tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT, &t);
-                 if (status == 0)
-                   fstr->flags |= _MU_FILE_STREAM_ECHO_OFF;
-               }
-             if (status)
-               {
+           if (state == 0)
+             {
+               if (fstr->flags & _MU_FILE_STREAM_ECHO_OFF)
+                 return 0;
+               status = tcgetattr (fstr->fd, &t);
+               if (status == 0)
+                 {
+                   fstr->echo_state = malloc (sizeof (t));
+                   if (!fstr->echo_state)
+                     return ENOMEM;
+                   memcpy (fstr->echo_state, &t, sizeof (t));
+                   
+                   t.c_lflag &= ~(ECHO | ISIG);
+                   status = tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT, &t);
+                   if (status == 0)
+                     fstr->flags |= _MU_FILE_STREAM_ECHO_OFF;
+                 }
+               if (status)
+                 {
+                   status = errno;
+                   if (fstr->echo_state)
+                     {
+                       free (fstr->echo_state);
+                       fstr->echo_state = NULL;
+                     }
+                 }
+             }
+           else
+             {
+               if (!(fstr->flags & _MU_FILE_STREAM_ECHO_OFF))
+                 return 0;
+               if (tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT,
+                              fstr->echo_state))
                  status = errno;
-                 if (fstr->echo_state)
-                   {
-                     free (fstr->echo_state);
-                     fstr->echo_state = NULL;
-                   }
-               }
-           }
-         else
-           {
-             if (!(fstr->flags & _MU_FILE_STREAM_ECHO_OFF))
-               return 0;
-             if (tcsetattr (fstr->fd, TCSAFLUSH | TCSASOFT, fstr->echo_state))
-               status = errno;
-             else
-               {
-                 status = 0;
-                 free (fstr->echo_state);
-                 fstr->echo_state = NULL;
-                 fstr->flags &= ~_MU_FILE_STREAM_ECHO_OFF;
-               }
-           }
-         return status;
+               else
+                 {
+                   status = 0;
+                   free (fstr->echo_state);
+                   fstr->echo_state = NULL;
+                   fstr->flags &= ~_MU_FILE_STREAM_ECHO_OFF;
+                 }
+             }
+           return status;
 #else
-         return ENOSYS;
+           return ENOSYS;
 #endif
+         }
        }
-      
-    case MU_IOCTL_GET_ECHO:
-      if (!ptr)
-       return EINVAL;
-      else
-       *(int*)ptr = fstr->flags & _MU_FILE_STREAM_ECHO_OFF;
       break;
-         
+      
     default:
       return ENOSYS;
     }
diff --git a/libmailutils/stream/fltstream.c b/libmailutils/stream/fltstream.c
index ea08c81..87ce1bb 100644
--- a/libmailutils/stream/fltstream.c
+++ b/libmailutils/stream/fltstream.c
@@ -358,23 +358,29 @@ filter_seek (struct _mu_stream *stream, mu_off_t off, 
mu_off_t *ppos)
 }
 
 static int
-filter_ctl (struct _mu_stream *stream, int op, void *ptr)
+filter_ctl (struct _mu_stream *stream, int code, int opcode, void *ptr)
 {
   struct _mu_filter_stream *fs = (struct _mu_filter_stream *)stream;
-  mu_transport_t *ptrans;
 
-  switch (op)
+  switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
-      if (!ptr)
-       return EINVAL;
-      ptrans = ptr;
-      ptrans[0] = (mu_transport_t) fs->transport;
-      ptrans[1] = NULL;
-      break;
-
+    case MU_IOCTL_TRANSPORT:
+      switch (opcode)
+       {
+       case MU_IOCTL_OP_GET:
+         if (!ptr)
+           return EINVAL;
+         else
+           {
+             mu_transport_t *ptrans = ptr;
+             ptrans[0] = (mu_transport_t) fs->transport;
+             ptrans[1] = NULL;
+           }
+         break;
+       }
+      /* fall through */
     default:
-      return mu_stream_ioctl (fs->transport, op, ptr);
+      return mu_stream_ioctl (fs->transport, code, opcode, ptr);
     }
   return 0;
 }
diff --git a/libmailutils/stream/iostream.c b/libmailutils/stream/iostream.c
index d2185f7..01bb13e 100644
--- a/libmailutils/stream/iostream.c
+++ b/libmailutils/stream/iostream.c
@@ -126,62 +126,70 @@ _iostream_done (struct _mu_stream *str)
 }
 
 static int
-_iostream_ctl (struct _mu_stream *str, int op, void *arg)
+_iostream_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
 {
   struct _mu_iostream *sp = (struct _mu_iostream *)str;
-  mu_transport_t *ptrans;
 
-  switch (op)
+  switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
-      if (!arg)
-       return EINVAL;
-      ptrans = arg;
-      ptrans[0] = (mu_transport_t) sp->transport[_MU_STREAM_INPUT];
-      ptrans[1] = (mu_transport_t) sp->transport[_MU_STREAM_OUTPUT];
-      break;
-
-    case MU_IOCTL_SET_TRANSPORT:
-      if (!arg)
-       return EINVAL;
-      ptrans = arg;
-      sp->transport[_MU_STREAM_INPUT] = (mu_stream_t) ptrans[0];
-      sp->transport[_MU_STREAM_OUTPUT] = (mu_stream_t) ptrans[1];
-      break;
-
-    case MU_IOCTL_GET_STREAM:
+    case MU_IOCTL_TRANSPORT:
       if (!arg)
        return EINVAL;
       else
        {
-         mu_stream_t *pstr = arg;
+         mu_transport_t *ptrans = arg;
 
-         pstr[0] = sp->transport[0];
-         mu_stream_ref (pstr[0]);
-         pstr[1] = sp->transport[1];
-         mu_stream_ref (pstr[1]);
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) sp->transport[_MU_STREAM_INPUT];
+             ptrans[1] = (mu_transport_t) sp->transport[_MU_STREAM_OUTPUT];
+             break;
+
+           case MU_IOCTL_OP_SET:
+             ptrans = arg;
+             sp->transport[_MU_STREAM_INPUT] = (mu_stream_t) ptrans[0];
+             sp->transport[_MU_STREAM_OUTPUT] = (mu_stream_t) ptrans[1];
+             break;
+
+           default:
+             return EINVAL;
+           }
        }
       break;
 
-    case MU_IOCTL_SET_STREAM:
+    case MU_IOCTL_SUBSTREAM:
       if (!arg)
        return EINVAL;
       else
        {
          mu_stream_t *pstr = arg;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             pstr[0] = sp->transport[0];
+             mu_stream_ref (pstr[0]);
+             pstr[1] = sp->transport[1];
+             mu_stream_ref (pstr[1]);
+             break;
+
+           case MU_IOCTL_OP_SET:
+             mu_stream_unref (sp->transport[0]);
+             sp->transport[0] = pstr[0];
+             mu_stream_ref (sp->transport[0]);
+             
+             mu_stream_unref (sp->transport[1]);
+             sp->transport[1] = pstr[1];
+             mu_stream_ref (sp->transport[1]);
+             break;
 
-         mu_stream_unref (sp->transport[0]);
-         sp->transport[0] = pstr[0];
-         mu_stream_ref (sp->transport[0]);
-         
-         mu_stream_unref (sp->transport[1]);
-         sp->transport[1] = pstr[1];
-         mu_stream_ref (sp->transport[1]);
+           default:
+             return EINVAL;
+           }
        }
       break;
 
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
+    case MU_IOCTL_TRANSPORT_BUFFER:
       if (!arg)
        return EINVAL;
       else
@@ -189,7 +197,7 @@ _iostream_ctl (struct _mu_stream *str, int op, void *arg)
          struct mu_buffer_query *qp = arg;
          if (!MU_TRANSPORT_VALID_TYPE (qp->type) || !sp->transport[qp->type])
            return EINVAL;
-         return mu_stream_ioctl (sp->transport[qp->type], op, arg);
+         return mu_stream_ioctl (sp->transport[qp->type], code, opcode, arg);
        }
       
     default:
diff --git a/libmailutils/stream/logstream.c b/libmailutils/stream/logstream.c
index 6b63e87..67b56e2 100644
--- a/libmailutils/stream/logstream.c
+++ b/libmailutils/stream/logstream.c
@@ -24,6 +24,7 @@
 #include <mailutils/types.h>
 #include <mailutils/errno.h>
 #include <mailutils/cctype.h>
+#include <mailutils/cstr.h>
 #include <mailutils/log.h>
 
 #include <mailutils/nls.h>
@@ -42,6 +43,31 @@ char *_mu_severity_str[] = {
 };
 int _mu_severity_num = MU_ARRAY_SIZE (_mu_severity_str);
 
+int
+mu_severity_from_string (const char *str, unsigned *pn)
+{
+  int i;
+
+  for (i = 0; i < _mu_severity_num; i++)
+    {
+      if (mu_c_strcasecmp (_mu_severity_str[i], str) == 0)
+       {
+         *pn = i;
+         return 0;
+       }
+    }
+  return MU_ERR_NOENT;
+}
+
+int
+mu_severity_to_string (unsigned n, const char **pstr)
+{
+  if (n >= _mu_severity_num)
+    return MU_ERR_NOENT;
+  *pstr = _mu_severity_str[n];
+  return 0;
+}
+
 static int
 _locus_set_file (struct mu_locus *loc, const char *file, size_t len)
 {
@@ -167,13 +193,31 @@ _log_write (struct _mu_stream *str, const char *buf, 
size_t size,
   if (severity >= _mu_severity_num)
     severity = MU_LOG_EMERG;
 
-  mu_stream_ioctl (sp->transport, MU_IOCTL_LOGSTREAM_SET_SEVERITY, &severity);
+  if (fname)
+    {
+      loc.mu_file = NULL;
+      _locus_set_file (&loc, fname, flen);
+    }
   
-  if (logmode & MU_LOGMODE_LOCUS)
+  if (save_locus)
+    {
+      _locus_set_file (&sp->locus, loc.mu_file, strlen (loc.mu_file));
+      _locus_set_line (&sp->locus, loc.mu_line);
+      _locus_set_col (&sp->locus, loc.mu_col);
+    }
+  
+  if (severity < sp->threshold)
     {
       if (fname)
-       _locus_set_file (&loc, fname, flen);
-
+       free (loc.mu_file);
+      return 0;
+    }
+  
+  mu_stream_ioctl (sp->transport, MU_IOCTL_LOGSTREAM,
+                  MU_IOCTL_LOGSTREAM_SET_SEVERITY, &severity);
+  
+  if (logmode & MU_LOGMODE_LOCUS)
+    {
       if (loc.mu_file)
        {
          mu_stream_write (sp->transport, loc.mu_file,
@@ -188,13 +232,6 @@ _log_write (struct _mu_stream *str, const char *buf, 
size_t size,
        }
     }
 
-  if (save_locus)
-    {
-      _locus_set_file (&sp->locus, loc.mu_file, strlen (loc.mu_file));
-      _locus_set_line (&sp->locus, loc.mu_line);
-      _locus_set_col (&sp->locus, loc.mu_col);
-    }
-  
   if (fname)
     free (loc.mu_file);
   
@@ -242,110 +279,141 @@ _log_setbuf_hook (mu_stream_t str, enum mu_buffer_type 
type, size_t size)
 }
 
 static int
-_log_ctl (struct _mu_stream *str, int op, void *arg)
+_log_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
 {
   struct _mu_log_stream *sp = (struct _mu_log_stream *)str;
-  mu_transport_t *ptrans;
   
-  switch (op)
+  switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!arg)
        return EINVAL;
-      ptrans = arg;
-      ptrans[0] = (mu_transport_t) sp->transport;
-      ptrans[1] = NULL;
-      break;
-
-    case MU_IOCTL_SET_TRANSPORT:
-      if (!arg)
-       return EINVAL;
-      ptrans = arg;
-      if (ptrans[0])
-       sp->transport = (mu_stream_t) ptrans[0];
+      else
+       {
+         mu_transport_t *ptrans = arg;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) sp->transport;
+             ptrans[1] = NULL;
+             break;
+
+           case MU_IOCTL_OP_SET:
+             ptrans = arg;
+             if (ptrans[0])
+               sp->transport = (mu_stream_t) ptrans[0];
+             break;
+
+           default:
+             return EINVAL;
+           }
+       }
       break;
 
-    case MU_IOCTL_LOGSTREAM_GET_SEVERITY:
-      if (!arg)
-       return EINVAL;
-      *(unsigned*)arg = sp->severity;
-      break;
+    case MU_IOCTL_LOGSTREAM:
+      switch (opcode)
+       {
+       case MU_IOCTL_LOGSTREAM_GET_SEVERITY:
+         if (!arg)
+           return EINVAL;
+         *(unsigned*)arg = sp->severity;
+         break;
       
-    case MU_IOCTL_LOGSTREAM_SET_SEVERITY:
-      if (!arg)
-       return EINVAL;
-      if (*(unsigned*)arg >= _mu_severity_num)
-       return EINVAL;
-      sp->severity = *(unsigned*)arg;
-      break;
+       case MU_IOCTL_LOGSTREAM_SET_SEVERITY:
+         if (!arg)
+           return EINVAL;
+         if (*(unsigned*)arg >= _mu_severity_num)
+           return EINVAL;
+         sp->severity = *(unsigned*)arg;
+         break;
 
-    case MU_IOCTL_LOGSTREAM_GET_MODE:
-      if (!arg)
-       return EINVAL;
-      *(int*)arg = sp->logmode;
-      break;
+       case MU_IOCTL_LOGSTREAM_GET_MODE:
+         if (!arg)
+           return EINVAL;
+         *(int*)arg = sp->logmode;
+         break;
 
-    case MU_IOCTL_LOGSTREAM_SET_MODE:
-      if (!arg)
-       return EINVAL;
-      sp->logmode = *(int*)arg;
-      break;
+       case MU_IOCTL_LOGSTREAM_SET_MODE:
+         if (!arg)
+           return EINVAL;
+         sp->logmode = *(int*)arg;
+         break;
       
-    case MU_IOCTL_LOGSTREAM_GET_LOCUS:
-      {
-       struct mu_locus *ploc = arg;
-       if (!arg)
-         return EINVAL;
-       if (sp->locus.mu_file)
-         {
-           ploc->mu_file = strdup (sp->locus.mu_file);
-           if (!ploc->mu_file)
-             return ENOMEM;
-         }
-       else
-         ploc->mu_file = NULL;
-       ploc->mu_line = sp->locus.mu_line;
-       ploc->mu_col = sp->locus.mu_col;
-       break;
-      }
+       case MU_IOCTL_LOGSTREAM_GET_LOCUS:
+         if (!arg)
+           return EINVAL;
+         else
+           {
+             struct mu_locus *ploc = arg;
+             if (sp->locus.mu_file)
+               {
+                 ploc->mu_file = strdup (sp->locus.mu_file);
+                 if (!ploc->mu_file)
+                   return ENOMEM;
+               }
+             else
+               ploc->mu_file = NULL;
+             ploc->mu_line = sp->locus.mu_line;
+             ploc->mu_col = sp->locus.mu_col;
+           }
+         break;
        
-    case MU_IOCTL_LOGSTREAM_SET_LOCUS:
-      {
-       struct mu_locus *ploc = arg;
-       if (!arg)
+       case MU_IOCTL_LOGSTREAM_SET_LOCUS:
          {
-           free (sp->locus.mu_file);
-           sp->locus.mu_file = NULL;
-           sp->locus.mu_line = 0;
-           sp->locus.mu_col = 0;
+           struct mu_locus *ploc = arg;
+           if (!arg)
+             {
+               free (sp->locus.mu_file);
+               sp->locus.mu_file = NULL;
+               sp->locus.mu_line = 0;
+               sp->locus.mu_col = 0;
+             }
+           else
+             {
+               if (ploc->mu_file)
+                 _locus_set_file (&sp->locus, ploc->mu_file,
+                                  strlen (ploc->mu_file));
+               if (ploc->mu_line)
+                 _locus_set_line (&sp->locus, ploc->mu_line);
+               if (ploc->mu_col)
+                 _locus_set_col (&sp->locus, ploc->mu_col);
+             }
+           break;
          }
-       else
-         {
-           if (ploc->mu_file)
-             _locus_set_file (&sp->locus, ploc->mu_file,
-                              strlen (ploc->mu_file));
-           if (ploc->mu_line)
-             _locus_set_line (&sp->locus, ploc->mu_line);
-           if (ploc->mu_col)
-             _locus_set_col (&sp->locus, ploc->mu_col);
-         }
-       break;
-      }
 
-    case MU_LOGSTREAM_ADVANCE_LOCUS_LINE:
-      if (!arg)
-       sp->locus.mu_line++;
-      else
-       sp->locus.mu_line += *(int*)arg;
-      break;
+       case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE:
+         if (!arg)
+           sp->locus.mu_line++;
+         else
+           sp->locus.mu_line += *(int*)arg;
+         break;
 
-    case MU_LOGSTREAM_ADVANCE_LOCUS_COL:
-      if (!arg)
-       sp->locus.mu_col++;
-      else
-       sp->locus.mu_col += *(int*)arg;
+       case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL:
+         if (!arg)
+           sp->locus.mu_col++;
+         else
+           sp->locus.mu_col += *(int*)arg;
+         break;
+
+       case MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY:
+         if (!arg)
+           sp->threshold = MU_LOG_DEBUG;
+         else if (*(unsigned*)arg >= _mu_severity_num)
+           return MU_ERR_NOENT;
+         sp->threshold = *(unsigned*)arg;
+         break;
+         
+       case MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME:
+         if (!arg)
+           sp->threshold = MU_LOG_DEBUG;
+         else
+           return mu_severity_from_string ((const char *) arg, &sp->threshold);
+
+       default:
+         return EINVAL;
+       }
       break;
-       
+      
     default:
       return ENOSYS;
     }
diff --git a/libmailutils/stream/mapfile_stream.c 
b/libmailutils/stream/mapfile_stream.c
index 3cd7c6d..9803af6 100644
--- a/libmailutils/stream/mapfile_stream.c
+++ b/libmailutils/stream/mapfile_stream.c
@@ -206,30 +206,50 @@ _mapfile_flush (mu_stream_t stream)
 }
 
 static int
-_mapfile_ioctl (struct _mu_stream *str, int code, void *ptr)
+_mapfile_ioctl (struct _mu_stream *str, int code, int opcode, void *ptr)
 {
   struct _mu_mapfile_stream *mfs = (struct _mu_mapfile_stream *) str;
-  mu_transport_t ptrans[2];
   
   switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
-      ptrans[0] = (mu_transport_t) mfs->fd;
-      ptrans[1] = NULL;
+    case MU_IOCTL_TRANSPORT:
+      if (!ptr)
+       return EINVAL;
+      else
+       {
+         mu_transport_t *ptrans = ptr;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) mfs->fd;
+             ptrans[1] = NULL;
+             break;
+           case MU_IOCTL_OP_SET:
+             return ENOSYS;
+           default:
+             return EINVAL;
+           }
+       }
       break;
 
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
-      {
-        struct mu_buffer_query *qp = ptr;
-       return mu_stream_get_buffer (str, qp);
-      }
+    case MU_IOCTL_TRANSPORT_BUFFER:
+      if (!ptr)
+       return EINVAL;
+      else
+       {
+         struct mu_buffer_query *qp = ptr;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             return mu_stream_get_buffer (str, qp);
+           case MU_IOCTL_OP_SET:
+             return mu_stream_set_buffer (str, qp->buftype, qp->bufsize);
+           default:
+             return EINVAL;
+           }
+       }
+      break;
       
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
-      {
-        struct mu_buffer_query *qp = ptr;
-       return mu_stream_set_buffer (str, qp->buftype, qp->bufsize);
-      }
-
     default:
       return ENOSYS;
     }
diff --git a/libmailutils/stream/memory_stream.c 
b/libmailutils/stream/memory_stream.c
index 84aa534..36cd77b 100644
--- a/libmailutils/stream/memory_stream.c
+++ b/libmailutils/stream/memory_stream.c
@@ -144,32 +144,49 @@ _memory_open (mu_stream_t stream)
 }
 
 static int
-_memory_ioctl (struct _mu_stream *stream, int code, void *ptr)
+_memory_ioctl (struct _mu_stream *stream, int code, int opcode, void *ptr)
 {
   struct _mu_memory_stream *mfs = (struct _mu_memory_stream *) stream;
-  mu_transport_t *ptrans;
   
   switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!ptr)
        return EINVAL;
-      ptrans = ptr;
-      ptrans[0] = (mu_transport_t) mfs->ptr;
-      ptrans[1] = NULL;
+      else
+       {
+         mu_transport_t *ptrans = ptr;
+         switch (code)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) mfs->ptr;
+             ptrans[1] = NULL;
+             break;
+           case MU_IOCTL_OP_SET:
+             return ENOSYS;
+           default:
+             return EINVAL;
+           }
+       }
+      break;
+             
+    case MU_IOCTL_TRANSPORT_BUFFER:
+      if (!ptr)
+       return EINVAL;
+      else
+       {
+         struct mu_buffer_query *qp = ptr;
+         switch (code)
+           {
+           case MU_IOCTL_OP_GET:
+             return mu_stream_get_buffer (stream, qp);
+           case MU_IOCTL_OP_SET:
+             return mu_stream_set_buffer (stream, qp->buftype, qp->bufsize);
+           default:
+             return EINVAL;
+           }
+       }
       break;
-
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
-      {
-        struct mu_buffer_query *qp = ptr;
-       return mu_stream_get_buffer (stream, qp);
-      }
-      
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
-      {
-        struct mu_buffer_query *qp = ptr;
-       return mu_stream_set_buffer (stream, qp->buftype, qp->bufsize);
-      }
       
     default:
       return ENOSYS;
diff --git a/libmailutils/stream/nullstream.c b/libmailutils/stream/nullstream.c
index 50c174f..dd2c219 100644
--- a/libmailutils/stream/nullstream.c
+++ b/libmailutils/stream/nullstream.c
@@ -108,11 +108,14 @@ _nullstream_truncate (struct _mu_stream *str, mu_off_t 
size)
 }
 
 static int
-_nullstream_ctl (struct _mu_stream *str, int op, void *arg)
+_nullstream_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
 {
   struct _mu_nullstream *np = (struct _mu_nullstream *)str;
 
-  switch (op)
+  if (code != MU_IOCTL_NULLSTREAM)
+    /* Only this code is supported */
+    return ENOSYS;
+  switch (opcode)
     {
     case MU_IOCTL_NULLSTREAM_SET_PATTERN:
       if (!arg)
diff --git a/libmailutils/stream/prog_stream.c 
b/libmailutils/stream/prog_stream.c
index c05c91e..ddf3944 100644
--- a/libmailutils/stream/prog_stream.c
+++ b/libmailutils/stream/prog_stream.c
@@ -352,33 +352,54 @@ _prog_flush (mu_stream_t stream)
 }
 
 static int
-_prog_ioctl (struct _mu_stream *str, int code, void *ptr)
+_prog_ioctl (struct _mu_stream *str, int code, int opcode, void *ptr)
 {
   struct _mu_prog_stream *fstr = (struct _mu_prog_stream *) str;
-  mu_transport_t t[2];
-  mu_transport_t *ptrans;
   
   switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!ptr)
        return EINVAL;
-      mu_stream_ioctl (fstr->in, MU_IOCTL_GET_TRANSPORT, t);
-      ptrans[0] = t[0];
-      mu_stream_ioctl (fstr->out, MU_IOCTL_GET_TRANSPORT, t);
-      ptrans[1] = t[1];
-      break;
+      else
+       {
+         mu_transport_t *ptrans = ptr;
+         mu_transport_t t[2];
 
-    case MU_IOCTL_GET_STATUS:
-      if (!ptr)
-       return EINVAL;
-      *(int*)ptr = fstr->status;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             mu_stream_ioctl (fstr->in, MU_IOCTL_TRANSPORT,
+                              MU_IOCTL_OP_GET, t);
+             ptrans[0] = t[0];
+             mu_stream_ioctl (fstr->out, MU_IOCTL_TRANSPORT,
+                              MU_IOCTL_OP_GET, t);
+             ptrans[1] = t[1];
+             break;
+           case MU_IOCTL_OP_SET:
+             return ENOSYS;
+           default:
+             return EINVAL;
+           }
+       }
       break;
 
-    case MU_IOCTL_GET_PID:
+    case MU_IOCTL_PROGSTREAM:
       if (!ptr)
        return EINVAL;
-      *(int*)ptr = fstr->pid;
+      switch (opcode)
+       {
+       case MU_IOCTL_PROG_STATUS:
+         *(int*)ptr = fstr->status;
+         break;
+
+       case MU_IOCTL_PROG_PID:
+         *(pid_t*)ptr = fstr->pid;
+         break;
+
+       default:
+         return EINVAL;
+       }
       break;
       
     default:
diff --git a/libmailutils/stream/rdcache_stream.c 
b/libmailutils/stream/rdcache_stream.c
index c1d0013..df6e487 100644
--- a/libmailutils/stream/rdcache_stream.c
+++ b/libmailutils/stream/rdcache_stream.c
@@ -116,23 +116,34 @@ rdcache_wait (struct _mu_stream *str, int *pflags, struct 
timeval *tvp)
 /* FIXME: Truncate? */
 
 static int
-rdcache_ioctl (struct _mu_stream *str, int op, void *arg)
+rdcache_ioctl (struct _mu_stream *str, int code, int opcode, void *arg)
 {
   struct _mu_rdcache_stream *sp = (struct _mu_rdcache_stream *) str;
-  mu_transport_t *ptrans;
 
-  switch (op)
+  switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!arg)
        return EINVAL;
-      ptrans = arg;
-      ptrans[0] = (mu_transport_t) sp->transport;
-      ptrans[1] = NULL;
-      break;
+      else
+       {
+         mu_transport_t *ptrans = arg;
 
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) sp->transport;
+             ptrans[1] = NULL;
+             break;
+           case MU_IOCTL_OP_SET:
+             return ENOSYS;
+           default:
+             return EINVAL;
+           }
+       }
+      break;
+             
+    case MU_IOCTL_TRANSPORT_BUFFER:
       if (!arg)
        return EINVAL;
       else
@@ -140,7 +151,7 @@ rdcache_ioctl (struct _mu_stream *str, int op, void *arg)
          struct mu_buffer_query *qp = arg;
          if (qp->type != MU_TRANSPORT_INPUT || !sp->transport)
            return EINVAL;
-         return mu_stream_ioctl (sp->transport, op, arg);
+         return mu_stream_ioctl (sp->transport, code, opcode, arg);
        }
 
     default:
diff --git a/libmailutils/stream/stream.c b/libmailutils/stream/stream.c
index 4cd5041..45efe3b 100644
--- a/libmailutils/stream/stream.c
+++ b/libmailutils/stream/stream.c
@@ -1124,11 +1124,11 @@ mu_stream_size (mu_stream_t stream, mu_off_t *psize)
 }
 
 int
-mu_stream_ioctl (mu_stream_t stream, int code, void *ptr)
+mu_stream_ioctl (mu_stream_t stream, int family, int opcode, void *ptr)
 {
   if (stream->ctl == NULL)
     return ENOSYS;
-  return stream->ctl (stream, code, ptr);
+  return stream->ctl (stream, family, opcode, ptr);
 }
 
 int
@@ -1150,7 +1150,7 @@ mu_stream_wait (mu_stream_t stream, int *pflags, struct 
timeval *tvp)
       _stream_init (stream);
     }
 #endif
-  /* Take to acount if we have any buffering.  */
+  /* Take into account if we have any buffering.  */
   /* FIXME: How about MU_STREAM_READY_WR? */
   if ((*pflags) & MU_STREAM_READY_RD 
       && stream->buftype != mu_buffer_none
diff --git a/libmailutils/stream/streamref.c b/libmailutils/stream/streamref.c
index 0558449..502cbf5 100644
--- a/libmailutils/stream/streamref.c
+++ b/libmailutils/stream/streamref.c
@@ -201,30 +201,38 @@ _streamref_size (struct _mu_stream *str, mu_off_t *psize)
 }
 
 static int
-_streamref_ctl (struct _mu_stream *str, int op, void *arg)
+_streamref_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
 {
   struct _mu_streamref *sp = (struct _mu_streamref *)str;
-  mu_off_t *lim;
   
-  switch (op)
+  switch (code)
     {
-    case MU_IOCTL_ABRIDGE_SEEK:
+    case MU_IOCTL_SEEK_LIMITS:
       if (!arg)
        return EINVAL;
-      lim = arg;
-      sp->start = lim[0];
-      sp->end = lim[1];
-      return 0;
+      else
+       {
+         mu_off_t *lim;
 
-    case MU_IOCTL_GET_SEEK_LIMITS:
-      if (!arg)
-       return EINVAL;
-      lim = arg;
-      lim[0] = sp->start;
-      lim[1] = sp->end;
-      return 0;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             lim[0] = sp->start;
+             lim[1] = sp->end;
+             return 0;
+
+           case MU_IOCTL_OP_SET:
+             sp->start = lim[0];
+             sp->end = lim[1];
+             return 0;
+
+           default:
+             return EINVAL;
+           }
+       }
     }
-  return streamref_return (sp, mu_stream_ioctl (sp->transport, op, arg));
+  return streamref_return (sp, mu_stream_ioctl (sp->transport, code,
+                                               opcode, arg));
 }
 
 static int
diff --git a/libmailutils/stream/syslogstream.c 
b/libmailutils/stream/syslogstream.c
index 6ff919e..3ccbb79 100644
--- a/libmailutils/stream/syslogstream.c
+++ b/libmailutils/stream/syslogstream.c
@@ -52,12 +52,15 @@ static int sev2prio[] = {
 };
 
 static int
-_syslog_ctl (struct _mu_stream *str, int op, void *arg)
+_syslog_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
 {
   struct _mu_syslog_stream *sp = (struct _mu_syslog_stream *)str;
   unsigned n;
+
+  if (code != MU_IOCTL_LOGSTREAM)
+    return ENOSYS;
   
-  switch (op)
+  switch (opcode)
     {
     case MU_IOCTL_LOGSTREAM_GET_SEVERITY:
       if (!arg)
diff --git a/libmailutils/stream/tcp.c b/libmailutils/stream/tcp.c
index c719be8..c225267 100644
--- a/libmailutils/stream/tcp.c
+++ b/libmailutils/stream/tcp.c
@@ -193,21 +193,32 @@ _tcp_open (mu_stream_t stream)
 }
 
 static int
-_tcp_ioctl (mu_stream_t stream, int code, void *ptr)
+_tcp_ioctl (mu_stream_t stream, int code, int opcode, void *ptr)
 {
   struct _tcp_instance *tcp = (struct _tcp_instance *)stream;
-  mu_transport_t *ptrans;
 
   switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!ptr)
        return EINVAL;
-      ptrans = ptr;
-      ptrans[0] = (mu_transport_t) tcp->fd;
-      ptrans[1] = NULL;
+      else
+       {
+         mu_transport_t *ptrans = ptr;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) tcp->fd;
+             ptrans[1] = NULL;
+             break;
+           case MU_IOCTL_OP_SET:
+             return ENOSYS;
+           default:
+             return EINVAL;
+           }
+       }
       break;
-
+      
     default:
       return ENOSYS;
     }
diff --git a/libmailutils/stream/xscript-stream.c 
b/libmailutils/stream/xscript-stream.c
index ff5d796..578fbea 100644
--- a/libmailutils/stream/xscript-stream.c
+++ b/libmailutils/stream/xscript-stream.c
@@ -254,106 +254,119 @@ _xscript_size (struct _mu_stream *str, mu_off_t *psize)
 }
 
 static int
-_xscript_ctl (struct _mu_stream *str, int op, void *arg)
+_xscript_ctl (struct _mu_stream *str, int code, int opcode, void *arg)
 {
   struct _mu_xscript_stream *sp = (struct _mu_xscript_stream *)str;
-  mu_transport_t *ptrans;
   int status = 0;
   
-  switch (op)
+  switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!arg)
        return EINVAL;
-      ptrans = arg;
-      ptrans[0] = (mu_transport_t) sp->transport;
-      ptrans[1] = (mu_transport_t) sp->logstr;
-      break;
-
-    case MU_IOCTL_SET_TRANSPORT:
-      if (!arg)
-       return EINVAL;
-      ptrans = arg;
-      if (ptrans[0])
-       sp->transport = (mu_stream_t) ptrans[0];
-      if (ptrans[1])
-       sp->logstr = (mu_stream_t) ptrans[1];
-      break;
-
-    case MU_IOCTL_GET_STREAM:
-      if (!arg)
-       return EINVAL;
-      if (!sp->transport)
-       status = ENOSYS;
       else
-       status = mu_stream_ioctl (sp->transport, op, arg);
-      if (status == EINVAL || status == ENOSYS)
        {
-         mu_stream_t *pstr = arg;
-
-         pstr[0] = sp->transport;
-         mu_stream_ref (pstr[0]);
-         pstr[1] = sp->transport;
-         mu_stream_ref (pstr[1]);
-         status = 0;
+         mu_transport_t *ptrans = arg;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) sp->transport;
+             ptrans[1] = (mu_transport_t) sp->logstr;
+             break;
+
+           case MU_IOCTL_OP_SET:
+             ptrans = arg;
+             if (ptrans[0])
+               sp->transport = (mu_stream_t) ptrans[0];
+             if (ptrans[1])
+               sp->logstr = (mu_stream_t) ptrans[1];
+             break;
+
+           default:
+             return EINVAL;
+           }
        }
       break;
 
-    case MU_IOCTL_SET_STREAM:
+    case MU_IOCTL_SUBSTREAM:
       if (!arg)
        return EINVAL;
-      if (!sp->transport)
-       status = ENOSYS;
-      else
-       status = mu_stream_ioctl (sp->transport, op, arg);
-      if (status == EINVAL || status == ENOSYS)
+      switch (opcode)
        {
-         mu_stream_t *pstr = arg;
-         mu_stream_t tmp;
-         
-         if (pstr[0] != pstr[1])
-           {
-             status = mu_iostream_create (&tmp, pstr[0], pstr[1]);
-             if (status)
-               return status;
-             sp->flags |= TRANS_IOSTREAM;
-           }
+       case MU_IOCTL_OP_GET:
+         if (!sp->transport)
+           status = ENOSYS;
          else
+           status = mu_stream_ioctl (sp->transport, code, opcode, arg);
+         if (status == EINVAL || status == ENOSYS)
            {
-             tmp = pstr[0];
-             mu_stream_ref (tmp);
-             mu_stream_ref (tmp);
+             mu_stream_t *pstr = arg;
+
+             pstr[0] = sp->transport;
+             mu_stream_ref (pstr[0]);
+             pstr[1] = sp->transport;
+             mu_stream_ref (pstr[1]);
              status = 0;
            }
+         break;
+
+       case MU_IOCTL_OP_SET:
+         if (!sp->transport)
+           status = ENOSYS;
+         else
+           status = mu_stream_ioctl (sp->transport, code, opcode, arg);
+         if (status == EINVAL || status == ENOSYS)
+           {
+             mu_stream_t *pstr = arg;
+             mu_stream_t tmp;
+         
+             if (pstr[0] != pstr[1])
+               {
+                 status = mu_iostream_create (&tmp, pstr[0], pstr[1]);
+                 if (status)
+                   return status;
+                 sp->flags |= TRANS_IOSTREAM;
+               }
+             else
+               {
+                 tmp = pstr[0];
+                 mu_stream_ref (tmp);
+                 mu_stream_ref (tmp);
+                 status = 0;
+               }
 
-         mu_stream_unref (sp->transport);
-         sp->transport = tmp;
+             mu_stream_unref (sp->transport);
+             sp->transport = tmp;
+           }
        }
       break;
 
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
-      {
-        if (!sp->transport)
-          return EINVAL;
-        return mu_stream_ioctl (sp->transport, op, arg);
-      }
+    case MU_IOCTL_TRANSPORT_BUFFER:
+      if (!sp->transport)
+       return EINVAL;
+      return mu_stream_ioctl (sp->transport, code, opcode, arg);
 
-    case MU_IOCTL_LEVEL:
+    case  MU_IOCTL_XSCRIPTSTREAM:
       if (!arg)
        return EINVAL;
-      else
+      switch (opcode)
        {
-         int oldlev = sp->level;
-         sp->level = *(int*)arg;
-         sp->flags &= TRANS_DISABLED;
-         sp->flags |= TRANS_READ | TRANS_WRITE;
-         *(int*)arg = oldlev;
+       case MU_IOCTL_XSCRIPTSTREAM_LEVEL:
+         {
+           int oldlev = sp->level;
+           sp->level = *(int*)arg;
+           sp->flags &= TRANS_DISABLED;
+           sp->flags |= TRANS_READ | TRANS_WRITE;
+           *(int*)arg = oldlev;
+         }
+         break;
+       default:
+         return EINVAL;
        }
       break;
       
     default:
-      return mu_stream_ioctl (sp->transport, op, arg);
+      return mu_stream_ioctl (sp->transport, code, opcode, arg);
     }
   return status;
 }
diff --git a/libmu_auth/tls.c b/libmu_auth/tls.c
index 01633c5..80dbf25 100644
--- a/libmu_auth/tls.c
+++ b/libmu_auth/tls.c
@@ -262,19 +262,32 @@ _tls_wr_wait (struct _mu_stream *stream, int *pflags, 
struct timeval *tvp)
 }
 
 static int
-_tls_io_ioctl (struct _mu_stream *stream, int op, void *arg)
+_tls_io_ioctl (struct _mu_stream *stream, int code, int opcode, void *arg)
 {
   struct _mu_tls_io_stream *sp = (struct _mu_tls_io_stream *) stream;
-  mu_transport_t *ptrans;
 
-  switch (op)
+  switch (code)
     {
-    case MU_IOCTL_GET_TRANSPORT:
+    case MU_IOCTL_TRANSPORT:
       if (!arg)
        return EINVAL;
-      ptrans = arg;
-      ptrans[0] = (mu_transport_t) sp->transport;
-      ptrans[1] = NULL;
+      else
+       {
+         mu_transport_t *ptrans = arg;
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             ptrans[0] = (mu_transport_t) sp->transport;
+             ptrans[1] = NULL;
+             break;
+
+           case MU_IOCTL_OP_SET:
+             return ENOSYS;
+
+           default:
+             return EINVAL;
+           }
+       }
       break;
 
     default:
@@ -387,7 +400,7 @@ _tls_server_open (mu_stream_t stream)
   gnutls_certificate_set_dh_params (x509_cred, dh_params);
 
   sp->session = initialize_tls_session ();
-  mu_stream_ioctl (stream, MU_IOCTL_GET_TRANSPORT, transport);
+  mu_stream_ioctl (stream, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, transport);
   gnutls_transport_set_ptr2 (sp->session,
                             (gnutls_transport_ptr) transport[0],
                             (gnutls_transport_ptr) transport[1]);
@@ -441,7 +454,7 @@ prepare_client_session (mu_stream_t stream)
 
   gnutls_credentials_set (sp->session, GNUTLS_CRD_CERTIFICATE, x509_cred);
 
-  mu_stream_ioctl (stream, MU_IOCTL_GET_TRANSPORT, transport);
+  mu_stream_ioctl (stream, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, transport);
   gnutls_transport_set_ptr2 (sp->session,
                             (gnutls_transport_ptr) transport[0],
                             (gnutls_transport_ptr) transport[1]);
@@ -503,54 +516,69 @@ _tls_write (struct _mu_stream *str, const char *buf, 
size_t bufsize,
 }
 
 static int
-_tls_ioctl (struct _mu_stream *stream, int op, void *arg)
+_tls_ioctl (struct _mu_stream *stream, int code, int opcode, void *arg)
 {
   struct _mu_tls_stream *sp = (struct _mu_tls_stream *) stream;
 
-  switch (op)
+  switch (opcode)
     {
-    case MU_IOCTL_GET_TRANSPORT:
-      if (!arg)
-       return EINVAL;
-      else
+    case MU_IOCTL_TRANSPORT:
+      switch (opcode)
        {
-         mu_transport_t *ptrans, trans[2];
-
-         ptrans = arg;
-         mu_stream_ioctl (sp->transport[0], MU_IOCTL_GET_TRANSPORT, trans);
-         ptrans[0] = trans[0];
-         mu_stream_ioctl (sp->transport[1], MU_IOCTL_GET_TRANSPORT, trans);
-         ptrans[1] = trans[0];
+       case MU_IOCTL_OP_GET:
+         if (!arg)
+           return EINVAL;
+         else
+           {
+             mu_transport_t *ptrans, trans[2];
+
+             ptrans = arg;
+             mu_stream_ioctl (sp->transport[0], MU_IOCTL_TRANSPORT,
+                              MU_IOCTL_OP_GET, trans);
+             ptrans[0] = trans[0];
+             mu_stream_ioctl (sp->transport[1], MU_IOCTL_TRANSPORT,
+                              MU_IOCTL_OP_GET, trans);
+             ptrans[1] = trans[0];
+           }
+         break;
+
+       case MU_IOCTL_OP_SET:
+         return ENOSYS;
+
+       default:
+         return EINVAL;
        }
       break;
 
-    case MU_IOCTL_GET_TRANSPORT_BUFFER:
+    case MU_IOCTL_TRANSPORT_BUFFER:
       if (!arg)
        return EINVAL;
       else
        {
          struct mu_buffer_query *qp = arg;
-         if (!MU_TRANSPORT_VALID_TYPE (qp->type) ||
-             !sp->transport[qp->type])
-           return EINVAL;
-         return mu_stream_get_buffer (sp->transport[qp->type], qp);
-       }
-      
-    case MU_IOCTL_SET_TRANSPORT_BUFFER:
-      if (!arg)
-       return EINVAL;
-      else
-       {
-         struct mu_buffer_query *qp = arg;
-         if (!MU_TRANSPORT_VALID_TYPE (qp->type) ||
-             !sp->transport[qp->type])
-           return EINVAL;
-         return mu_stream_set_buffer (sp->transport[qp->type],
-                                      qp->buftype, qp->bufsize);
+         switch (opcode)
+           {
+           case MU_IOCTL_OP_GET:
+             if (!MU_TRANSPORT_VALID_TYPE (qp->type) ||
+                 !sp->transport[qp->type])
+               return EINVAL;
+             return mu_stream_get_buffer (sp->transport[qp->type], qp);
+
+           case MU_IOCTL_OP_SET:
+             if (!MU_TRANSPORT_VALID_TYPE (qp->type) ||
+                 !sp->transport[qp->type])
+               return EINVAL;
+             return mu_stream_set_buffer (sp->transport[qp->type],
+                                          qp->buftype, qp->bufsize);
+
+           default:
+             return EINVAL;
+           }
        }
+      break;
       
     default:
-      return EINVAL;
+      return ENOSYS;
     }
   return 0;
 }
diff --git a/libmu_cfg/common.c b/libmu_cfg/common.c
index 20b38f9..0231a05 100644
--- a/libmu_cfg/common.c
+++ b/libmu_cfg/common.c
@@ -143,11 +143,30 @@ cb_facility (void *data, mu_config_value_t *val)
    return 0;
 }
 
+static int
+cb_severity (void *data, mu_config_value_t *val)
+{
+  unsigned n;
+  
+  if (mu_cfg_assert_value_type (val, MU_CFG_STRING))
+    return 1;
+  if (mu_severity_from_string (val->v.string, &n))
+    {
+      mu_error (_("unknown severity `%s'"), val->v.string);
+      return 1;
+    }
+  mu_log_severity_threshold = n;
+  return 0;
+}      
+
 static struct mu_cfg_param mu_logging_param[] = {
   { "syslog", mu_cfg_bool, &mu_log_syslog, 0, NULL,
     N_("Send diagnostics to syslog.") },
   { "print-severity", mu_cfg_bool, &mu_log_print_severity, 0, NULL,
     N_("Print message severity levels.") },
+  { "severity", mu_cfg_callback, NULL, 0, cb_severity,
+    N_("Output only messages with a severity equal to or greater than "
+       "this one.") },
   { "facility", mu_cfg_callback, NULL, 0, cb_facility,
     N_("Set syslog facility. Arg is one of the following: user, daemon, "
        "auth, authpriv, mail, cron, local0 through local7 (case-insensitive), "
diff --git a/libmu_sieve/runtime.c b/libmu_sieve/runtime.c
index 5be3215..458f3a1 100644
--- a/libmu_sieve/runtime.c
+++ b/libmu_sieve/runtime.c
@@ -42,7 +42,8 @@ void
 _mu_sv_instr_source (mu_sieve_machine_t mach)
 {
   mach->locus.mu_file = (char*) SIEVE_ARG (mach, 0, string);
-  mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS,
+  mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM,
+                   MU_IOCTL_LOGSTREAM_SET_LOCUS,
                   &mach->locus);
   if (INSTR_DEBUG (mach))
     mu_sieve_debug (mach, "%4lu: SOURCE %s",
@@ -55,7 +56,8 @@ void
 _mu_sv_instr_line (mu_sieve_machine_t mach)
 {
   mach->locus.mu_line = SIEVE_ARG (mach, 0, line);
-  mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS,
+  mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM,
+                   MU_IOCTL_LOGSTREAM_SET_LOCUS,
                   &mach->locus);
   if (INSTR_DEBUG (mach))
     mu_sieve_debug (mach, "%4lu: LINE %u",
diff --git a/libmu_sieve/sieve.y b/libmu_sieve/sieve.y
index c7ba97a..7666309 100644
--- a/libmu_sieve/sieve.y
+++ b/libmu_sieve/sieve.y
@@ -536,7 +536,8 @@ mu_sieve_machine_destroy (mu_sieve_machine_t *pmach)
 {
   mu_sieve_machine_t mach = *pmach;
   /* FIXME: Restore stream state (locus & mode) */
-  mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL);
+  mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM,
+                   MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL);
   mu_stream_destroy (&mach->errstream);
   mu_mailer_destroy (&mach->mailer);
   mu_list_do (mach->destr_list, _run_destructor, NULL);
diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c
index 15a8340..e775983 100644
--- a/libmu_sieve/util.c
+++ b/libmu_sieve/util.c
@@ -192,7 +192,8 @@ mu_sv_compile_error (struct mu_locus *ploc, const char 
*fmt, ...)
 
   va_start (ap, fmt);
   mu_sieve_error_count++;
-  mu_stream_ioctl (mu_sieve_machine->errstream, MU_IOCTL_LOGSTREAM_SET_LOCUS,
+  mu_stream_ioctl (mu_sieve_machine->errstream,
+                   MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_LOCUS,
                   ploc);
   mu_stream_printf (mu_sieve_machine->errstream,
                    "\033s<%d>\033O<%d>",
diff --git a/libproto/imap/trace.c b/libproto/imap/trace.c
index 130ecb7..9c95bd6 100644
--- a/libproto/imap/trace.c
+++ b/libproto/imap/trace.c
@@ -76,7 +76,7 @@ _mu_imap_trace_disable (mu_imap_t imap)
   if (!xstr)
     return 0;
   
-  rc = mu_stream_ioctl (xstr, MU_IOCTL_GET_TRANSPORT, stream);
+  rc = mu_stream_ioctl (xstr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, stream);
   if (rc)
     return rc;
 
@@ -138,7 +138,8 @@ mu_imap_trace_mask (mu_imap_t imap, int op, int lev)
 int
 _mu_imap_xscript_level (mu_imap_t imap, int xlev)
 {
-  if (mu_stream_ioctl (imap->carrier, MU_IOCTL_LEVEL, &xlev) == 0)
+  if (mu_stream_ioctl (imap->carrier, MU_IOCTL_XSCRIPTSTREAM,
+                       MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0)
     return xlev;
   return MU_XSCRIPT_NORMAL;
 }
diff --git a/libproto/mailer/smtp_data.c b/libproto/mailer/smtp_data.c
index efe5242..698cde5 100644
--- a/libproto/mailer/smtp_data.c
+++ b/libproto/mailer/smtp_data.c
@@ -47,15 +47,15 @@ _mu_smtp_data_begin (mu_smtp_t smtp)
     _mu_smtp_xscript_level (smtp, MU_XSCRIPT_PAYLOAD);
 
   smtp->savebuf.type = MU_TRANSPORT_OUTPUT;
-  if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_GET_TRANSPORT_BUFFER,
-                      &smtp->savebuf) == 0)
+  if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_TRANSPORT_BUFFER,
+                      MU_IOCTL_OP_GET, &smtp->savebuf) == 0)
     {
       struct mu_buffer_query newbuf;
       newbuf.type = MU_TRANSPORT_OUTPUT;
       newbuf.buftype = mu_buffer_full;
       newbuf.bufsize = 64*1024;
-      if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_SET_TRANSPORT_BUFFER,
-                          &newbuf) == 0)
+      if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_TRANSPORT_BUFFER,
+                          MU_IOCTL_OP_SET, &newbuf) == 0)
        MU_SMTP_FSET (smtp, _MU_SMTP_SAVEBUF);
     }
   return 0;
@@ -68,8 +68,8 @@ _mu_smtp_data_end (mu_smtp_t smtp)
   /* code is always _MU_STR_EVENT_CLOSE */
   if (MU_SMTP_FISSET (smtp, _MU_SMTP_SAVEBUF))
     {
-      status = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SET_TRANSPORT_BUFFER,
-                               &smtp->savebuf);
+      status = mu_stream_ioctl (smtp->carrier, MU_IOCTL_TRANSPORT_BUFFER,
+                               MU_IOCTL_OP_SET, &smtp->savebuf);
       if (status)
        mu_diag_output (MU_DIAG_NOTICE,
                        "failed to restore buffer state on SMTP carrier: %s",
diff --git a/libproto/mailer/smtp_starttls.c b/libproto/mailer/smtp_starttls.c
index 8c0662c..ffd1856 100644
--- a/libproto/mailer/smtp_starttls.c
+++ b/libproto/mailer/smtp_starttls.c
@@ -33,7 +33,8 @@ _mu_smtp_get_streams (mu_smtp_t smtp, mu_stream_t *streams)
   int rc;
   
   if (MU_SMTP_FISSET (smtp, _MU_SMTP_TRACE))
-    rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_GET_STREAM, streams);
+    rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET,
+                          streams);
   else
     {
       streams[0] = smtp->carrier;
@@ -51,7 +52,8 @@ _mu_smtp_set_streams (mu_smtp_t smtp, mu_stream_t *streams)
   int rc;
   
   if (MU_SMTP_FISSET (smtp, _MU_SMTP_TRACE))
-    rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SET_STREAM, streams);
+    rc = mu_stream_ioctl (smtp->carrier, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_SET,
+                          streams);
   else
     {
       mu_stream_t tmp;
diff --git a/libproto/mailer/smtp_trace.c b/libproto/mailer/smtp_trace.c
index c32e0a2..270ae6a 100644
--- a/libproto/mailer/smtp_trace.c
+++ b/libproto/mailer/smtp_trace.c
@@ -75,7 +75,7 @@ _mu_smtp_trace_disable (mu_smtp_t smtp)
   if (!xstr)
     return 0;
   
-  rc = mu_stream_ioctl (xstr, MU_IOCTL_GET_TRANSPORT, stream);
+  rc = mu_stream_ioctl (xstr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, stream);
   if (rc)
     return rc;
 
@@ -137,7 +137,8 @@ mu_smtp_trace_mask (mu_smtp_t smtp, int op, int lev)
 int
 _mu_smtp_xscript_level (mu_smtp_t smtp, int xlev)
 {
-  if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_LEVEL, &xlev) == 0)
+  if (mu_stream_ioctl (smtp->carrier, MU_IOCTL_XSCRIPTSTREAM,
+                       MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0)
     return xlev;
   return MU_XSCRIPT_NORMAL;
 }
diff --git a/libproto/pop/pop3_stls.c b/libproto/pop/pop3_stls.c
index 2f5f197..8dd5b3e 100644
--- a/libproto/pop/pop3_stls.c
+++ b/libproto/pop/pop3_stls.c
@@ -35,7 +35,8 @@ pop3_get_streams (mu_pop3_t pop3, mu_stream_t *streams)
   int rc;
   
   if (MU_POP3_FISSET (pop3, MU_POP3_TRACE))
-    rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_GET_STREAM, streams);
+    rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_SUBSTREAM, 
+                          MU_IOCTL_OP_GET, streams);
   else
     {
       streams[0] = pop3->carrier;
@@ -53,7 +54,8 @@ pop3_set_streams (mu_pop3_t pop3, mu_stream_t *streams)
   int rc;
   
   if (MU_POP3_FISSET (pop3, MU_POP3_TRACE))
-    rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_SET_STREAM, streams);
+    rc = mu_stream_ioctl (pop3->carrier, MU_IOCTL_SUBSTREAM, 
+                          MU_IOCTL_OP_SET, streams);
   else
     {
       mu_stream_t tmp;
diff --git a/libproto/pop/pop3_stream.c b/libproto/pop/pop3_stream.c
index 046dfed..8ceb4e3 100644
--- a/libproto/pop/pop3_stream.c
+++ b/libproto/pop/pop3_stream.c
@@ -49,7 +49,8 @@ _pop3_event_cb (mu_stream_t str, int ev, unsigned long flags,
     {
       mu_transport_t trans[2];
 
-      if (mu_stream_ioctl (str, MU_IOCTL_GET_TRANSPORT, trans) == 0)
+      if (mu_stream_ioctl (str, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, 
+                           trans) == 0)
        {
          struct mu_pop3_stream *sp = (struct mu_pop3_stream *) trans[0];
          _mu_pop3_xscript_level (sp->pop3, MU_XSCRIPT_NORMAL);
@@ -58,7 +59,7 @@ _pop3_event_cb (mu_stream_t str, int ev, unsigned long flags,
          if (sp->flags & _POP3F_CHBUF)
            {
              mu_stream_ioctl (sp->pop3->carrier,
-                              MU_IOCTL_SET_TRANSPORT_BUFFER,
+                              MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET,
                               &sp->oldbuf);
              sp->flags = _POP3F_DONE;
            }
@@ -82,7 +83,8 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t 
stream)
       str->event_mask = _MU_STR_EVMASK(_MU_STR_EVENT_SETFLAG);
 
       sp->oldbuf.type = MU_TRANSPORT_OUTPUT;
-      if (mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_GET_TRANSPORT_BUFFER,
+      if (mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_TRANSPORT_BUFFER,
+                           MU_IOCTL_OP_GET,
                           &sp->oldbuf) == 0)
        {
          struct mu_buffer_query newbuf;
@@ -91,7 +93,8 @@ mu_pop3_filter_create (mu_stream_t *pstream, mu_stream_t 
stream)
          newbuf.type = MU_TRANSPORT_OUTPUT;
          newbuf.buftype = mu_buffer_full;
          newbuf.bufsize = 64*1024;
-         mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_SET_TRANSPORT_BUFFER,
+         mu_stream_ioctl (sp->pop3->carrier, MU_IOCTL_TRANSPORT_BUFFER,
+                           MU_IOCTL_OP_SET, 
                           &newbuf);
        }
     }
diff --git a/libproto/pop/pop3_trace.c b/libproto/pop/pop3_trace.c
index 456cd23..b7b4e62 100644
--- a/libproto/pop/pop3_trace.c
+++ b/libproto/pop/pop3_trace.c
@@ -76,7 +76,7 @@ _mu_pop3_trace_disable (mu_pop3_t pop3)
   if (!xstr)
     return 0;
   
-  rc = mu_stream_ioctl (xstr, MU_IOCTL_GET_TRANSPORT, stream);
+  rc = mu_stream_ioctl (xstr, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, stream);
   if (rc)
     return rc;
 
@@ -138,7 +138,8 @@ mu_pop3_trace_mask (mu_pop3_t pop3, int op, int lev)
 int
 _mu_pop3_xscript_level (mu_pop3_t pop3, int xlev)
 {
-  if (mu_stream_ioctl (pop3->carrier, MU_IOCTL_LEVEL, &xlev) == 0)
+  if (mu_stream_ioctl (pop3->carrier, MU_IOCTL_XSCRIPTSTREAM,
+                       MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0)
     return xlev;
   return MU_XSCRIPT_NORMAL;
 }
diff --git a/maidag/lmtp.c b/maidag/lmtp.c
index b050397..7ba1377 100644
--- a/maidag/lmtp.c
+++ b/maidag/lmtp.c
@@ -385,25 +385,30 @@ cfun_data (mu_stream_t iostr, char *arg)
 
   lmtp_reply (iostr, "354", NULL, "Go ahead");
 
-  if (mu_stream_ioctl (iostr, MU_IOCTL_GET_TRANSPORT_BUFFER, &oldbuf) == 0)
+  if (mu_stream_ioctl (iostr, MU_IOCTL_TRANSPORT_BUFFER, 
+                       MU_IOCTL_OP_GET, &oldbuf) == 0)
     {
       struct mu_buffer_query newbuf;
 
       newbuf.type = MU_TRANSPORT_OUTPUT;
       newbuf.buftype = mu_buffer_full;
       newbuf.bufsize = 64*1024;
-      if (mu_stream_ioctl (iostr, MU_IOCTL_SET_TRANSPORT_BUFFER, &newbuf))
+      if (mu_stream_ioctl (iostr, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET, 
+                           &newbuf))
        buf_switch = 1;
     }
 
-  if (mu_stream_ioctl (iostr, MU_IOCTL_LEVEL, &xlev) == 0)
+  if (mu_stream_ioctl (iostr, MU_IOCTL_XSCRIPTSTREAM,
+                       MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0)
     xlev_switch = 1;
   rc = mu_stream_copy (tempstr, flt, 0, NULL);
   mu_stream_destroy (&flt);
   if (xlev_switch)
-    mu_stream_ioctl (iostr, MU_IOCTL_LEVEL, &xlev);
+    mu_stream_ioctl (iostr, MU_IOCTL_XSCRIPTSTREAM,
+                     MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev);
   if (buf_switch)
-    mu_stream_ioctl (iostr, MU_IOCTL_SET_TRANSPORT_BUFFER, &oldbuf);
+    mu_stream_ioctl (iostr, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET, 
+                     &oldbuf);
   if (rc)
     {
       maidag_error (_("copy error: %s"), mu_strerror (rc));
diff --git a/mail/source.c b/mail/source.c
index de41ef7..6b7af0a 100644
--- a/mail/source.c
+++ b/mail/source.c
@@ -27,7 +27,8 @@ source_readline (void *closure, int cont MU_ARG_UNUSED)
   if (getline (&buf, &s, fp) >= 0)
     {
       mu_rtrim_class (buf, MU_CTYPE_SPACE);
-      mu_stream_ioctl (mu_strerr, MU_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL);
+      mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                       MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL);
       return buf;
     }
   
@@ -65,10 +66,12 @@ mail_source (int argc, char **argv)
   locus.mu_file = argv[1];
   locus.mu_line = 0; 
   locus.mu_col = 0;
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                   MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus);
   mail_mainloop (source_readline, fp, 0);
   interactive = save_term;
-  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL);
+  mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM,
+                   MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL);
   fclose (fp);
   return 0;
 }
diff --git a/mu/logger.c b/mu/logger.c
index b9272cf..38b1395 100644
--- a/mu/logger.c
+++ b/mu/logger.c
@@ -168,10 +168,13 @@ mutool_logger (int argc, char **argv)
     }
 
   mode = MU_LOGMODE_SEVERITY | MU_LOGMODE_LOCUS;
-  mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM_SET_MODE, &mode);
+  mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM,
+                   MU_IOCTL_LOGSTREAM_SET_MODE, &mode);
   if (locus.mu_file)
-    mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus);
-  mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM_SET_SEVERITY, &log_severity);
+    mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM,
+                     MU_IOCTL_LOGSTREAM_SET_LOCUS, &locus);
+  mu_stream_ioctl (logger, MU_IOCTL_LOGSTREAM,
+                   MU_IOCTL_LOGSTREAM_SET_SEVERITY, &log_severity);
   
   if (argc)
     {
diff --git a/pop3d/extra.c b/pop3d/extra.c
index 10a294e..1508e9b 100644
--- a/pop3d/extra.c
+++ b/pop3d/extra.c
@@ -187,7 +187,7 @@ pop3d_init_tls_server ()
   mu_stream_t tlsstream, stream[2];
   int rc;
 
-  rc = mu_stream_ioctl (iostream, MU_IOCTL_GET_STREAM, stream);
+  rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_GET, stream);
   if (rc)
     {
       mu_error (_("%s failed: %s"), "MU_IOCTL_GET_STREAM",
@@ -202,7 +202,7 @@ pop3d_init_tls_server ()
     return 1;
 
   stream[0] = stream[1] = tlsstream;
-  rc = mu_stream_ioctl (iostream, MU_IOCTL_SET_STREAM, stream);
+  rc = mu_stream_ioctl (iostream, MU_IOCTL_SUBSTREAM, MU_IOCTL_OP_SET, stream);
   mu_stream_unref (stream[0]);
   mu_stream_unref (stream[1]);
   if (rc)
@@ -340,7 +340,8 @@ set_xscript_level (int xlev)
            return MU_XSCRIPT_NORMAL;
        }
 
-      if (mu_stream_ioctl (iostream, MU_IOCTL_LEVEL, &xlev) == 0)
+      if (mu_stream_ioctl (iostream, MU_IOCTL_XSCRIPTSTREAM,
+                           MU_IOCTL_XSCRIPTSTREAM_LEVEL, &xlev) == 0)
        return xlev;
     }
   return 0;
diff --git a/pop3d/retr.c b/pop3d/retr.c
index 307b187..e1939f5 100644
--- a/pop3d/retr.c
+++ b/pop3d/retr.c
@@ -27,12 +27,12 @@ pop3d_send_payload (mu_stream_t stream, mu_stream_t 
linestr, size_t maxlines)
   int xscript_level = set_xscript_level (MU_XSCRIPT_PAYLOAD);
 
   oldbuf.type = MU_TRANSPORT_OUTPUT;
-  mu_stream_ioctl (iostream, MU_IOCTL_GET_TRANSPORT_BUFFER,
+  mu_stream_ioctl (iostream, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_GET,
                   &oldbuf);
   newbuf.type = MU_TRANSPORT_OUTPUT;
   newbuf.buftype = mu_buffer_full;
   newbuf.bufsize = pop3d_output_bufsize;
-  mu_stream_ioctl (iostream, MU_IOCTL_SET_TRANSPORT_BUFFER,
+  mu_stream_ioctl (iostream, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET,
                   &newbuf);
   /* FIXME: Return code */
   mu_filter_create (&flt, iostream, "DOT", MU_FILTER_ENCODE,
@@ -56,7 +56,7 @@ pop3d_send_payload (mu_stream_t stream, mu_stream_t linestr, 
size_t maxlines)
   mu_stream_close (flt);
   mu_stream_destroy (&flt);
   
-  mu_stream_ioctl (iostream, MU_IOCTL_SET_TRANSPORT_BUFFER,
+  mu_stream_ioctl (iostream, MU_IOCTL_TRANSPORT_BUFFER, MU_IOCTL_OP_SET,
                   &oldbuf);
   set_xscript_level (xscript_level);
 }


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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