msgcat.rc 697 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/rc
  2. rfork ne
  3. if(~ $1 /mail/fs/mbox*){
  4. dir=$*
  5. }
  6. if not{
  7. upas/fs -f $1
  8. dir=/mail/fs/mbox/[0-9]*
  9. }
  10. fn catmsg {
  11. t=`{cat type}
  12. switch($t){
  13. case text/html
  14. cp body /tmp/xxx
  15. echo '
  16. ,x/<!--(-?[^\-]|--[^>]|\n)*-->/ c//
  17. ,x/<[^>]+>/d
  18. ,p
  19. u
  20. ,y/<[^>]+>/d
  21. ,p
  22. ' | sam -d body |[2] sed '1d;/^\?/d'
  23. case text/*
  24. cat body
  25. case message/*
  26. cat body
  27. case multipart/alternative
  28. if(~ `{cat 1/type} text/plain)
  29. cd 1 && {catmsg; cd ..}
  30. if not if (~ `{cat 2/type >[2]/dev/null} text/plain)
  31. cd 2 && {catmsg; cd ..}
  32. if not {
  33. for (i in [0-9]*)
  34. cd $i && {catmsg; cd ..}
  35. }
  36. case *
  37. echo $t
  38. }
  39. }
  40. for(i in $dir){
  41. cd $i
  42. cat unixheader header
  43. echo
  44. catmsg
  45. echo
  46. }