diff options
author | rsc <devnull@localhost> | 2005-10-29 16:26:44 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-10-29 16:26:44 +0000 |
commit | 5cdb17983ae6e6367ad7a940cb219eab247a9304 (patch) | |
tree | 8ca1ef49af2a96e7daebe624d91fdf679814a057 /src/cmd/upas/filterkit/pipeto.sample-hold | |
parent | cd3745196389579fb78b9b01ef1daefb5a57aa71 (diff) | |
download | plan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.tar.gz plan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.tar.bz2 plan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.zip |
Thanks to John Cummings.
Diffstat (limited to 'src/cmd/upas/filterkit/pipeto.sample-hold')
-rw-r--r-- | src/cmd/upas/filterkit/pipeto.sample-hold | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/cmd/upas/filterkit/pipeto.sample-hold b/src/cmd/upas/filterkit/pipeto.sample-hold new file mode 100644 index 00000000..5794f732 --- /dev/null +++ b/src/cmd/upas/filterkit/pipeto.sample-hold @@ -0,0 +1,43 @@ +#!/bin/rc + +# create a /tmp for here documents +rfork en +bind -c /mail/tmp /tmp + +KEY=whocares +USER=ken + +RECIP=$1 +MBOX=$2 +PF=/mail/box/$USER/_pattern +TMP=/mail/tmp/mine.$pid +BIN=/bin/upas +D=/mail/fs/mbox/1 + +# save and parse the mail file +{sed '/^$/,$ s/^From / From /'; echo} > $TMP +upas/fs -f $TMP + +# if we like the source +# or if the subject contains a valid token +# then deliver the mail and allow all the addresses +if( $BIN/list check $PF $D/from $D/sender $D/replyto ) +{ + $BIN/deliver $RECIP $D/from $MBOX < $D/raw + $BIN/list add $PF $D/from $D/to $D/cc $D/sender + rm $TMP + exit 0 +} +switch($status){ +case *!match* + echo `{date} dropped $RECIP From `{cat $D/replyto} >> /mail/box/$USER/_bounced >[2] /dev/null + rm $TMP + exit 0 +} + +# don't recognize the sender so hold the message +$BIN/deliver $RECIP $D/from /mail/box/$USER/_held < $D/raw + +rv=$status +rm $TMP +exit $status |