10
20 :
30 ON ERROR VDU3:REPORT:CLOSE#0:PRINT:END
40 INPUT"Document: "doc$
50 INPUT"Maillist: "mail$
60 INPUT"Printout: "prt$
70 doc%=OPENIN(doc$):IF doc%=0 PRINTdoc$;" not found":END
80 mail%=OPENIN(mail$):IF mail%=0 PRINTmail$;" not found":CLOSE#doc%:END
90 REPEAT:PTR#doc%=0
100 tmp%=OPENOUT"!tmp":IFtmp%=0 PRINT"Cannot open !tmp":CLOSE#mail%:CLOSE#doc%:END
110 margin$="":REPEAT:b%=BGET#doc%:IFb%=13 margin$=""
120 IFb%<>64 BPUT#tmp%,b%:margin$=margin$+CHR$b%
130 UNTILb%=64 OR EOF#doc%
140 IF b%=64 PROCaddr:PROCrest
150 CLOSE#tmp%:OSCLIprt$+" !tmp"
160 UNTILEOF#mail%
170 CLOSE#mail%
180 CLOSE#doc%
190 END
200 DEFPROCaddr:margin$=MID$(margin$,2)
210 b%=0:REPEAT:l%=b%:b%=BGET#mail%:BPUT#tmp%,b%
220 IF b%=13 AND l%<>13 AND margin$<>"" FOR n%=1 TO LENmargin$:BPUT#tmp%,ASCMID$(margin$,n%,1):NEXT
230 UNTILb%=13 AND l%=13:ENDPROC
240 DEFPROCrest
250 REPEAT:BPUT#tmp%,BGET#doc%:UNTILEOF#doc%
260 ENDPROC