Google
 

Trailing-Edge - PDP-10 Archives - T10_T20_MS_V10_SRCS_830128 - lgnms.mac
There is 1 other file named lgnms.mac in the archive. Click here to see a list.
;This software is furnished under a license and may only be used
;  or copied in accordance with the terms of such license.
;
;Copyright (C) 1980,1981,1982 by Digital Equipment Corporation
;		 	         Maynard, Massachusetts, USA


	TITLE	LGNMS -- Interface to new MS mail system
	SUBTTL	Bill Meier  9-Sep-80

	SEARCH	MACTEN,UUOSYM,LGNUNV
	LGNDCL
	SUBTTL	RNMAIL - Called by LOGIN to see if user has mail

RNMAIL::TLNE	F,FL.BAT	;Batch job?
	 POPJ	P,		;Yes--Larry says not to check mail
	PUSHJ	P,FNDSTR	;Find structure for MAIL.TXT
	 POPJ	P,		;Cant or errors
	MOVE	T2,T1		;Position in T2
	MOVX	T1,UU.PHS!.IOASC;ASCII/PHYSICAL mode
	MOVEI	T3,IBUF		;Buffers
	OPEN	UFD,T1		;Get a channel
	 POPJ	P,		;Egads!
	MOVE	T1,[SIXBIT/MAIL/];Get the mail file
	MOVSI	T2,'TXT'	; ..
	MOVEI	T3,0		; ..
	MOVE	T4,PP		; under his PPN
	LOOKUP	UFD,T1		;Read the file
	 JRST	MAIL.E		;Not there--no mail I guess
	PUSHJ	P,.SAVE4##	;Save P1,P2,N,C
	MOVEI	P2,1		;Start with message 1
	SETZM	NMSGS		;Clear message count
MAIL.L:	PUSHJ	P,MSGCHR	;Get a char
	 JRST	MAIL.T		;EOF
	JUMPE	C,MAIL.L	;Loop until we get one
MAIL.C:	CAIN	C,","		;Comma?
	 JRST	MAIL.N		;Yes--Scan character count
	PUSHJ	P,MSGCHR	;Get a char
	 JRST	LGNPEF		;EOF?
	JRST	MAIL.C		;And loop
MAIL.N:	PUSHJ	P,MSGDEC	;Read character count
	 JRST	LGNPEF		;EOF?
	MOVE	P1,N		;Save in safe place
	CAIE	C,";"		;Correct delimiter?
	 JRST	LGNIHL		;No--Stop scanning
	PUSHJ	P,MSGOCT	;Read octal bits
	 JRST	LGNPEF		;EOF?
	CAIE	C,.CHCRT	;CR?
	 JRST	LGNIHL		;No--Stop scanning
	PUSHJ	P,MSGCHR	;Get next char
	 JRST	LGNPEF		;EOF?
	CAIE	C,.CHLFD	;LF?
	 JRST	LGNIHL		;No--Stop scanning
	TRNN	N,1		;See if message seen
	 AOS	NMSGS		;No--Count messages
MAIL.S:	PUSHJ	P,MSGCHR	;Get a char
	 JRST	LGNPEF		;EOF?
	SOJG	P1,MAIL.S	;Loop until count runs out
	AOJA	P2,MAIL.L	;Count messages and loop
;Here if format error in mail file
LGNPEF:	WARN	PEF,<Premature EOF>
	CAI
	MOVEI	T1,[ASCIZ/ in MAIL.TXT reading message /]
	PUSHJ	P,.TSTRG##
	MOVE	T1,P2			;Get message number
	PUSHJ	P,.TDECW##		;Type it
	JRST	LGNCDE
LGNIHL:	WARN	IHL,<Illegal header line>
	CAI
	MOVEI	T1,[ASCIZ/ in MAIL.TXT reading message /]
	PUSHJ	P,.TSTRG##
	MOVE	T1,P2			;Get message number
	PUSHJ	P,.TDECW##		;Type it

LGNCDE:	WARN	CDE,<Can not determine existence of new mail>
	JRST	MAIL.E		;And exit


;Here to see if mail
MAIL.T:	SKIPE	P1,NMSGS	;Get count of messages
	 INFO	YHM,<You have >
	CAI
	MOVE	T1,P1
	PUSHJ	P,.TDECW##
	MOVEI	T1,[ASCIZ/ new message/]
	PUSHJ	P,.TSTRG##
	MOVEI	T1,"s"
	CAILE	P1,1
	 PUSHJ	P,.TCHAR##
	MOVEI	T1,[ASCIZ/; to receive /]
	PUSHJ	P,.TSTRG##
	MOVEI	T1,[ASCIZ/them/]
	CAIG	P1,1
	 MOVEI	T1,[ASCIZ/it/]
	PUSHJ	P,.TSTRG##
	MOVEI	T1,[ASCIZ/ type 'MS READ']
/]
	PUSHJ	P,.TSTRG##

MAIL.E:	RELEAS	UFD,		;Free channel
	POPJ	P,		;And return

	SUBTTL	FNDSTR - Read SYS:USERS.TXT and find structure

;Call:
;	PP/ users PPN
;	PUSHJ	P,FNDSTR
;	 <error>		;Format error or not in file
;	<normal>		;T1/ structure of mail file

