source: FOIAVistA/tag/r/MAILMAN-XM/XMLTCP.m@ 1219

Last change on this file since 1219 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.9 KB
Line 
1XMLTCP ;(WASH ISC)/CAP-TCP/IP to MailMan ;07/23/2002 06:54
2 ;;8.0;MailMan;;Jun 28, 2002
3 ; modified to run with MSM NT and Protocol TCP/IP-MAILMAN (file 3.4)
4SEND ;returns ER(0 OR 1), XMLER=number of "soft" errors
5 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D C^XMCTRAP"
6 E S X="C^XMCTRAP",@^%ZOSF("TRAP")
7 I $G(XMINST) D XMTSTAT^XMTDR(XMINST,"S",XMSG,1)
8 W XMSG,$C(13,10),!
9 Q
10REC ;Receive a line (must keep buffer / lines divided by LF)
11 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D C^XMCTRAP"
12 E S X="C^XMCTRAP",@^%ZOSF("TRAP")
13 ;Return line if read last time
14RE G R:XMLTCP[$C(10) S %=255-$L(XMLTCP) G R:%<1
15 ;Insure can clean up if line dropped, etc.
16 I $S(XMOS["VAX":1,+$G(XMOS("MSMVER"))<8:1,XMOS["OpenM-NT":1,1:0) R X#$S(%:%,1:1):$G(XMSTIME,160) G RE2
17 ;Compliant with M standard
18 R X:$G(XMSTIME,60)
19 ;
20RE2 I '$T,"."_$C(10)'=XMLTCP S XMRG="" D ERTRAN^XMC1("Receiver timed out") Q
21 I X="" S ER=ER+.1 S:ER=1 XMRG="" Q:ER=1 H 1 G RE
22 S XMLTCP=XMLTCP_X I XMLTCP'[$C(10) G RE
23R S %=$F(XMLTCP,$C(10))
24 ;
25 ;Strip out LF (and CR, if present)
26 I %,%<256 S XMRG=$E(XMLTCP,1,%-3+($A(XMLTCP,%-2)'=13)),XMLTCP=$E(XMLTCP,%,$L(XMLTCP)) G RQ
27 ;
28 ;Line too long or doesn't contain a Line Feed, return first 255 chars.
29 S XMRG=$E(XMLTCP,1,255),XMLTCP=$E(XMLTCP,256,$L(XMLTCP))
30 ;S:$E(XMLTCP)="." XMLTCP="."_XMLTCP
31 ;
32RQ I $L(XMRG),$C(13,10)[$E(XMRG) S XMRG=$E(XMRG,2,$L(XMRG)) G RQ
33 I $G(XMINST) D XMTSTAT^XMTDR(XMINST,"R",XMRG)
34 Q
35SNDGTM ; Send for GT.M
36 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D C^XMCTRAP"
37 E S X="C^XMCTRAP",@^%ZOSF("TRAP")
38 I $G(XMINST) D XMTSTAT^XMTDR(XMINST,"S",XMSG,1)
39 W XMSG,$C(13,10),#
40 Q
41RECGTM ; Receive for GT.M
42 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D C^XMCTRAP"
43 E S X="C^XMCTRAP",@^%ZOSF("TRAP")
44 R XMRG:$G(XMSTIME,60)
45 I '$T S XMRG="" D ERTRAN^XMC1("Receiver timed out") Q
46 S XMRG=$TR(XMRG,$C(10,12,13))
47 I $G(XMINST) D XMTSTAT^XMTDR(XMINST,"R",XMRG)
48 Q
Note: See TracBrowser for help on using the repository browser.