ref: ef17043327d999101009f85aae72f77399db15ac
dir: /sys/src/cmd/fax/receiverc/
#!/bin/rc spool=/mail/faxqueue recipients=/mail/faxqueue/faxrecipients # run mail as if we're on fs rm /srv/fs 9fs fs bind -c /n/fs/mail/faxqueue /mail/faxqueue # # Arguments should be # time Y|N pages [ftsi] # switch($#*){ case 4 # # Check for the NYT. It's 9 pages from 'Via Fax '. # nyt=false if(~ $2 Y && {~ $4 'Via Fax '}){ switch(`{date|sed 's/ .*//'}){ case Mon Tue Wed Thu Fri hour=`{date|sed 's/.* ([0-9][0-9]):.*/\1/'} if(test $3 -gt 7 -a '(' $hour -lt 7 -o $hour -ge 21 ')') nyt=true case * if(test $3 -gt 7) nyt=true } } switch($nyt){ case true to=`{seq 0 1 $3} for(i in `{seq 2 1 $3}){ switch($i){ case ? ext=00$i case ?? ext=0$i case ??? ext=$i } cp $spool/$1.$ext /n/fs/lib/nyt/nyt.$to($i) } cp $spool/$1.1 /n/fs/lib/nyt/nyt.$3 rm -f $spool/$1.* case * {echo $*; echo FAX: page -w $spool/$1.'*'} | mail `{cat $recipients} } case 3 {echo $*; echo FAX: page -w $spool/$1.'*'} | mail `{cat $recipients} case * {echo $*; echo FAX: page -w $spool/$1.'*'} | mail postmaster } exit 0