isspam.rc 600 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/rc
  2. if (~ $#USER 0)
  3. USER=$user
  4. cd /mail/box/$USER
  5. rfork en
  6. TMP=/tmp/spam.$sysname.$pid
  7. sed '/^$/,$ s/^From / From /' >$TMP.msg
  8. upas/fs -f $TMP.msg
  9. {
  10. echo '# hash table'
  11. upas/msgcat $TMP.msg | upas/msgtok |
  12. grep -v '^....................(.*) ' |
  13. sed 's/$/ 1/'
  14. } >$TMP.tok
  15. x=`{upas/bayes -k _prof.mbox _prof.spam ~ $TMP.tok}
  16. #echo xx $x xx >>/tmp/spam
  17. #ls -l _prof.mbox _prof.spam $TMP.tok>>/tmp/spam
  18. where=$x(1)
  19. prob=$x(2)
  20. echo $where $prob
  21. *=($x)
  22. shift 2
  23. while(! ~ $#* 0){
  24. echo ' ' $1 $2
  25. shift 2
  26. }
  27. rm -f $TMP.tok $TMP.msg
  28. if (~ $where *spam*){
  29. exit ''
  30. }
  31. if not {
  32. exit 'is ok'
  33. }