Plan 9 from Bell Labs’s /usr/web/sources/contrib/sl/rc/pipeto

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
rfork en
ramfs -m /mail/tmp

USER=sl
MDIR=/mail/box/$USER
RECIP=$1
MBOX=$2
TMP=/mail/tmp/mine.$pid
BIN=/bin/upas
D=/mail/fs/mbox/1

russian=(А Б В Г Д Е Ё Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш щ ъ ы ь э ю я koi8-r)
keywords=(cialis phentermine rolex viagra)
subjects=(cirin7734 Bathe_in_safety BREAKING_NEWS Browse_Exotic_Car_Sales Credit_card_report Do_you_know Dr._Oz Dr._OZ Dr_Oz Dr_OZ Find_at_least_one_thing_to_love_this_week have_Tweets_for How_to_Get_Skinny Get_Slender Get_Slim Interesting_Pages_on_Facebook Julia_sent_new_message_for_you look_at_my_photos Lower_Payment Masha_22 Please_rate_my_body Real_Slimming_Revolution Rent_an_exotic_car Suggestions_based_on Suggestions_similar_to Tax_Refund_New_Message_Alert Teeth-Whitening The_Federal_Executive_Council Tweets_from Weight_Loss Why_we_stopped_our_communication You_have_a_message_from_Yulia)
spam=`{echo '('$"russian'|'$"keywords'|'$"subjects')' | sed 's/ /\|/g; s/_/ /g'}

blacklist=([email protected])
blacklist=`{echo '('$"blacklist')' | sed 's/ /\|/g'}

whitelist=(1oct1993 9fans 9front aiju amazon appnano bell-labs cat-v cinap c0nn deraadt drawterm earles fedex flickr godownmatthew [email protected] khm lieber livejournal mars2 massivefictions mcgirt mgk.ro misha nix p9p plan9 plan9port pre1 presotto pushedunder [email protected] [email protected] rsc u9fs ups usps)
whitelist=`{echo '('$"whitelist')' | sed 's/ /\|/g'}

fn stop{
	#chmod +t $MDIR/mbox/*
	rm $TMP
	exit $status
}

{sed '/^$/,$ s/^From / From /'; echo} > $TMP
upas/fs -f $TMP

if(grep -i -s $"whitelist $D/from)
	$BIN/deliver $RECIP $D/from $MBOX < $D/raw
if not if(grep -i -s $"whitelist $D/subject)
	$BIN/deliver $RECIP $D/from $MBOX < $D/raw
if not if(grep -i -s [email protected] $D/to $D/cc)
	stop
if not if(grep -i -s $"spam $D/subject || grep -i -s $"blacklist $D/from){
	$BIN/deliver $RECIP $D/from $MDIR/spam < $D/raw
	chmod +t $MDIR/spam/*
}
if not
	$BIN/deliver $RECIP $D/from $MBOX < $D/raw

stop

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].