aboutsummaryrefslogtreecommitdiff
path: root/bin/upas/isspam
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-05-21 18:39:29 +0000
committerrsc <devnull@localhost>2006-05-21 18:39:29 +0000
commitf1007ee0c6a2dfdc5512a1be3dada65cbc5d5391 (patch)
tree2a2b6aae68d2caa2d102fc2acc2d5f429dea02ce /bin/upas/isspam
parent38c7eb9bd22e05ef32998858b178edaf8269cbab (diff)
downloadplan9port-f1007ee0c6a2dfdc5512a1be3dada65cbc5d5391.tar.gz
plan9port-f1007ee0c6a2dfdc5512a1be3dada65cbc5d5391.tar.bz2
plan9port-f1007ee0c6a2dfdc5512a1be3dada65cbc5d5391.zip
new
Diffstat (limited to 'bin/upas/isspam')
-rwxr-xr-xbin/upas/isspam35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/upas/isspam b/bin/upas/isspam
new file mode 100755
index 00000000..03be23f7
--- /dev/null
+++ b/bin/upas/isspam
@@ -0,0 +1,35 @@
+#!/usr/local/plan9/bin/rc
+
+rfork en
+
+if (~ $#* 0)
+ echo usage: isspam mesg && exit 'usage'
+
+TMP=/tmp/isspam.$USER.$pid
+{
+ echo '# hash table'
+ msgcat $1|sed '/^$/,$ s/^From / From /'|upas/msgtok|
+ grep -v '^....................(.*) '|
+ sed 's/$/ 1/'
+} >$TMP.tok
+
+x=`{upas/bayes -k $HOME/mail/_prof.mbox $HOME/mail/_prof.spam ~ $TMP.tok}
+where=$x(1)
+prob=$x(2)
+echo $where $prob
+*=($x)
+shift 2
+while(! ~$#* 0){
+ echo ' ' $1 $2
+ shift 2
+}
+
+rm -f $TMP.tok
+if (~ $where *spam*){
+ echo spam
+ exit ''
+}
+if not {
+ echo ok
+ exit 'is ok'
+}