Plan 9 from Bell Labs’s /usr/web/sources/plan9/mail/lib/isspam.rc

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


#!/bin/rc

if (~ $#USER 0)
	USER=$user
cd /mail/box/$USER
rfork en

TMP=/tmp/spam.$sysname.$pid
sed '/^$/,$ s/^From / From /' >$TMP.msg
upas/fs -f $TMP.msg
{
	echo '# hash table'
	upas/msgcat $TMP.msg | upas/msgtok |
		grep -v '^....................(.*)	' |
		sed 's/$/	1/'
	} >$TMP.tok

x=`{upas/bayes -k _prof.mbox _prof.spam ~ $TMP.tok}
#echo xx $x xx >>/tmp/spam
#ls -l _prof.mbox _prof.spam  $TMP.tok>>/tmp/spam
where=$x(1)
prob=$x(2)
echo $where $prob
*=($x)
shift 2
while(! ~ $#* 0){
	echo '	' $1 $2
	shift 2
}
rm -f $TMP.tok $TMP.msg
if (~ $where *spam*){
	exit ''
}
if not {
	exit 'is ok'
}

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].