msgcat.rc 678 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. echo '
  15. ,x/<!--(-?[^\-]|--[^>]|\n)*-->/ c//
  16. ,x/<[^>]+>/d
  17. ,p
  18. u
  19. ,y/<[^>]+>/d
  20. ,p
  21. ' | sam -d body |[2] sed '1d;/^\?/d'
  22. case text/*
  23. cat body
  24. case message/*
  25. cat body
  26. case multipart/alternative
  27. if(~ `{cat 1/type} text/plain)
  28. cd 1 && {catmsg; cd ..}
  29. if not if (~ `{cat 2/type >[2]/dev/null} text/plain)
  30. cd 2 && {catmsg; cd ..}
  31. if not {
  32. for (i in [0-9]*)
  33. cd $i && {catmsg; cd ..}
  34. }
  35. case *
  36. echo $t
  37. }
  38. }
  39. for(i in $dir){
  40. cd $i
  41. cat unixheader header
  42. echo
  43. catmsg
  44. echo
  45. }