summaryrefslogtreecommitdiff
path: root/sys/lib/fax/receiverc
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 16:53:33 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 16:53:33 +0300
commite463eb40363ff4c68b1d903f4e0cdd0ac1c5977f (patch)
treed5e9f57c28f026cb21de3bd77cc10cd7f64aaa85 /sys/lib/fax/receiverc
parentb41b9034225ab3e49980d9de55c141011b6383b0 (diff)
Import sources from 2011-03-30 iso image - sys/lib
Diffstat (limited to 'sys/lib/fax/receiverc')
-rwxr-xr-xsys/lib/fax/receiverc58
1 files changed, 58 insertions, 0 deletions
diff --git a/sys/lib/fax/receiverc b/sys/lib/fax/receiverc
new file mode 100755
index 000000000..8ea0ad754
--- /dev/null
+++ b/sys/lib/fax/receiverc
@@ -0,0 +1,58 @@
+#!/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 jmk
+}
+exit 0