1
0

receiverc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/rc
  2. spool=/mail/faxqueue
  3. recipients=/mail/faxqueue/faxrecipients
  4. # run mail as if we're on fs
  5. rm /srv/fs
  6. 9fs fs
  7. bind -c /n/fs/mail/faxqueue /mail/faxqueue
  8. #
  9. # Arguments should be
  10. # time Y|N pages [ftsi]
  11. #
  12. switch($#*){
  13. case 4
  14. #
  15. # Check for the NYT. It's 9 pages from 'Via Fax '.
  16. #
  17. nyt=false
  18. if(~ $2 Y && {~ $4 'Via Fax '}){
  19. switch(`{date|sed 's/ .*//'}){
  20. case Mon Tue Wed Thu Fri
  21. hour=`{date|sed 's/.* ([0-9][0-9]):.*/\1/'}
  22. if(test $3 -gt 7 -a '(' $hour -lt 7 -o $hour -ge 21 ')')
  23. nyt=true
  24. case *
  25. if(test $3 -gt 7)
  26. nyt=true
  27. }
  28. }
  29. switch($nyt){
  30. case true
  31. to=`{seq 0 1 $3}
  32. for(i in `{seq 2 1 $3}){
  33. switch($i){
  34. case ?
  35. ext=00$i
  36. case ??
  37. ext=0$i
  38. case ???
  39. ext=$i
  40. }
  41. cp $spool/$1.$ext /n/fs/lib/nyt/nyt.$to($i)
  42. }
  43. cp $spool/$1.1 /n/fs/lib/nyt/nyt.$3
  44. rm -f $spool/$1.*
  45. case *
  46. {echo $*; echo FAX: page -w $spool/$1.'*'} | mail `{cat $recipients}
  47. }
  48. case 3
  49. {echo $*; echo FAX: page -w $spool/$1.'*'} | mail `{cat $recipients}
  50. case *
  51. {echo $*; echo FAX: page -w $spool/$1.'*'} | mail jmk
  52. }
  53. exit 0