summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFiles
2017-06-15Merge branch 'master' into locuslocusSergey Poznyakoff13
2017-06-15Make sure all loci are properly initialized before first use.Sergey Poznyakoff7
Clean up semantics of initializers. Each locus type can be initialized either statically (by assigning the MU_LOCUS_*_INITIALIZER macro), or dynamically (by calling mu_locus_*_init function). Whatever method is used, it is important that it be initialized prior to using any other mu_locus_* function. * include/mailutils/locus.h (mu_locus_point_init): Takes single argument. Returns nothing. (mu_locus_range_init): New proto. * libmailutils/locus/locus.c (mu_locus_point_init): Rewrite. (mu_locus_range_init): New function. * libmailutils/cfg/parser.y (mu_cfg_alloc_node): Initialize locus. * libmailutils/tests/logstr.c: Fix printf argyment types. * libmu_sieve/extensions/moderator.c (moderator_filter_message): Initialize locus. * libmu_sieve/sieve-gram.y (node_alloc): Likewise. * mu/libexec/logger.c (parse_locus_point, set_locus): Likewise.
2017-06-15Fix id reference countingSergey Poznyakoff8
* include/mailutils/locus.h: Add copyleft. (mu_ident_stat): New proto. * include/mailutils/types.hin (mu_locus_DEPRECATED): Update commit. Include link to the wiki article. * include/mailutils/yyloc.h: Add copyleft. * libmailutils/locus/ident.c (mu_ident_stat): New function. * libmailutils/locus/locus.c (mu_locus_point_init) (mu_locus_point_copy): Don't touch destination unless setting mu_file member succeeds. (mu_locus_range_copy): deinitialize dest before assignment. * libmailutils/stream/logstream.c (_log_write): Use mu_locus_range_copy to save locus. (mu_ioctl_logstream_get_locus_deprecated) (mu_ioctl_logstream_set_locus_deprecated): Include link to the wiki article. * libmailutils/tests/linetrack.c (main): Destroy tracker before exiting. * libmailutils/tests/logstr.c: Make it possible to run selected tests.
2017-06-14Require bison and flexSergey Poznyakoff5
These are needed only during development cycle, as the created sources are included in the tarball. * am/bison.m4: New file. * am/flex.m4: New file. * configure.ac: Use MU_PROG_BISON and MU_PROG_FLEX * mu-aux/gylwrap: Drop support for alternative command line syntax and the --stdout option.
2017-06-14Provide backward compatibility layer for deprecated functions.Sergey Poznyakoff7
* include/mailutils/sieve.h (mu_sieve_compile_text): New proto. (mu_sieve_compile_buffer): Backward-compatible proto. * include/mailutils/stream.h ((MU_IOCTL_LOGSTREAM_GET_LOCUS_DEPRECATED) (MU_IOCTL_LOGSTREAM_SET_LOCUS_DEPRECATED): New defines. (MU_IOCTL_LOGSTREAM_GET_LOCUS) (MU_IOCTL_LOGSTREAM_SET_LOCUS): Use external functions to make sure any references to these are marked as deprecated. * include/mailutils/types.hin (mu_locus_DEPRECATED): New struct. (mu_locus): Define to mu_locus_DEPRECATED * libmailutils/stream/logstream.c (_log_ctl): Handle the deprecated ctls. * libmu_sieve/extensions/moderator.c (moderator_filter_message): Use mu_sieve_compile_text. * libmu_sieve/sieve-gram.y (mu_sieve_compile_buffer): Rename to mu_sieve_compile_text. Re-introduce it as a backward-compatibility API. * sieve/sieve.c: Call mu_sieve_compile_text instead of mu_sieve_compile_buffer.
2017-06-14Lex-related fixes.Sergey Poznyakoff2
* mu-aux/gylwrap (@yysym): Add more symbols from lex. * mh/mh_alias_lex.l (mh_alias_read): Return meaningful value.
2017-06-14BugfixesSergey Poznyakoff9
* libmu_sieve/sieve-lex.l: Allocate new ctx structure (restore accidentally deleted file. * libmailutils/locus/debug.c: Add missing copyleft. * libmailutils/locus/genprloc.c: Likewise. * libmailutils/locus/ident.c: Likewise. * libmailutils/locus/linetrack.c: Likewise. * libmailutils/locus/locus.c: Likewise. * mu-aux/gencl: Likewise. * mu-aux/gitinfo: Likewise. * mu-aux/gylwrap: Likewise.
2017-06-13Switch mh_aliases to line trackerSergey Poznyakoff4
* mh/mh.h (ali_parse_error): Remove. * mh/mh_alias_gram.y: Simplify parser. Use location tracking. * mh/mh_alias_lex.l: Switch to mu_linetrack facility * mh/tests/ali.at: Update expected location.
2017-06-13Try to display exact error locations in Sieve diagnosticsSergey Poznyakoff8
* include/mailutils/sieve.h (mu_sieve_value_t)<locus>: New field. * libmu_sieve/util.c (mu_sieve_value_create): Take a pointer to mu_locus_range. Use it to initialize the locus field. * libmu_sieve/sieve-gram.y: Pass loci in calls to mu_sieve_value_create. * libmu_sieve/actions.c: Use the most specific locus when displaying the message. * libmu_sieve/comparator.c: Likewise. * libmu_sieve/prog.c: Likewise. * libmu_sieve/variables.c: Likewise. * sieve/tests/i-numeric.at: Update the expected error location.
2017-06-13Rewrite Makefile rules for lex and bisonSergey Poznyakoff28
The aim is to get rid of the explicit rules and use the Autmake framework as much as possible, without hurting the flexibility. To this effect, the gylwrap tool is rewritten from scratch (in Perl). In compatibility mode it takes the same arguments as the standard ylwrap. Additional configuration is supplied in the configuration file gylwrap.conf, located in the directory where the input file resides. * mu-aux/gylwrap: Rewrite from scratch. * configure.ac (MU_YLWRAP): New subst variable. * libmailutils/base/.gitignore: Update. * libmailutils/base/Makefile.am: Update. * libmailutils/base/gylwrap.conf: New file. * libmailutils/cfg/.gitignore: Update. * libmailutils/cfg/Makefile.am: Use new YLWRAP * libmailutils/cfg/cfg.h: Remove. * libmailutils/cfg/gylwrap.conf: New file. * libmailutils/cfg/lexer.l: Include mailutils/yyloc.h directly. * libmailutils/cfg/parser.y: Likewise. * libmu_sieve/Makefile.am: Use new YLWRAP * libmu_sieve/gylwrap.conf: New file. * libmu_sieve/sieve.y: Rename to libmu_sieve/sieve-gram.y * libmu_sieve/sieve.l: Rename to libmu_sieve/sieve-lex.l * mail/Makefile.am: Use new YLWRAP * mh/.gitignore: Update. * mh/Makefile.am: Use new YLWRAP * mh/gylwrap.conf: New file. * mh/mh_alias.y: Rename to mh/mh_alias_gram.y * mh/mh_alias.l: Rename to mh/mh_alias_lex.l * mh/pick.y: Rename to mh/pick-gram.y * mimeview/.gitignore: Update. * mimeview/Makefile.am: Use new YLWRAP * mimeview/mimetypes.y: Rename to mimeview/grammar.y * mimeview/gylwrap.conf: New file. * mimeview/mimetypes.l: Rename to mimeview/lexer.l * po/POTFILES.in: Update
2017-06-13Switch to new locus typesSergey Poznyakoff38
* include/mailutils/types.hin (mu_locus): Remove. * include/mailutils/diag.h (mu_diag_at_locus): Remove. (mu_diag_at_locus_point,mu_diag_at_locus_range): New protos. * include/mailutils/mailutils.h: Include locus.h * include/mailutils/stream.h (MU_IOCTL_LOGSTREAM_GET_LOCUS) (MU_IOCTL_LOGSTREAM_SET_LOCUS): Remove. * libmailutils/stream/logstream.c (_log_ctl): Reflect this. * libmailutils/tests/logstr.at: Remove the related test. * libmailutils/tests/logstr.c: Ditto. * libmailutils/cfg/Makefile.am: Add new header. * libmailutils/cfg/cfg.h: New file. * libmailutils/cfg/format.c: Use mu_locus_range * libmailutils/cfg/lexer.l: Use the mu_linetrack facility * libmailutils/cfg/parser.y: LIkewise. * libmailutils/diag/diag.c (mu_diag_at_locus): Remove. (mu_diag_at_locus_point,mu_diag_at_locus_range): New protos. * comsat/action.c: Use mu_locus_point and mu_locus_range instead of the removed mu_locus. * include/mailutils/auth.h: Likewise. * include/mailutils/cfg.h: Likewise. * include/mailutils/sieve.h: Likewise. * libmailutils/base/wicket.c: Likewise. * libmailutils/tests/wicket.c: Likewise. * libmu_auth/radius.c: Likewise. * libmu_sieve/actions.c: Likewise. * libmu_sieve/comparator.c: Likewise. * libmu_sieve/extensions/moderator.c: Likewise. * libmu_sieve/mem.c: Likewise. * libmu_sieve/prog.c: Likewise. * libmu_sieve/require.c: Likewise. * libmu_sieve/runtime.c: Likewise. * libmu_sieve/sieve-priv.h: Likewise. * libmu_sieve/sieve.l: Use the mu_linetrack facility. * libmu_sieve/sieve.y: Likewise. * libmu_sieve/util.c: Use mu_locus_point and mu_locus_range instead of the removed mu_locus * libmu_sieve/variables.c: Likewise. * mail/source.c: Likewise. * mu/libexec/dbm.c: Likewise. * mu/libexec/logger.c: Likewise. * mu/libexec/wicket.c: Likewise. * sieve/sieve.c: Likewise. * sieve/tests/i-numeric.at: Update expected locations
2017-06-12Improve linetrack interfaceSergey Poznyakoff3
* include/mailutils/locus.h (mu_linetrack_rebase): New proto. * libmailutils/locus/linetrack.c (mu_linetrack_rebase): New function. * libmailutils/diag/diag.c (mu_diag_at_locus_range): New function.
2017-06-12Switch mimeview to new locus and linetrackerSergey Poznyakoff14
* include/mailutils/locus.h (mu_stream_print_locus_point): New proto. (mu_locus_range_copy): New proto. * include/mailutils/yyloc.h (mu_file_print_locus_point) (mu_file_print_locus_range): New protos. (YY_LOCATION_PRINT): Redo using mu_file_print_locus_range. * libmailutils/locus/filprloc.c: New file. * libmailutils/locus/genprloc.c: New file. * libmailutils/locus/strprloc.c: New file. * libmailutils/locus/Makefile.am: Add new files. * libmailutils/locus/debug.c (mu_stream_print_locus_range): Remove. Declared elsewhere. * libmailutils/locus/linetrack.c: use mu_locus_point_set_file, instead of mu_locus_point_init. * libmailutils/locus/locus.c: Likewise. (mu_locus_range_copy)P: New function. * mimeview/mimetypes.l: Provide rule for \n in ARGSTRING Always print diagnostics before returning BOGUS (lex_next_rule): Rewrite. Print verbose diagnostics if app.trace6 is set. (mimetypes_close): Deinitialize yylloc. * mimeview/mimetypes.y: Catch the BOGUS token. Adjust conflict expectation. Properly reference assigned loci. (mimetypes_parse): Return 1 if any errors detected. * mimeview/mimeview.c: Use debug category app instead of mime. * mimeview/tests/testsuite.at: Add new tests. * libmailutils/stream/logstream.c (_log_done): Deinitialize locus range.
2017-06-12Start switching lexers to the new line tracker facilitySergey Poznyakoff7
* include/mailutils/locus.h (MU_LOCUS_POINT_INITIALIZER): New define (MU_LOCUS_RANGE_INITIALIZER): New define (mu_locus_point_set_file, mu_locus_point_init) (mu_locus_point_deinit, mu_locus_point_copy) (mu_locus_range_deinit): New protos * libmailutils/locus/locus.c: New file. * libmailutils/locus/Makefile.am: Add new file. * libmailutils/locus/linetrack.c (mu_linetrack_at_bol): New function. (mu_linetrack_locus): New function. (mu_linetrack_advance): Use mu_locus_point_set_file to set the mu_file field. * libmailutils/tests/linetrack.c: Initialize and deinitialize locus range. * mimeview/mimetypes.l: switch to line tracker * mimeview/mimeview.h: Use defines from yyloc.h
2017-06-11Fix the -nodraftfolder and -nowhatnowproc options.Sergey Poznyakoff14
The commit 744c4a9c didn't take into account the -nodraftfolder and -nowhatnowproc options, which can be used to cancel the effect of the corresponding facilities. This commit fixes it. * mh/mh_getopt.c (mh_getopt_ext): New function. * mh/mh_getopt.h (mh_getopt_ext): New prototype. (mh_optinit): New struct. * mh/tests/comp.at: Test the use of Draft-Folder * mh/tests/forw.at: Likewise. * mh/tests/repl.at: Likewise. * mh/comp.c (main): use mh_getopt_ext to properly process draftfolder and whatnowproc. * mh/forw.c: Likewise. * mh/repl.c: Likewise. * mh/mh.h (mh_whom): Remove. (mh_whom_header, mh_whom_file, mh_whom_message): New protos. * mh/mh_alias.y (mh_read_aliases): Don't read aliases twice. * mh/mh_whatnow.c (whom): Use mh_whom_file. * mh/mh_whom.c (mh_whom): Rewrite and rename to mh_whom_file. (mh_whom_header, mh_whom_message): New functions. * mh/whom.c: Use mh_getopt_ext. Interpret command line arguments, depending on whether the draftfile facility is in use.
2017-06-09Merge recent fixes from masterSergey Poznyakoff51
2017-06-09Fix processing of abbreviated negated boolean optionsSergey Poznyakoff39
It was noted that "mhn -nohead" did not suppress the output of headers as "mhn -noheaders" did. It turned out that the negation marker was overwritten while scanning options for possible matching alternatives. This patch fixes it. * libmailutils/opt/opt.c (find_long_option): Don't overwrite the negation attribute of the last found option. * libmailutils/tests/parseopt.c: New option --headers, to test the fix. * libmailutils/tests/parseopt28.at: New testcase. * libmailutils/tests/Makefile.am: Add new testcase. * libmailutils/tests/testsuite.at: Include new testcase. * libmailutils/tests/parseopt*.at: Trivial changes
2017-06-08Re-use last invoked editor in MH whatnowSergey Poznyakoff2
This fixes a bug introduced in d30e5a07 * mh/mh.h (mh_whatnow_env) <last_ed>: New member * mh/mh_whatnow.c (_whatnow): Initialize reedit and last_ed members Free last_ed before returning (edit): Prefer wh->last_ed over wh->editor
2017-06-08Bugfix in mh_whatnowSergey Poznyakoff1
* mh/mh_whatnow.c (edit): Disable command expansion in wordsplit. See also 491bec23.
2017-06-08Merge branch 'locus' of git.sv.gnu.org:/srv/git/mailutils into locusSergey Poznyakoff1
2017-06-08Rename mu_locus_tracker to mu_linetrackSergey Poznyakoff8
2017-06-08Silence remaining *.[yl] rules in MakefilesSergey Poznyakoff3
2017-06-08Include new headers to the distributionSergey Poznyakoff1
2017-06-08Improve locus tracker; provide a testsuiteSergey Poznyakoff8
* include/mailutils/locus.h (mu_locus_track_stat): New struct. (mu_locus_tracker_stat): New proto. (mu_locus_tracker_retreat): Change return type. * libmailutils/locus/debug.c (mu_stream_vlprintf): Don't print spurious \n. (mu_lrange_debug): Fix incorrect call. * libmailutils/locus/tracker.c (mu_locus_track_create): Allocate storage for at least two lines of text. (mu_locus_tracker_stat): New function. (mu_locus_tracker_advance): Handle empty lines (mu_locus_tracker_retreat): Add error handling. * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add locktrack. * libmailutils/tests/tracker.c: Rename to loctrack.c * libmailutils/tests/testsuite.at: Add new testcase. * libmailutils/tests/loctrack.at: New test case.
2017-06-08Bugfix in mh_whatnowSergey Poznyakoff1
2017-06-07Fix logstream to support mu_locus_range.Sergey Poznyakoff17
* include/mailutils/locus.h (mu_stream_print_locus_range) (mu_stream_vlprintf, mu_stream_lprintf, mu_lrange_debug): New protos. * include/mailutils/stream.h (MU_IOCTL_LOGSTREAM_GET_LOCUS_RANGE) (MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE): New ioctls. * include/mailutils/sys/logstream.h (_mu_log_stream): Replace locus with struct mu_locus_range locrange. * libmailutils/locus/debug.c: Rewrite. * libmailutils/locus/ident.c (mu_ident_ref): Accept NULL argument. Fix initialization. (mu_ident_deref): Accept NULL argument. * libmailutils/stream/logstream.c: Rewrite. * libmailutils/tests/.gitignore: Update. * libmailutils/tests/Makefile.am: Add new tests. * libmailutils/tests/testsuite.at: Likewise. * libmailutils/tests/logstr.at: New testcase. * libmailutils/tests/logstr.c: New file. * libmailutils/tests/xscript.at: Minor change. * sieve/tests/i-numeric.at: Minor change.
2017-06-07Fix tests when logical and physical CWD differSergey Poznyakoff11
MH testsuite produced false negatives when run in a directory accessed by its logical name (symlink). To fix this, avoiding at the same time the use of non-portable "pwd -P" & "pwd -L", this commit adds a filter utility that replaces both logical and physical cwd with a dot on output. The MH testsuite is updated to use this utility. * testsuite/cwdrepl.c: New utility * testsuite/Makefile.am: Build cwdrepl * testsuite/.gitignore: Update. * testsuite/cwdrepl.at: New test. * testsuite/testsuite.at: Include new test. * mh/tests/atlocal.in (PATH): Add testsuite (remove_curdir): Remove function. * mh/tests/comp.at: Use cwdrepl, fix expected output. * mh/tests/forw.at: Likewise. * mh/tests/mhn.at: Likewise. * mh/tests/mhpath.at: Likewise. * mh/tests/repl.at: Likewise.
2017-06-07Begin implementing liblocusSergey Poznyakoff14
Liblocus is a part of libmailutils that will provide functions for manipulating source file locations, for use in lexers, grammars, etc. This will expand the functionality of the mu_locus type and logstreams. * configure.ac: add libmailutils/locus/ * include/mailutils/assoc.h (mu_assoc_install_ref2): New proto. * libmailutils/base/assoc.c (mu_assoc_install_ref2): New entry point. * libmailutils/base/copyfile.c (copy_regular_file): Add typecasts. * libmailutils/Makefile.am: Build liblocus * libmailutils/locus/Makefile.am: New file. * libmailutils/locus/debug.c: New file. * libmailutils/locus/ident.c: New file. * libmailutils/locus/tracker.c: New file. * libmailutils/tests/Makefile.am: New file. * libmailutils/tests/tracker.c: New file.
2017-06-06BugfixSergey Poznyakoff1
* mh/mh_whatnow.c (edit): Initialize ws.ws_env
2017-06-03mimeview: improve parser error recoverySergey Poznyakoff4
* mimeview/Makefile.am: Silent rules * mimeview/mimetypes.l (lex_reset): Remove. (lex_next_rule): New function. * mimeview/mimetypes.y: Expect 12 shift/reduce conflicts. Rewrite the error rule (yyprint): Print TYPE token correctly * mimeview/mimeview.h (lex_next_rule): New proto.
2017-06-02mh whatnow: allow for arguments in the editor profile valueSergey Poznyakoff1
* mh/mh_whatnow.c (edit): Make sure ed is always initialized. Accept command line arguments in the "editor" and "*-next" values.
2017-06-02New wordsplit call: mu_worsplit_appendSergey Poznyakoff4
* include/mailutils/wordsplit.h (mu_wordsplit_append): New proto. * libmailutils/string/wordsplit.c (mu_wordsplit_append): New function. * libmailutils/tests/wordsplit.at: Two more tests cases for mu_wordsplit_append. * libmailutils/tests/wsp.c: Accept extra arguments to append using the new function.
2017-06-01Revise the mime.types lexer; provide the testsuiteSergey Poznyakoff14
* am/testsuite.m4: New file. * configure.ac: Use the MU_CONFIG_TESTSUITE macro. * mimeview/Makefile.am (SUBDIRS): Add tests * mimeview/mimetypes.l: Rewrite in three exclusive states. * mimeview/mimetypes.y: Simplify grammar. * mimeview/mimeview.c: New option --identify (-i). * mimeview/mimeview.h: Update. * mimeview/tests/Makefile.am: New file. * mimeview/tests/atlocal.in: New file. * mimeview/tests/bf.c: New file. * mimeview/tests/testsuite.at: New file. * README: Update. * doc/texinfo/programs.texi
2017-06-01BugfixSergey Poznyakoff1
* mimeview/mimetypes.y (compare_bytes): Fix improper read size
2017-05-31Fix whatnow edit commandSergey Poznyakoff4
In whatnow shell, edit [program [parameters]] now calls program with supplied parameters plus the name of the file to edit. * mh/mh.h (mh_whatnow_env) <reedit>: New member. * mh/mh_whatnow.c (edit): Rewrite. * mh/whatnow.c (main): Properly handle argv[1] * NEWS: Update.
2017-05-31mh: check Local-Mailbox settingSergey Poznyakoff2
* mh/mh_init.c (mh_my_email): If Local-Mailbox is set, use its value. * mh/tests/scan.at: Add test for Local-Mailbox.
2017-05-31Fix MH initialization orderSergey Poznyakoff8
Calls to mh_global_profile_get and similar functions must appear only after a call to mh_getopt (more properly, after mh_init and mh_init2 are callead). This sequence was inadvertently changed by commit e267ac86, due to which comp, forw, repl and burst stopped reading important information from .mh_profile. Bug spotted by Pierre-Jean. * mh/burst.c: Make sure profile variables are accessed after the profile is read. * mh/comp.c: Likewise. * mh/forw.c: Likewise. * mh/repl.c: Likewise. * mh/mh.h (mh_whatnow_env_from_environ): Split into two functions: mh_whatnow_env_from_environ_early, to be called before mh_getopt, and mh_whatnow_env_from_environ_late, to be called after it. * mh/whatnowenv.c: Ditto. * mh/whatnow.c: Call these two in the right order. * THANKS: Update.
2017-05-31Improve mimeviewSergey Poznyakoff12
Old short option '-t' renamed to '-f' for consistency (-f stands for --file in most other utilities). Thus, 'mimevief -f my.types' reads the file 'my.types'. The '-t' option is reused as a short equivalent of the new '--lint' option, which instructs the tool to check the syntax of the mime.types file and exit, ignoring any surplus command line arguments. Added support for priority and regex functions. Improved debugging output. * mimeview/mimetypes.l: Rewrite lexer in a cleaner way. * mimeview/mimetypes.y: Rewrite parser. Track locations. Add line information to nodes and rules. Improve debugging * mimeview/mimeview.c: Remove the debug configuration statement. Using debug { level } provides the same functionality. Use mu_debug for debugging. New option -t (--lint). Rename the -t short option to -f. * mimeview/mimeview.h: Define lexer and parser macros for location tracking. * NEWS: Document changes to mimeview utility. * doc/texinfo/programs.texi: Document changes to mimeview utility. * lib/mailcap.c: Use standart mu_debug calls for debugging. * lib/mailcap.h (display_stream_mailcap): Change last argument: take a mu_debug_handle_t * libmailutils/diag/debcat (app): New category. Application-specific debug * mail/decode.c (display_submessage): Change invocation of display_stream_mailcap. * mail/mailvar.c: Setting "verbose" enables app.trace7, unsetting it clears app.*
2017-05-26Bugfixes in MH showSergey Poznyakoff9
* mh/show.c: Set cur before returning. Allow for arguments in showproc settings. Move to next or prev if invoked with the corresponding argv[0] * mh/mh.h (mh_msgset_parse): def argument is const. (mh_msgset_first_current, mh_msgset_first_uid): Remove proto. (mh_msgset_first): Change signature. (mh_msgset_last): New function. * mh/mh_msgset.c (mh_msgset_first): Return UID or message number depending on the value of the second parameter. (mh_msgset_first_current, mh_msgset_first_uid): Remove. (mh_msgset_last): New function. * mh/anno.c: Update. * mh/comp.c: Update. * mh/folder.c: Update. * mh/mh_init.c: Update. * mh/repl.c: Update. * mh/Makefile.am (install-exec-hook): Link show to prev and next
2017-05-26Implement mu_msgset_first and mu_msgset_lastSergey Poznyakoff6
* include/mailutils/msgset.h (mu_msgset_first, mu_msgset_last): New prototypes. * libmailutils/msgset/Makefile.am: Add new files. * libmailutils/msgset/first.c: New file. * libmailutils/msgset/last.c: New file. * libmailutils/tests/msgset.c: New options for testing the new functions. * libmailutils/tests/msgset.at: Test new functions.
2017-04-22BugfixSergey Poznyakoff1
* mh/etc/Makefile.am (bindir): Override. Reported by Ken Brown <kbrown@cornell.edu>
2017-04-22Functions for formatting RFC-2231-compliant mail headers fields.Sergey Poznyakoff19
* include/mailutils/cctype.h (MU_CTYPE_TSPEC): New class. Represents tspecials as per RFC 2045, section 5.1. (mu_istspec): New define. * libmailutils/string/muctype.c (mu_c_tab): Mark tspecials * include/mailutils/assoc.h (mu_assoc_mark) (mu_assoc_sweep): New protos. * libmailutils/base/assoc.c (_mu_assoc_elem): New field: mark (mu_assoc_mark,mu_assoc_sweep): New functions. * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Add dq.c and percent.c. * libmailutils/filter/dq.c: New file. * libmailutils/filter/percent.c: New file. * include/mailutils/filter.h (mu_percent_filter) (mu_dq_filter): New externs. * libmailutils/filter/filter.c (mu_filter_get_list): Register mu_percent_filter and mu_dq_filter. * include/mailutils/mime.h (mu_mime_header_set) (mu_mime_header_set_w): New protos. * libmailutils/mime/Makefile.am (libmime_la_SOURCES): Add mimehdrset.c * libmailutils/mime/mimehdrset.c: New file. * libmailutils/mime/mime.c (_mime_set_content_type): For multipart/alternative, remove also all parameters except charset from the Content-Type header. * mail/send.c (saveatt): Remove the now unneeded conditionals. * libmailutils/tests/mimehdr.at: Test formatting functions. * include/mailutils/stream.h (MU_IOCTL_FILTER_SET_OUTBUF_SIZE): New ioctl. * include/mailutils/sys/filter.h (_MU_FILTER_DISABLED) (_MU_FILTER_EOF): Remove. Use bitfields instead. (_mu_filter_stream): Remove fltflag. New fields: flag_disabled, flag_eof, outbuf_size. * libmailutils/stream/fltstream.c (MFB_BASE) (MFB_CURPTR, MFB_ENDPTR, MFB_SIZE, MFB_LEVEL) (MFB_POS, MFB_RDBYTES, MFB_FREESIZE) (MBF_CLEAR, MBF_FREE): Replace with inline functions. (init_iobuf): Use the outbuf_size field (unless 0) to set the output buffer size. (filter_read): Stop if on success if outbuf_size is set, without trying to fill the entire buffer. (filter_ctl): Handle MU_IOCTL_FILTER_SET_OUTBUF_SIZE. * libmailutils/tests/mimehdr.c: New option -width: format and print the value assuming given line width.
2017-04-19Minor changeSergey Poznyakoff1
* mail/mail.h: Remove unneeded extern qualifiers.
2017-04-19Automatically handle native character sets on input to the mail utility.Sergey Poznyakoff5
If the mime header is set, then mail will provide the missing 'charset' parameter for each Content-Type header that begins with 'text/'. Its value will be determined by examining the 'charset' mail variable. If it is set to 'auto' (the default), the character set will be extracted from the value of the LC_ALL environment variable. If it is unset, it will be deduced from the LANG environment variable. Thus, provided that LC_ALL is set correctly, the following setting in .mailrc is recommended to ensure that mails in native character sets will be processed correctly: set charset=auto mime In most cases, it can be simplified to just 'set mime'. * NEWS: Update. * doc/texinfo/programs.texi: Update the description of the charset variable. * mail/mail.h (util_get_charset): New proto. * mail/send.c (attach_set_content_type): New function. (attlist_add, add_body): Use attach_set_content_type to set the content_type field. * mail/util.c (util_get_charset): New function. (util_rfc2047_decode): Use util_get_charset.
2017-04-19mail: use mailvar_is_true to test boolean valuesSergey Poznyakoff16
2017-04-19New option --mimeSergey Poznyakoff6
* mail/mail.c (mime_option): New variable. (main): assume --mime if either or both of --content-type and --content-encoding are set. Set the mime variable if so. * mail/mail.h (mailvar_is_true): New prototype. * mail/send.c (add_attachments): Continue if the mime variable is set. (add_body): Rewrite, treating the text read from the stdin as MIME part in itself. * mailvar.c (mailvar_tab): New variable "mime" (mailvar_is_true): New function. * NEWS: Document --mime * doc/texinfo/programs.texi: Rewrite the Attachments subsection.
2017-04-19Minor changesSergey Poznyakoff3
* mail/mail.c (cli_attach): Exit if unable to attach file. * mail/mail.h (send_attach_file): Change prototype. * mail/send.c (send_attach_file): Return int. (add_body): Honor default_content_type
2017-04-18fix a typoSergey Poznyakoff1
2017-04-18Fix semantics of mu_header_set_value and creation of multipart/alternative MIMESergey Poznyakoff22
Until now, mu_header_set_value called with replace=0 prepended the header to the header list, if a header with such name was already present. This has been changed. Now, if the header with the requested name is already present, its action is as follows: 1. If repl is 0, return MU_ERR_EXISTS 2. Otherwise, replace the header with the new value. If the header is not present, it is appended to the end of the header list, instead of putting it at the beginning. This change is incompatible and breaks the tests, that relied on a particular field ordering. These are fixed as well. The use of mu_header_set_value throughout the sources has been revised to ensure that single-instance headers are never added twice. This change also facilitates the second part of this commit, which fixes creation of the multipart/alternative message by the mail utility. * libmailutils/mailbox/header.c (mu_header_set_value): Fix semantics. If the replace parameter is not set and the header field with the given name already exists, return MU_ERR_EXISTS without changing anything. If adding new header, append it to the end of the header list, instead of pushing it to the top. * configure.ac: Raise shared library revision number. * libmu_scm/mu_message.c (mu-message-set-header) (mu-message-set-header-fields): call mu_header_set_value explicitly if repl is not set. * libmu_sieve/extensions/moderator.c: Force replace header mode when needed. * libmu_sieve/extensions/vacation.c: Likewise. * mh/mh_init.c (mh_annotate): Prepend the annotation header. * mh/mhn.c: Force replace header mode when needed. * mh/repl.c: Likewise. * mh/send.c: Likewise. * libmailutils/tests/modmesg01.at: Change expected header order. * libmailutils/tests/modmesg03.at: Likewise. * mh/tests/mhn.at: Likewise. * mh/tests/send.at: Likewise. * sieve/tests/moderator.at: Likewise. * sieve/tests/redirect.at: Likewise. * sieve/tests/reject.at: Likewise. * sieve/tests/vacation.at: Likewise. * examples/mta.c (message_finalize): Append X-Authentication-Warning, instead of setting it. Make sure Content-Disposition is not set for parts of a multipart/ alternative MIME message. Some mail readers (notably, yahoo), misinterpret it. * libmailutils/mime/attachment.c (at_hdr): Use mu_header_set_value to set Content-Type and Content-Disposition. * libmailutils/mime/mime.c (_mime_set_content_type): If the content type is set to multipart/alternative, remove the Content-Disposition headers from the message parts. * mail/send.c (saveatt): Don't set content-disposition for multipart/alternative, it is now done by the library. (add_attachments): Warn about ignored headers. Append only Received and X-* headers, replace others. (parse_headers): Append headers. (compose_header_set): Use mu_header_append if COMPOSE_APPEND is requested. * mail/util.c (util_header_expand): Use mu_header_append.
2017-04-14BugfixSergey Poznyakoff1
* libmailutils/base/assoc.c (merge_sort): Fix last argument in call to cmp.

Return to:

Send suggestions and report system problems to the System administrator.