FNDSTR:	PUSHJ	P,.SAVE4##	;Be safe
	MOVX	T1,UU.PHS!.IOASC;ASCII/PHYSICAL mode
	MOVSI	T2,'SYS'	;SYS:
	MOVEI	T3,IBUF		;Buffers
	OPEN	UFD,T1		;Get a channel
	 POPJ	P,		;Cant find out about mail today!
	MOVE	T1,[SIXBIT/USERS/]
	MOVSI	T2,'TXT'
	SETZB	T3,T4		;USERS.TXT file
	LOOKUP	UFD,T1		;Read that
	 JRST	FNDS.E		;Not today
FNDLOP:	PUSHJ	P,MSGCHR	;Get a char
	 POPJ	P,		;EOF
	CAIE	C,";"		;Comment?
	 CAIN	C,"!"		;..
	  JRST	FNDEAT		;Yes--skip line
	CAIE	C,.CHLFD	;<LF>
	 CAIN	C,.CHCRT	;<CR>
	  JRST	FNDEAT		;Yes--skip line
	PUSHJ	P,MSGSIC	;Read STR (char in C)
	 JRST	LGNPEU		;EOF
	MOVE	P1,N		;Save
	CAIE	C,":"		;Good delimiter?
	 JRST	LGNBFU		;No--bad
	PUSHJ	P,MSGCHR	;Get a char
	 JRST	LGNPEU		;EOF
	CAIE	C,"["		;PPN coming?
	 JRST	LGNBFU		;No--bad
	PUSHJ	P,MSGOCT	;Read programmer
	 JRST	LGNPEU		;EOF
	CAILE	N,377777	;In range?
	 JRST	LGNBFU		;No--Bad
	HRLZ	P2,N		;Save
	CAIE	C,","		;Terminate?
	 JRST	LGNBFU		;No--Bad
	PUSHJ	P,MSGOCT	;Read project
	 JRST	LGNPEU		;EOF
	CAILE	N,777777	;In range?
	 JRST	LGNBFU		;No--Bad
	HRR	P2,N		;Make PPN
	CAIE	C,"]"		;Terminate?
	 JRST	LGNBFU		;No--Bad
	CAMN	PP,P2		;Match users PPN?
	 JRST	[MOVE	T1,P1	;Yes--Return STR
		 JRST	.POPJ1]	;to caller
FNDEAT:	PUSHJ	P,MSGEOL	;Eat to EOL
	 POPJ	P,		;EOF!
	JRST	FNDLOP		;And loop

LGNPEU:	WARN	PEU,<Premature EOF when reading SYS:USERS.TXT>
	 JFCL
	JRST	LGNCDE		

LGNBFU:	WARN	BFU,<Bad format in SYS:USERS.TXT>
	 JFCL
	JRST	LGNCDE

FNDS.E:	RELEASE	UFD,
	POPJ	P,
	SUBTTL	Read atom routines

MSGDEC:	SKIPA	T1,[^D10]	;Get decimal radix
MSGOCT:	 MOVEI	T1,10		;Get octal radix
	MOVEI	N,0		;Clear number
MSGR.1:	PUSHJ	P,MSGCHR	;Get a char
	 POPJ	P,		;EOF?
	CAIL	C,"0"		;See if numeric
	 CAILE	C,"0"(T1)	;In correct radix
	  JRST	.POPJ1		;No--Stop now
	IMULI	N,(T1)		;Shift digits over
	ADDI	N,-"0"(C)	;Combine new digit
	JRST	MSGR.1		;And loop

MSGSIX:	PUSHJ	P,MSGCHR	;Get a char
	 POPJ	P,		;EOF
MSGSIC:	MOVEI	N,0		;Clear answer
	MOVE	T1,[POINT 6,N]	;Setup byte pointer
MSGS.1:	CAIL	C,"0"		;See if SIXBIT
	CAILE	C,"9"
	CAIL	C,"A"
	CAILE	C,"Z"
	 JRST	.POPJ1		;NO!
	SUBI	C," "-' '	;Make SIXBIT
	TLNE	T1,770000	;Word full?
	 IDPB	C,T1		;No--Store
	PUSHJ	P,MSGCHR	;Get next char
	 POPJ	P,		;EOF
	JRST	MSGS.1		;And loop

MSGEOL:	CAIN	C,.CHLFD	;LF?
	 JRST	.POPJ1		;Yes--Return
	PUSHJ	P,MSGCHR	;Get a char
	 POPJ	P,		;EOF
	JRST	MSGEOL		;And loop

MSGCHR:	SOSGE	IBUF+.BFCTR	;Decrement count
	 JRST	MSGC.1		;Get a new buffer
	ILDB	C,IBUF+.BFPTR	;Get the char
	JUMPE	C,MSGCHR	;Ignore nulls
	CAIL	C,"a"		;See if lower case
	 CAILE	C,"z"		;..
	  CAIA			;No
	   SUBI	C,"a"-"A"	;Yes--Convert
	JRST	.POPJ1		;And skip return
MSGC.1:	IN	UFD,		;Read buffer
	 JRST	MSGCHR		;Continue
	POPJ	P,		;EOF or error
	SUBTTL	Storage

	XLIST
	LIT
	LIST
	RELOC	0

NMSGS:	BLOCK	1		;Number of unread messages
IBUF:	BLOCK	3		;Input buffers

	END