aboutsummaryrefslogtreecommitdiff
path: root/bin/upas/unspam
blob: 1d056d528199bb48e19e5b0196592a11417ec3a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/local/plan9/bin/rc

rfork en

if (~ $#* 0)
	echo usage: unspam mesg && exit 1

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

cd $home/mail
upas/addhash -o _prof.mbox _prof.mbox 1 $TMP.tok 1
upas/addhash -o _prof.spam _prof.spam 1 $TMP.tok -1
rm -f $TMP.*