diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-19 18:13:12 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-19 18:13:12 +0200 |
commit | 9c88f65ca4c68782d236ed1cb49b920b70974e34 (patch) | |
tree | a6ec1d06c77a237908e7e2e0bd42ceb7899c0744 | |
parent | b89db40aef494bb47c38c9b58ffc0077587698cc (diff) | |
download | mbar-9c88f65ca4c68782d236ed1cb49b920b70974e34.tar.gz mbar-9c88f65ca4c68782d236ed1cb49b920b70974e34.tar.bz2 |
Update docs
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | mbar.1 | 185 | ||||
-rw-r--r-- | mbar.c | 2 |
3 files changed, 136 insertions, 62 deletions
@@ -8,6 +8,9 @@ VMIN = 1 # Installation prefix PREFIX = /usr BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man + +MAN1DIR = $(MANDIR)/man1 # Install program. Use cp(1) if not available. INSTALL = install @@ -47,6 +50,12 @@ clean: echo "ok" > .prereq; \ fi -install: mbar +install: install-bin install-man + +install-bin: mbar $(MKHIER) $(DESTDIR)$(BINDIR) $(INSTALL) mbar $(DESTDIR)$(BINDIR) + +install-man: + $(MKHIER) $(DESTDIR)$(MAN1DIR) + $(INSTALL) mbar.1 $(DESTDIR)$(MAN1DIR) @@ -14,77 +14,140 @@ .\" You should have received a copy of the GNU General Public License .\" along with mbar. If not, see <http://www.gnu.org/licenses/>. .\" -.TH MBAR 1 "November 19, 2016" "MBAR" +.TH MBAR 1 "December 19, 2016" "MBAR" .SH NAME mbar \- mailbox archiver .SH SYNOPSIS -\fBmbar\fR\ - [\fB\fB\-cDintvV?\fR\fR]\ - [\fB\-b \fIDATE\fR]\ - [\fB\-f \fIFILE\fR]\ - [\fB\-I \fIDIR\fR]\ - [\fB\-L \fIDIR\fR]\ - [\fB\-m \fINUM\fR]\ - [\fB\-p \fIPAT\fR]\ - [\fB\-r \fIMODULE\fR]\ - [\fB\-\-before\-date=\fIDATE\fR]\ - [\fB\-\-clear\-include\-path\fR]\ - [\fB\-\-clear\-library\-path\fR]\ - [\fB\-\-clearpath\fR]\ - [\fB\-\-compile\-only\fR]\ - [\fB\-\-config\-file=\fIFILE\fR]\ - [\fB\-\-config\-help\fR]\ - [\fB\-\-config\-lint\fR]\ - [\fB\-\-config\-verbose\fR]\ - [\fB\-\-debug\-level=\fILEVEL\fR]\ - [\fB\-\-debug\-line\-info\fR]\ - [\fB\-\-dry\-run\fR]\ - [\fB\-\-dump\fR]\ - [\fB\-\-help\fR]\ - [\fB\-\-includedir=\fIDIR\fR]\ - [\fB\-\-instructions\fR]\ - [\fB\-\-libdir=\fIDIR\fR]\ - [\fB\-\-libdir\-prefix=\fIDIR\fR]\ - [\fB\-\-locus\fR]\ - [\fB\-\-log\-facility=\fIFACILITY\fR]\ - [\fB\-\-mailbox\-type=\fITYPE\fR]\ - [\fB\-\-maxdepth=\fINUM\fR]\ - [\fB\-\-no\-config\fR]\ - [\fB\-\-no\-site\-config\fR]\ - [\fB\-\-no\-user\-config\fR]\ - [\fB\-\-pattern=\fIPAT\fR]\ - [\fB\-\-program\-name=\fINAME\fR]\ - [\fB\-\-require=\fIMODULE\fR]\ - [\fB\-\-set=\fIPARAM=\fIVALUE\fR]\ - [\fB\-\-show\-config\-options\fR]\ - [\fB\-\-template\-file=\fIFILE\fR]\ - [\fB\-\-trace\fR]\ - [\fB\-\-usage\fR]\ - [\fB\-\-verbose\fR]\ - [\fB\-\-version\fR]\ - \fIDIR\fR \fIDEST\fR [\fIEXPR\fR] +\fBmbar\fR [\fBOPTION\fR] \fIDIR\fR \fIDEST\fR [\fIEXPR\fR] .SH DESCRIPTION +Scans directory \fIDIR\fR for mailboxes matching pattern (by default - +\fB*\fR, i.e. all mailboxes). For each mailbox, messages matching the +supplied criteria are picked and moved to the mailbox of the same +name, located under the directory \fIDEST\fR. If the destination +mailbox doesn't exist, it will be created with the necessary +intermediate directory, so that directory hierarchy under \fIDEST\fR +is identical to that under \fIDIR\fR. +.PP +When no selection criteria are supplied, \fBmbar\fR moves all messages +in each mailbox. +.PP +The \fB\-b\fR (\fB\-\-before\-date\fR) option instructs \fBmbar\fR to +archive only messages received before the date indicated by its +argument. A wide variety of date formats are understood. For a +detailed discussion of them, see +.BR http://mailutils.org/manual/html_section/Date-Input-Formats.html . +.PP +The following example will archive messages received more than one +year ago: +.EX +mbar -b '1 year ago' /var/mail /var/backups/mail +.EE +.PP +The utility works by creating a \fBSieve\fR script using the supplied +criterion as a condition and by executing this script on each mailbox +encountered. +.PP +More complex criteria can be provided using the \fIEXPR\fR optional +argument. The value of this argument must be a valid \fBSieve\fR +conditional suitable for use in the \fBif\fR statement. +.PP +The script is built from a template, by +expanding the following macro variables: +.TP +.B cond +Expands to the condition expression +.TP +.B dest +Expands to the name of the destination mailbox. +.TP +.B requires +Expands to a comma-separated list of additional requires needed for +successful compilation of the Sieve script. Such additional requires +are supplied via the \fB\-r\fR (\fB\-\-require\fR) command line +option. +.TP +.B keep +Expands to \fB1\fR if the \fB\-k\fR (\fB\-\-keep\fR) option is given +and to empty string otherwise. +.PP +The default template script is: +.PP +.EX +require ["fileinto"${requires}]; +if ${cond} { + fileinto "${dest}";${keep:+keep;} +} +.EE +.PP +The \fI-b \fIDATE\fR option is a shortcut for specifying +.PP +.EX +timestamp :before "Date" "\fIDATE\fR" +.EE +.PP +as \fIEXPR\fR. .SH OPTIONS .TP \fB\-b\fR, \fB\-\-before\-date=\fIDATE\fR Archive messages received before DATE - - \-c, \-\-compile\-only compile script and exit - \-D, \-\-dump compile script, dump disassembled sieve code to - terminal and exit - \-f, \-\-template\-file=FILE read template from FILE - \-i, \-\-instructions sieve instruction trace - \-\-locus show action locations with verbose output - \-m, \-\-maxdepth=NUM limits nesting depth - \-\-mailbox\-type=TYPE set type of destination mailboxes - \-n, \-\-dry\-run don't do anything: print what would be done - \-p, \-\-pattern=PAT archive mailboxes matching pattern - \-r, \-\-require=MODULE require MODULE in the produced Sieve script - \-t, \-\-trace sieve trace - \-v, \-\-verbose verbosely print what is being done - +.TP +\fB\-c\fR, \fB\-\-compile\-only\fR +Compile script and exit +.TP +\fB\-D\fR, \fB\-\-dump\fR +Compile script, dump disassembled sieve code to terminal and exit +.TP +\fB\-f\fR, \fB\-\-template\-file=\fIFILE\fR +Read template from \fIFILE\fR. +.TP +\fB\-i\fR, \fB\-\-instructions\fR +Sieve instruction trace. +.TP +\fB\-\-locus\fR +Show action locations with verbose output. +.TP +\fB\-m\fR, \fB\-\-maxdepth=\fINUM\fR +Limits nesting depth to \fINUM\fR directories. +.TP +\fB\-\-mailbox\-type=\fITYPE\fR +Set type of destination mailboxes. +.TP +\fB\-n\fR, \fB\-\-dry\-run\fR +Don't do anything: print what would be done. +.TP +\fB\-p\fR, \fB\-\-pattern=\fIPAT\fR +Archive mailboxes matching pattern (default is \fB*\fR). +.TP +\fB\-r\fR, \fB\-\-require=\fIMODULE\fR +Require \fIMODULE\fR in the produced Sieve script. +.TP +\fB\-t\fR, \fB\-\-trace\fR +Sieve trace. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Verbosely print what is being done. .SH EXIT CODES +The exit codes conform with +.BR /usr/include/sysexits.h : +.PP +.TP +.B 0 +Success. +.TP +.BR 64 " (" EX_USAGE ) +Command line usage error. +.TP +.BR 69 " (" EX_UNAVAILABLE ) +Unable to create mailbox or intermediate directories. +.TP +.BR 70 " (" EX_SOFTWARE ) +Internal software error. Please report if you ever encounter this +exit code. +.TP +.BR 78 " (" EX_CONFIG ) +Configuration file error. .SH "SEE ALSO" +.BR http://mailutils.org/manual/html_chapter/Sieve-Language.html . .SH AUTHORS Sergey Poznyakoff .SH "BUG REPORTS" @@ -285,6 +285,8 @@ build_sieve (char const *folder, int flags) } if (verbose > 1) mu_sieve_set_logger (mach, _sieve_action_log); + mu_sieve_set_environ (mach, "location", "MS"); + mu_sieve_set_environ (mach, "phase", "post"); mu_sieve_set_data (mach, (void *)folder); mu_sieve_set_dry_run (mach, dry_run); |