From:	CRDGW2::CRDGW2::MRGATE::"SMTP::FALCON::TNIELAND" 18-MAY-1989 11:58
To:	MRGATE::"ARISIA::EVERHART"
Subj:	MAIL Reader/Filter Part 2

Message-Id:  <8905181444.AA10128@crdgw1.ge.com>
Received: from FALCON by AAMRL.AF.MIL; Thu, 18 May 89 10:43 EDT
Date: Thu, 18 May 89 10:03 EST
From: Ted Nieland - SRL <@AAMRL.AF.MIL:TNIELAND@FALCON>
Subject: MAIL Reader/Filter Part 2
To: everhart@arisia.decnet
X-Vms-To: IN%"everhart%arisia.decnet@crdgw1.ge.com"

From:	IN%"TENCATI@dsfvax.JPL.NASA.GOV" 16-MAY-1989 23:27:27.55
To:	TNIELAND@FALCON
CC:	
Subj:	VMS MAIL Reader/Filter Part 2 of 2 - READMAIL.COM

Return-path: RELAY-INFO-VAX <@GIZMO.SRI.COM:RELAY-INFO-VAX@CRVAX.SRI.COM>
Received: from EAGLE by FALCON; Tue, 16 May 89 23:27 EST
Received: from GIZMO.SRI.COM by AAMRL.AF.MIL; Tue, 16 May 89 23:24 EDT
Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 16 MAY 89 17:55:08 PDT
Received: from dsfvax.JPL.NASA.GOV by KL.SRI.COM with TCP; Tue, 16 May 89
 17:53:01 PDT
Received: by dsfvax id <0000212E033@dsfvax.JPL.NASA.GOV> ; Tue, 16 May 89
 17:22:19 PDT
Date: Tue, 16 May 89 17:21:49 PDT
From: TENCATI@dsfvax.JPL.NASA.GOV
Subject: VMS MAIL Reader/Filter Part 2 of 2 - READMAIL.COM
To: info-vax@kl.sri.COM
X-VMS-To: info-vax@kl.sri.COM
Resent-date: Tue, 16 May 89 23:25 EDT
Resent-to: TNIELAND@FALCON
X-VMS-Mail-To: EXOS%"info-vax@kl.sri.com",TENCATI
Message-ID: <890516172149.0000212E033@dsfvax.JPL.NASA.GOV>

$!
$Local_Msg: subroutine
$ write mailfile "File Local"
$ write sys$output "File Local"
$endsubroutine
$!
$JEMS_Msg: subroutine
$ write mailfile "File Jems"
$ write sys$output "File Jems"
$endsubroutine
$!
$InfoVax_msg: subroutine
$ write mailfile "File Infovax"
$ write sys$output "File Infovax"
$endsubroutine
$!
$SPAN_msg: subroutine
$ write mailfile "File SPAN"
$ write sys$output "File SPAN"
$endsubroutine
$!
$Security_msg: subroutine
$ write mailfile "File Security"
$ write sys$output "File Security"
$endsubroutine
$!
$tcpip_msg: subroutine
$ write mailfile "File tcpip"
$ write sys$output "File tcpip"
$endsubroutine
$!
$Risk_msg: subroutine
$ write mailfile "File Risk"
$ write sys$output "File Risk"
$endsubroutine
$!
$other_msg: subroutine
$ write mailfile "File Misc"
$ write sys$output "File Misc"
$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


