#!/builddir/build/BUILD/plan9port-0_20261021git.1f13969-build/plan9port-1f1396913fb5372408f442ed26933f5ae4b399cd/bin/rc

rfork en

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

TMP=/tmp/spam.$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.*
