From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 18-MAY-1989 23:48
To:	MRGATE::"ARISIA::EVERHART"
Subj:	READMAIL.COM - VMS Mail Filter (Corrected)

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu, 18 MAY 89 19:51:56 PDT
Received: from SRI-NIC.ARPA by KL.SRI.COM with TCP; Thu, 18 May 89 17:59:33 PDT
Received: from dsfvax.JPL.NASA.GOV by SRI-NIC.ARPA with TCP; Thu, 18 May 89 15:17:52 PDT
Received: by dsfvax id <000009382B1@dsfvax.JPL.NASA.GOV> ;
       Thu, 18 May 89 15:18:11 PST
Date: Thu, 18 May 89 15:15:05 PST
From: TENCATI@dsfvax.JPL.NASA.GOV
Subject: READMAIL.COM - VMS Mail Filter (Corrected)
To: info-vax%kl.sri.com@sri-nic.arpa
X-Vms-Mail-To: EXOS%"info-vax%kl.sri.com@sri-nic.arpa",TENCATI     
Message-Id: <890518151505.000009382B1@dsfvax.JPL.NASA.GOV>

$!
$Local_Msg: subroutine
$ write mailfile "File Local"
$endsubroutine
$!
$JEMS_Msg: subroutine
$ write mailfile "File Jems"
$endsubroutine
$!
$InfoVax_msg: subroutine
$ write mailfile "File Infovax"
$endsubroutine
$!
$SPAN_msg: subroutine
$ write mailfile "File SPAN"
$endsubroutine
$!
$Security_msg: subroutine
$ write mailfile "File Security"
$endsubroutine
$!
$tcpip_msg: subroutine
$ write mailfile "File tcpip"
$endsubroutine
$!
$Risk_msg: subroutine
$ write mailfile "File Risk"
$endsubroutine
$!
$other_msg: subroutine
$ write mailfile "File Misc"
$endsubroutine
$!
$Shit_Can: subroutine
$ write mailfile "Delete"
$endsubroutine
$!
$!------------------------------------------------------------------------------
$!
$ set noon
$ form_feed[0,8]=12
$ open/read file mail.msgs
$ open/write mailfile filer.com
$ write mailfile "$set nover"
$ write mailfile "$set Noon"
$ write mailfile "$mail"
$ Write mailfile "select temp_mail"
$ msgnum = 0
$!
$ loop:
$!
$read/end=done file line
$if f$extract(0,1,line) .nes. form_feed then goto loop
$msgnum = msgnum + 1
$write sys$output "Message ''msgnum':"
$ write mailfile msgnum
$!
$ SPAN = 0
$ JEMS = 0
$ Risk = 0
$ tcpip = 0
$ local = 0
$ infovax = 0
$ security = 0
$!
$msg_loop:
$ read/end=too_early file line
$ line = line - "EXOS%" - """" - """" - "JPLLSI::" - "WITCH::" - "IAGO::"
$ line = f$edit(line,"UPCASE")
$ if f$extract(0,1,line) .eqs. form_feed then write sys$output ***Bad Format***"
$ if f$extract(0,1,line) .eqs. form_feed then goto loop
$ if f$locate("FROM:",line) .eq. f$length(line) then goto msg_loop
$ FLEN = F$LENGTH( LINE )
$!------------------------------------------------------------------------------
$!
$ If f$locate("NEUMANN",LINE).LT.FLEN THEN RISK = 1
$ If f$locate("RISK",LINE).LT.FLEN THEN RISK = 1
$!
$ If f$locate("INFO-VAX",LINE).LT.FLEN THEN INFOVAX = 1
$ If(f$locate("@KL.SRI.COM",LINE).LT.FLEN) -
     .AND.(.NOT. RISK) THEN INFOVAX = 1
$ If INFOVAX then RISK = 0
$!
$ If f$locate("SECURITY",LINE).LT.FLEN THEN SECURITY = 1
$ If f$locate("security",LINE).LT.FLEN THEN SECURITY = 1
$!
$ If f$locate("::",LINE) .LT. FLEN THEN SPAN = 1
$ If f$locate(".SPAN",LINE) .LT. FLEN THEN SPAN = 1
$ If f$locate(".span",LINE) .LT. FLEN THEN SPAN = 1
$!
$ If f$locate("tcp",LINE).LT.FLEN THEN TCPIP = 1
$ If f$locate("TCP",LINE).LT.FLEN THEN TCPIP = 1
$ If TCPIP then SPAN = 0
$!
$ If f$locate("JPLGP::",LINE).LT.FLEN THEN LOCAL = 1
$ If LOCAL then SPAN = 0
$!
$ If f$locate("jems",LINE).LT.FLEN THEN JEMS = 1
$ If f$locate("JEMS",LINE).LT.FLEN THEN JEMS = 1
$ if JEMS then SPAN = 0
$!
$ If Risk 	then call Risk_msg
$ If security 	then call security_msg
$ If infovax 	then call infovax_msg
$ if infovax then goto loop
$ If Jems 	then call Jems_msg
$ If Local 	then call local_msg
$ if span 	then call span_msg
$ If tcpip 	then call tcpip_msg
$ If span+infovax+Risk+tcpip+security+Local+Jems .eq. 0 then GOSUB CHECK_MORE
$!
$ goto loop
$!
$CHECK_MORE:
$ READ/End=Too_Early File Line
$ line = line - "EXOS%" - """" - """" - "JPLLSI::" - "WITCH::" - "IAGO::"
$ line = f$edit(line,"UPCASE")
$ FLEN = F$LENGTH( LINE )
$ if f$extract(0,1,line) .eqs. form_feed then write sys$output ***Bad Format***"
$ if f$extract(0,1,line) .eqs. form_feed then goto Loop
$ if f$locate("RECEIVED",line) .LT. FLEN then goto Not_Infovax
$ if f$locate("RETURN-PATH:",line) .eq. FLEN then goto Check_Unwanted
$ Iptr = F$Locate("INFO-VAX",Line) 
$ if Iptr .lt. FLEN Then Call Infovax_msg
$ if Iptr .eq. FLEN Then Call Other_Msg
$ Goto Msg_Done
$Not_Infovax:
$ Call Other_Msg
$ Goto Msg_Done
$!
$Check_Unwanted:
$ if f$locate("OS WAR",line) .EQ. FLEN Then Goto Check_more
$ Call Shit_Can
$Msg_Done:
$Return
$!
$too_early:
$ write sys$output "Premature EOF Encountered While Looking for FROM:"
$Done:
$ close file
$ write mailfile "Exit"
$ write mailfile "$Exit"
$ close mailfile
$ @filer.com
$ set prot=o:d mail.msgs;*
$ delete mail.msgs;*
$ delete filer.com;*
$exit

