1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
# pf-save.rc
#
# $Id: pf-save.rc,v 1.1 2002/01/01 22:25:33 jaalto Exp $
#
# Author: Alan K. Stebbens <aks@sgi.com>
#
# Procmail recipe file to save the current message to
# a list of one or more folders set by pf-check.rc.
#
# You may wish to set the variable PF_DEST before invoking.
#
# INCLUDERC=pf-save.rc
#
# If the message is filed into a folder, LOGABSTRACT is
# set to "off" so a duplicate log is not created.
:0
* PF_DEST ?? .
{
# Add a new X-Filed if necessary
:0 fh
* !^X-Filed:
| formail -A "X-Filed: $PF_DEST"
# Else, if there is already a header, possibly append to it
:0 E
{
OLD_PF_DEST=`formail -zxX-Filed:`
:0 fh
* $!^X-Filed:.*$PF_DEST
|formail -I"X-Filed: $OLD_PF_DEST $PF_DEST"
}
# If filing into MH folders, use one copy and procmail will take
# care of linking.
:0 c
* PF_DEST ?? /\.$
$PF_DEST
# If not filing into MH folders, use recursive filing
:0 E
{
DEST=`echo $PF_DEST | cut -d' ' -f1`
PF_DEST=`echo $PF_DEST' ' | cut -d' ' -f2-`
# File into the first folder now
:0 c:
$DEST
# Possibly file into the 2nd and other folders with recursion
# It must be non-blanks, and not identical to the already filed DEST
:0 c
* PF_DEST ?? [^ ]
* $! DEST ?? $PF_DEST
|procmail -pm PF_RECURSE=yes pf-save.rc
# If we were recursing, don't file multiple copies into DEFAULT
:0
* PF_RECURSE ?? yes
{ HOST=_stop_now_ }
}
LOGABSTRACT=off
}
|