1. 22 Dec, 2010 2 commits
    • * TODO: Update.
      * include/mailutils/sieve.h (mu_sieve_library_path_prefix): New variable.
      * libmu_argp/sieve.c (sieve_argp_option): New option --libdir-prefix.
      (sieve_argp_parser): Handle --libdir-prefix.
      * libmu_cfg/sieve.c (cb_library_path_prefix): New callback.
      (mu_sieve_param): New statement "library-path-prefix".
      * libmu_sieve/conf.c (mu_sieve_library_path_prefix): New variable.
      (mu_sieve_module_init): Process prefix paths.
      Do not call mu_sv_load_add_path.
      * libmu_sieve/load.c (sieve_init_load_path): Rewrite.
      (mu_sv_load_add_path): Remove.
      * libmu_sieve/sieve-priv.h (mu_sv_load_add_path): Remove declaration.
      (sieve_searchpath): Remove the unused "add" parameter.
      * sieve/tests/moderator.at: Use MUT_SIEVE_OPTIONS in all tests.
      * sieve/tests/testsuite.at (MUT_SIEVE_EXT_TEST): Use --libdir-prefix
      option to ensure that our version of the extension appears first in
      the path.
      Sergey Poznyakoff authored
    • * libmailutils/stream/fltstream.c (filter_ctl): MU_IOCTL_TRANSPORT
      returns filter transport stream.
      * libproto/pop/pop3_rdlist.c (mu_pop3_stream_to_list): Make sure
      status is initialized and reflects the actual status.
      * libproto/pop/pop3_stream.c (mu_pop3_filter_create): Do not unref
      transport stream, it is done by the caller.
      Sergey Poznyakoff authored
  2. 21 Dec, 2010 1 commit
    • * am/enable.m4 (MU_ENABLE_SUPPORT): Add the additional-cond argument.
      (MU_ENABLE_BUILD): Likewise.
      * configure.ac: Update 4th args in calls to MU_ENABLE_SUPPORT.
      Do not use MU_ENABLE_BUILD within conditionals, use additional-cond
      instead.
      * libmailutils/stream/mapfile_stream.c: Include sys/stat.h
      Sergey Poznyakoff authored
  3. 20 Dec, 2010 1 commit
    • * include/mailutils/debug.h (mu_debug_format_spec): New function.
      
      * include/mailutils/stream.h (MU_IOCTL_SYSLOGSTREAM)
      (MU_IOCTL_FILTER): New ioctls.
      (MU_IOCTL_LOGSTREAM_GET_SEVERITY_MASK)
      (MU_IOCTL_LOGSTREAM_SET_SEVERITY_MASK)
      (MU_IOCTL_LOGSTREAM_CLONE)
      (MU_IOCTL_SYSLOGSTREAM_SET_LOGGER)
      (MU_IOCTL_SYSLOGSTREAM_GET_LOGGER)
      (MU_IOCTL_FILTER_GET_DISABLED)
      (MU_IOCTL_FILTER_SET_DISABLED): And their opcodes.
      * include/mailutils/sys/filter.h (_MU_FILTER_DISABLED)
      (_MU_FILTER_EOF): New defines.
      (_mu_filter_stream) <eof>: Replace with fltflag (a bitmask).
      * include/mailutils/sys/logstream.h (_mu_log_stream) <sevmask>: New
      member.
      * include/mailutils/sys/syslogstream.h (_mu_syslog_stream) <logger>: New
      member.
      * include/mailutils/util.h (mu_onexit_run): New proto.
      * libmailutils/base/onexit.c (_mu_onexit_run): Extra safety check.
      (mu_onexit_run): New function.
      (mu_debug_level_str): New static.
      (mu_debug_format_spec): New function.
      * libmailutils/stream/fltstream.c (filter_read, filter_write): Bypass the
      xcoder if _MU_FILTER_DISABLED is set.
      Use fltflag instead of the removed eof.
      (filter_ctl): Handle MU_IOCTL_FILTER.
      * libmailutils/stream/logstream.c (_log_write): The sevmask member
      masks out severity prefix output for certain severities.
      (_log_ctl): Handle new opcodes (see above).
      * libmailutils/stream/syslogstream.c (_syslog_stream_write): Use
      <logger>, if supplied, instead of the system syslog(3).
      (_syslog_ctl): Handle MU_IOCTL_SYSLOGSTREAM.
      (mu_syslog_stream_create): Initialize logger to NULL.
      * mu/ldflags.c (lib_descr): Protect entries with the
      corresponding #ifdef ENABLE_whatever.
      Sergey Poznyakoff authored
  4. 19 Dec, 2010 5 commits
    • Sergey Poznyakoff authored
    • * include/mailutils/sys/amd.h (_amd_message_lookup_or_insert): New proto.
      * libmailutils/base/amd.c (_amd_message_lookup_or_insert): New function.
      (_amd_message_insert): Rewrite using _amd_message_lookup_or_insert.
      * libproto/maildir/mbox.c (maildir_message_cmp): Stop comparison on
      ':'.
      (maildir_message_lookup): Remove.
      (maildir_scan_dir): Use _amd_message_lookup_or_insert.
      
      * po/POTFILES.in: Update.
      Sergey Poznyakoff authored
    • * include/mailutils/debug.h (mu_debug_log_nl): New proto.
      * libmailutils/diag/debug.c (mu_debug_log_nl): New function.
      * libmailutils/mailer/progmailer.c: Use mu_debug_log_nl.
      * libmailutils/server/acl.c: Likewise.
      Also, use MU_DEBUG_TRACE9 instead of the numeric value.
      
      * libmailutils/filter/iconvflt.c (_iconv_filter): Register encoder
      (same as decoder).
      Sergey Poznyakoff authored
    • * libmu_sieve/extensions/pipe.c: Allow to specify which parts of the
      message should be piped.
      Implement "pipe" test.
      * sieve/tests/pipeact.at: New file.
      * sieve/tests/pipetest.at: New file.
      * sieve/tests/Makefile.am (TESTSUITE_AT): Add pipeact.at
      and pipetest.at
      * sieve/tests/testsuite.at: Include pipeact.at
      and pipetest.at
      (MUT_SIEVE_EXT_TEST): Redefine MUT_SIEVE_OPTIONS.
      Set envar "cwd".
      Use cat and heredoc to create prog, instead of using AT_DATA.
      * sieve/tests/moderator.at: Update to these changes.
      Sergey Poznyakoff authored
  5. 17 Dec, 2010 4 commits
    • * libmu_sieve/util.c (mu_sieve_error): Fix typo.
      Sergey Poznyakoff authored
    • * libmu_sieve/extensions/moderator.c: Implement the :program tag.
      Use _sget_ functions to reduce memory requirements.
      * sieve/tests/moderator.mbox: New file.
      * sieve/tests/moderator.at: New file.
      * sieve/tests/Makefile.am (EXTRA_DIST): Add moderator.mbox.
      (TESTSUITE_AT): Add moderator.at
      * sieve/tests/testsuite.at (MUT_SIEVE_EXT_NAME): New define.
      (MUT_SIEVE_EXT_TEST): New macro.
      Include moderator.at.
      Sergey Poznyakoff authored
    • * imap4d/util.c (set_xscript_level): Fix typo.
      Sergey Poznyakoff authored
    • * libmailutils/auth/mu_auth.c: Fix mu_debug calls. Use different levels.
      
      Remove --debug-auth option.  Users should use --debug-level=auth instead.
      
      * libmu_argp/auth.c: Remove.
      * libmu_argp/Makefile.am (libmu_argp_a_SOURCES): Remove auth.c
      * include/mailutils/libargp.h (mu_auth_cmdline): Remove.
      * libmu_argp/cmdline.c (all_cmdline_capa): Remove mu_auth_cmdline.
      Sergey Poznyakoff authored
  6. 16 Dec, 2010 2 commits
    • * am/enable.m4 (MU_ENABLE_SUPPORT): Fix the usage of the last argument.
      * configure.ac: Check for --enable-experimental before any other checks.
      Mark cxx, python and nntp as experimental.
      * mh/tests/mhn.at: Make sure all mailboxes are writable.
      * mh/tests/testsuite.at (MTSTAILOR): Fix mailer URL.
      * po/POTFILES.in: Comment out unused sources.
      Sergey Poznyakoff authored
    • * include/mailutils/cpp/debug.h: Remove.
      * include/mailutils/cpp/Makefile.am (cppinclude_HEADERS): Remove debug.h
      * libmu_cpp/debug.cc: Remove
      * libmu_cpp/Makefile.am (libmu_cpp_la_SOURCES): Remove debug.cc.
      * python/libmu_py/debug.c: Remove.
      * python/libmu_py/Makefile.am (libmu_py_la_SOURCES): Remove debug.c
      * include/mailutils/cpp/mailbox.h: Remove objects and methods derived
      from mu_debug_t.
      * include/mailutils/cpp/mailer.h: Likewise.
      * include/mailutils/cpp/stream.h: Likewise.
      * libmu_cpp/mailbox.cc: Likewise.
      * libmu_cpp/mailer.cc: Likewise.
      * libmu_cpp/sieve.cc: Likewise.  Ditto for mu_sieve_printf_t,
      mu_sieve_parse_error_t.
      * include/mailutils/cpp/sieve.h: Likewise.
      
      * libmu_cpp/stream.cc: Remove objects and methods derived
      from mu_debug_t.
      (ProgStream::ProgStream): Use mu_command_stream_create (see FIXME).
      (FilterProgStream::FilterProgStream): Rewrite.
      
      * include/mailutils/python.h: Remove objects and methods derived
      from mu_debug_t.
      * python/libmu_py/filter.c (api_filter_iconv_create): Rewrite using
      mu_filter_create_args.
      
      * python/libmu_py/libmu_py.c: Likewise.
      * python/libmu_py/libmu_py.h: Likewise.
      * python/libmu_py/mailbox.c: Likewise.
      * python/libmu_py/mailer.c: Likewise.
      * python/libmu_py/stream.c: Likewise.
      * python/libmu_py/url.c: Likewise.
      * python/libmu_py/sieve.c: Likewise.  Same for mu_sieve_printf_t,
      mu_sieve_parse_error_t.
      Sergey Poznyakoff authored
  7. 13 Dec, 2010 2 commits
    • Callers should use mu_filter_create_args instead.
      
      * examples/iconv.c: Rewrite using mu_filter_create_args.
      * libmailutils/mime/mimehdr.c (mu_mimehdr_decode_param): Use mu_decode_filter.
      
      * imap4d/imap4d.h: Include prog.h
      * include/mailutils/filter.h (mu_filter_iconv_create): Mark as deprecated.
      * include/mailutils/util.h (mu_decode_filter_args): New proto.
      * libmailutils/base/msgid.c (mu_rfc2822_in_reply_to): Silence a
      cast warning.
      * libmailutils/tests/wicket.c (match_string): Likewise.
      * libmailutils/filter/decode.c (mu_decode_filter_args): New function.
      (mu_decode_filter): Rewrite as an alternative entry point to
      mu_decode_filter_args.
      * ibmailutils/filter/filter_iconv.c: Remove.
      * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Remove
      filter_iconv.c
      * libmu_compat/filter_iconv.c: New file.
      * libmu_compat/Makefile.am (libmu_compat_la_SOURCES): Add filter_iconv.c
      
      * libmailutils/filter/iconvflt.c (_icvt_decoder): Set errcode
      before returning failure.
      
      * libmailutils/stream/fltstream.c (init_iobuf, filter_stream_init): Provide
      a default value for io->errcode.
      Sergey Poznyakoff authored
    • * include/mailutils/filter.h (mu_iconv_filter): New extern.
      * libmailutils/filter/iconvflt.c: New file.
      * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Add iconvflt.c
      * libmailutils/filter/filter.c (mu_filter_get_list): Register
      mu_iconv_filter.
      Sergey Poznyakoff authored
  8. 11 Dec, 2010 7 commits
    • Sergey Poznyakoff authored
    • * libmailutils/base/argcvjoin.c (mu_argcv_join): Fix a
      memory allocation error.
      * libmailutils/base/msgid.c (concat): Remove.
      (mu_rfc2822_references,mu_rfc2822_in_reply_to): Use mu_argcv_join
      to concatenate strings.
      Sergey Poznyakoff authored
    • * libmailutils/base/amd.c (amd_envelope_date): Remove the
      trailing newline from the ctime output.
      Sergey Poznyakoff authored
    • * libmailutils/base/spawnvp.c (mu_spawnvp): Use fork and _exit,
      unconditionally.
      * libmailutils/stdstream/basestr.c (mu_stdstream_setup): Borrow
      descriptors 0, 1, 2.
      
      * mail/mail.h (compose_env) <filename, file, ofile>: Remove.
      <compstr>: New member.
      * mail/alias.c: Use MU streams instead of stdlib.
      * mail/alt.c: Likewise.
      * mail/copy.c: Likewise.
      * mail/decode.c: Likewise.
      * mail/echo.c: Likewise.
      * mail/envelope.c: Likewise.
      * mail/eq.c: Likewise.
      * mail/escape.c: Likewise.
      * mail/followup.c: Likewise.
      * mail/from.c: Likewise.
      * mail/inc.c: Likewise.
      * mail/mail.c: Likewise.
      * mail/mailline.c: Likewise.
      * mail/mailvar.c: Likewise.
      * mail/msgset.y: Likewise.
      * mail/print.c: Likewise.
      * mail/quit.c: Likewise.
      * mail/reply.c: Likewise.
      * mail/retain.c: Likewise.
      * mail/send.c: Likewise.
      * mail/setenv.c: Likewise.
      * mail/shell.c: Likewise.
      * mail/size.c: Likewise.
      * mail/source.c: Likewise.
      * mail/summary.c: Likewise.
      * mail/top.c: Likewise.
      * mail/unset.c: Likewise.
      * mail/util.c: Likewise.
      * mail/version.c: Likewise.
      * mail/write.c: Likewise.
      * mail/z.c: Likewise.
      Sergey Poznyakoff authored
    • * libmailutils/stream/stream.c (mu_stream_set_stat): Allow for statbuf==NULL.
      Sergey Poznyakoff authored
    • * include/mailutils/types.hin (mu_onexit_t): New typedef.
      * include/mailutils/util.h (mu_onexit_reset, mu_onexit): New protos.
      * libmailutils/base/onexit.c: New file.
      * libmailutils/base/Makefile.am (libbase_la_SOURCES): Add onexit.c
      
      * libmailutils/stdstream/basestr.c (stdstream_flushall): New function.
      (mu_stdstream_setup): Rewrite the fd checking algorithm.
      Register stdstream_flushall as an onexit function.
      
      * mh/anno.c: Use MU stdstream.
      * mh/mh.h: Include mailutils/stdstream.h.
      * mh/mh_init.c (mh_init): Call mu_stdstream_setup; use MU stdstream.
      * mh/mh_whatnow.c (_whatnow): Use MU stdstream.
      * mh/mhl.c (open_output,list_message): Likewise.
      * mh/mhn.c (mhn_show,store_handler): Likewise.
      * pop3d/popauth.c: Use MU stdstream.
      
      * mimeview/mimetypes.y: Use MU stdstream.
      * mimeview/mimeview.c: Likewise.
      (mimeview_fp): Remove.
      (mimeview_stream): New variable.
      * mimeview/mimeview.h (mimeview_fp): Remove.
      (mimeview_stream): New variable.
      
      * lib/mailcap.c (find_entry): Don't report ENOENT.
      Sergey Poznyakoff authored
  9. 10 Dec, 2010 2 commits
    • This is the default behavior now.  The reverse can be requested by
      a special MU_IOCTL_FD,MU_IOCTL_FD_SET_BORROW ioctl.
      
      * include/mailutils/stream.h (MU_STREAM_FD_AUTOCLOSE): Remove. This
      is the default behavior now.
      (MU_IOCTL_FD): New ioctl.
      (MU_IOCTL_FD_GET_BORROW, MU_IOCTL_FD_SET_BORROW): New opcodes.
      * include/mailutils/sys/file_stream.h (_MU_FILE_STREAM_FD_BORROWED): New flag.
      
      * libmailutils/stream/file_stream.c (fd_close): Close the fd unless
      _MU_FILE_STREAM_FD_BORROWED bit is set.
      (fd_open): Clear the _MU_FILE_STREAM_FD_BORROWED bit.
      (fd_ioctl): Handle MU_IOCTL_FD.
      (mu_file_stream_create): Remove MU_STREAM_FD_AUTOCLOSE.
      
      * ibmailutils/base/version.c (mu_print_options): Set borrow mode on the
      temporary stdout stream.
      * libmailutils/cfg/driver.c (mu_cfg_tree_reduce): Set borrow mode on the
      temporary stderr stream.
      * libmailutils/stdstream/strerr.c (mu_stdstream_strerr_create): Set borrow
      mode on the stderr stream.
      * libmailutils/tests/tempfile.c: set borrow mode on the temporary stream,
      because it may be reopened later (verify mode).
      
      * examples/mta.c: Remove MU_STREAM_FD_AUTOCLOSE.
      * imap4d/io.c: Likewise.
      * libmailutils/stream/prog_stream.c: Likewise.
      * libmailutils/stream/socket_stream.c: Likewise.
      * libmailutils/stream/temp_file_stream.c: Likewise.
      * maidag/lmtp.c: Likewise.
      * pop3d/extra.c: Likewise.
      
      These will disappear when the corresponding utilities are rewritten to
      use MU stdstream:
      
      * mail/escape.c (quote0): set borrow mode on the output stream.
      * mimeview/mimeview.c (display_file): set borrow mode on the input stream.
      
      Likewise, these will disappear when MH uses MU stdstream:
      
      * mh/anno.c (main): Set borrow mode on the input stream.
      * mh/mh_init.c (mh_real_install): Likewise.
      * mh/mh_whatnow.c (_whatnow): Likewise.
      * mh/mhl.c (open_output): Set borrow mode on the output stream.
      * mh/mhn.c (mhn_show,store_handler): Likewise.
      Sergey Poznyakoff authored
    • * examples/mta.c: Use MU_STREAM_FD_AUTOCLOSE.
      * imap4d/io.c: Likewise.
      * libmailutils/stream/file_stream.c: Likewise.
      * libmailutils/stream/prog_stream.c: Likewise.
      * libmailutils/stream/socket_stream.c: Likewise.
      * libmailutils/stream/temp_file_stream.c: Likewise.
      * maidag/lmtp.c: Likewise.
      * pop3d/extra.c: Likewise.
      
      * imap4d/preauth.c: Do not use MU_STREAM_AUTOCLOSE.  Instead unref the
      transport stream after creating the derived one.
      * libmailutils/base/rfc2047.c: Likewise.
      * libmailutils/stream/fltstream.c: Likewise.
      * libmailutils/tests/fltst.c: Likewise.
      * libmu_auth/ldap.c: Likewise.
      * libmu_auth/tls.c: Likewise.
      * libmu_sieve/extensions/vacation.c: Likewise.
      * libproto/pop/pop3_stream.c: Likewise.
      * mail/decode.c: Likewise.
      * mh/mhn.c: Likewise.
      
      * libmailutils/filter/filter_iconv.c: Do not handle MU_STREAM_AUTOCLOSE.
      * libmailutils/stream/rdcache_stream.c: Likewise.
      * libmailutils/stream/streamref.c: Likewise.
      * libmailutils/stream/xscript-stream.c: Likewise.
      
      * include/mailutils/stream.h (MU_STREAM_AUTOCLOSE): Rename to
      MU_STREAM_FD_AUTOCLOSE.
      Sergey Poznyakoff authored
  10. 09 Dec, 2010 1 commit
    • * include/mailutils/filter.h (mu_filter_chain_create_pred)
      (mu_filter_chain_create): New prototypes.
      (_mu_filter_record)<max_line_length>: Remove.
      * libmailutils/filter/fltchain.c: New file.
      * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Add fltchain.c.
      * libmailutils/filter/base64.c: Implement line length limit for encoder.
      (base64_state): New enum.
      (base64_line): New struct.
      (_base64_encoder): xd brings a pointer to struct base64_line. Use it
      to limit the output line length.
      (alloc_state): New function.
      (_base64_filter): Register alloc_state.
      (_base64_filter, _B_filter): Remove max_line_length initialization.
      
      * libmailutils/filter/binflt.c: Remove max_line_length initialization.
      * libmailutils/filter/crlfflt.c: Likewise.
      * libmailutils/filter/dot.c: Likewise.
      * libmailutils/filter/fromflt.c: Likewise.
      * libmailutils/filter/header.c: Likewise.
      * libmailutils/filter/inline-comment.c: Likewise.
      * libmailutils/filter/linecon.c: Likewise.
      * libmailutils/filter/qpflt.c: Likewise.
      
      * libmailutils/filter/linelenflt.c: Redo line filter as a regular filter.
      (mu_linelen_filter): New global.
      
      * libmailutils/filter/filter.c (mu_filter_get_list): Register mu_linelen_filter.
      (filter_create_rd, filter_create_wr): Remove.
      (mu_filter_create_args): Use mu_filter_stream_create directly.
      
      * examples/base64.c: Re-implement the -l option via filter chains.
      
      * libmailutils/tests/fltst.c: Remove the linelen option.
      * libmailutils/tests/base64d.at: Remove the linelen option from fltst
      invocations.
      * mu/filter.c: Remove the --line-length option.  Not needed now, its
      effect is achieved by "FLT + [~]linelen" chain.
      Sergey Poznyakoff authored
  11. 08 Dec, 2010 7 commits
    • * examples/config/dot.biffrc: Update.
      * comsat/comsat.c (main): In test mode, normalize biffrc names that
      begin with ./ or ../
      Sergey Poznyakoff authored
    • * comsat/comsat.c (biffrc_errors): New variable.
      (comsat_cfg_param): New statements: biffrc-errors-to-tty and
      biffrc-errors-to-err
      (main): In test mode, set biffrc_errors to BIFFRC_ERRORS_TO_ERR.
      * comsat/comsat.h (BIFFRC_ERRORS_TO_TTY)
      (BIFFRC_ERRORS_TO_ERR): New flags.
      (biffrc_errors): New variable.
      * comsat/action.c (report_error): Consult biffrc_errors.
      Sergey Poznyakoff authored
    • * include/mailutils/stream.h (MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE)
      (MU_IOCTL_LOGSTREAM_SET_LOCUS_COL): New subcodes.
      * libmailutils/stream/logstream.c (_log_ctl): Handle two new subcodes.
      * comsat/action.c (eval_biffrc): Use new ioctl subcode to update the
      line number.
      Sergey Poznyakoff authored
    • * libmailutils/tests/inline-comment.at: Add line info tests.
      * libmailutils/tests/linecon.at: Likewise.
      * libmailutils/filter/linecon.c (LINECON_CONTINUATION): New flag.
      (linecon_newline): Remove.
      (_linecon_decoder): Correctly determine the end of continuation
      in case when the last line contained standalone escapes.
      Sergey Poznyakoff authored
    • * libmailutils/filter/inline-comment.c: Implement line number info
      facility.
      * libmailutils/filter/linecon.c: Likewise.
      * libmailutils/stream/logstream.c (_log_done, _log_close): Always
      close/destroy the underlying transport stream.
      * comsat/action.c: Rewrite using a table-driven parser.
      Use line-info facility of the linecon filter.
      Sergey Poznyakoff authored
    • * comsat/.gitignore: Add biff.rc.h
      * comsat/Makefile.am (comsatd_SOURCES, BUILT_SOURCES): Add biff.rc.h
      (EXTRA_DIST): Add biffrc.sed and biff.rc
      * comsat/action.c (default_action): Include biff.rc.h.
      (biffrc_environ): New struct.
      (eval_biffrc): New function.
      (run_user_action): Rewrite via eval_biffrc.  Default action is
      evaluated if biff.rc cannot be opened, or it contains the "default"
      keyword.
      * comsat/tests/testsuite.at: Add "default" statement where necessary.
      Sergey Poznyakoff authored
    • * comsat/action.c (need_crlf, _open_tty, open_tty): Moved from comsat.c
      (open_default_tty): New function.
      (run_user_action): Take device name as first argument.
      Reuse wordsplit memory.
      * comsat/comsat.c (notify_user): Update invocation of run_user_action.
      * comsat/comsat.h (open_tty): Remove prototype.
      (run_user_action): Change signature.
      * configure.ac: Add comsat tests.
      * comsat/Makefile.am (SUBDIRS): Add tests.
      * comsat/tests/.gitignore: New file.
      * comsat/tests/Makefile.am: New file.
      * comsat/tests/atlocal.in: New file.
      * comsat/tests/testsuite.at: New file.
      Sergey Poznyakoff authored
  12. 07 Dec, 2010 6 commits
    • * comsat/comsat.c (options): New option --file.
      (biffrc): New variable.
      (comsatd_parse_opt): Handle the --file option.
      (open_tty): New function.
      (notify_user): Open the tty using open_tty function and a default
      set of filters.
      (main): Hanlde --file option.
      * comsat/action.c (run_user_action): Implement the `tty' statement.
      * comsat/comsat.h (biffrc): New extern.
      (open_tty): New function.
      
      mu: accept a chain of filters.
      
      * mu/filter.c (filter_doc, filter_docstring): Update.
      (mutool_filter): Accept a filter chain.
      Sergey Poznyakoff authored
    • Two interfaces are provided: mu_prog_stream_create offers full control
      over the program execution environment (i.e. running privileges, cwd,
      resource limits) via a set of hints.
      A simpler interface, mu_command_stream_create, runs the command in the
      current environment.
      
      mu_filter_prog_stream_create is removed, because its functionality can
      be achieved by a correspondingly crafted set of hints to
      mu_prog_stream_create.
      
      * include/mailutils/prog.h: New file.
      * include/mailutils/mailutils.h: Include mailutils/prog.h
      * include/mailutils/Makefile.am (pkginclude_HEADERS): Add prog.h
      * include/mailutils/stream.h (mu_prog_stream_create)
      (mu_filter_prog_stream_create): Remove prototypes.
      * include/mailutils/sys/prog_stream.h (_mu_prog_stream): Change structure.
      (_mu_prog_limit_codes, _mu_prog_limit_flags): New externs.
      * include/mailutils/util.h (mu_set_user_privileges)
      (mu_switch_to_privs): New prototypes.
      
      * lib/userprivs.c: Move to libmailutils/base.
      * lib/Makefile.am (libmuaux_a_SOURCES): Remove userprivs.c
      * libmailutils/base/Makefile.am (libbase_la_SOURCES): Add userprivs.c
      * libmailutils/base/userprivs.c (mu_set_user_privileges): New function.
      (mu_switch_to_privs): Rewrite as another entry point to mu_set_user_privileges.
      
      * libmailutils/stream/prog_stream.c (_mu_prog_limit_flags)
      (_mu_prog_limit_codes): New global variables.
      (start_program_filter): Use hints to control execution environment.
      (_prog_stream_create): Save hints.
      (mu_prog_stream_create): Change signature.
      (mu_command_stream_create): New function (corresponds to the prior
      mu_prog_stream_create).
      (mu_filter_prog_stream_create): Remove function.
      * comsat/action.c (action_exec): Use new mu_prog_stream_create calling
      convention.
      * examples/murun.c: Rewrite.
      
      * mh/mhn.c (show_internal): Use new mu_prog_stream_create calling
      convention.
      * mh/tests/mhn.at: Reflect changes to mhn.
      
      * imap4d/preauth.c: Use mu_command_stream_create.
      * libmu_sieve/extensions/pipe.c
      * mail/decode.c
      * mail/pipe.c
      * mail/send.c
      * mh/mhl.c
      * mu/shell.c
      
      * mail/mail.h: Include mailutils/prog.h
      * mh/mh.h
      
      * po/POTFILES.in: Add libmailutils/base/userprivs.c.
      Sergey Poznyakoff authored
    • * comsat/action.c (action_beep, echo_string)
      (action_echo, action_exec): Take mu_stream_t as first argument.
      (open_rc): Take mu_stream_t as tty, return mu_stream_t as well.
      Install the linecon filter.
      (run_user_action): Take mu_stream_t as first arg.  Pass it to all
      invoked actions.
      * comsat/comsat.c (get_newline_str): Remove.
      (need_crlf): New function.
      (notify_user): Use mu_stream_t instead of FILE.
      Install a 7bit filter and CRLF filter (if the device requires it).
      * comsat/comsat.h: Include mailutils/filter.h.
      (run_user_action): Change signature.
      Sergey Poznyakoff authored
    • * libmailutils/stream/file_stream.c (fd_open): Remove file state
      checks: it is the responsibility of the caller.
      Set autoclose on the *stream* flags (bugfix, previously the underlying
      fd was never closed).
      Clear MU_STREAM_SEEK flag if seek fails.
      (_mu_file_stream_create): Remove assignment to stream.error_string
      * include/mailutils/stream.h (MU_STREAM_ALLOW_LINKS): Remove flag.
      * libmailutils/base/amd.c (amd_message_stream_open): Initialize flags
      to 0.
      Sergey Poznyakoff authored
    • * libmailutils/mailbox/mailbox.c (mu_mailbox_open): Fix error
      checking condition.
      * comsat/action.c (act_getline): Remove.
      (open_rc): Return mu_stream_t. Use linecon filter.
      Sergey Poznyakoff authored
    • Line continuation filter removes from its input any sequence of '\\\n'
      (a backslash followed by a newline).  It is useful for reading various
      UNIX configuration files.
      
      * include/mailutils/filter.h (mu_linecon_filter): New extern.
      * libmailutils/filter/linecon.c: New file.
      * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Add linecon.c
      * libmailutils/filter/filter.c (mu_filter_get_list): Register mu_linecon_filter.
      * libmailutils/tests/linecon.at: New test.
      * libmailutils/tests/Makefile.am (TESTSUITE_AT): Add linecon.at
      * libmailutils/tests/testsuite.at: Include linecon.at
      Sergey Poznyakoff authored