Google
 

Trailing-Edge - PDP-10 Archives - bb-jr93h-bb - 7,6/ap020/mscnfg.x20
There are 4 other files named mscnfg.x20 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) 1979,1980,1981,1982 by Digital Equipment Corporation
;	       1983,1984,1985,1986    Maynard, Massachusetts, USA


	TITLE MSCNFG - MS initialization and feature test configuration

	SEARCH GLXMAC,MSUNV,MACSYM
TOPS10<	SEARCH ACTSYM >
	PROLOG (MSCNFG)

	CPYRYT
	MSINIT

	.DIRECTIVE FLBLST
	SALL

;Feature test flags

IFNDEF FTNAMS,<FTNAMS==0>	;FTNAMS - TOPS20 NAME SERVER


;Direct LINK to load the proper modules

	.REQUIRE MSMCMD
	.REQUIRE MSDSPL
	.REQUIRE MSTXT
	.REQUIRE MSUTL
	.REQUIRE MSHOST
	.REQUIRE MSDLVR
	.REQUIRE MSLCL
	.REQUIRE MSNET
	.REQUIRE MSSEQ
	.REQUIRE MSFIL
	.REQUIRE MSGUSR
	.REQUIRE MSUUO
	.REQUIRE MSVER
   IFN FTNAMS,<.REQUIRE MSNSRV>	;LOAD NAME SERVER INTERFACE
	.REQUIRE MS		;SHOULD BE LAST MODULE


;Define dummy symbols for unsupported code handled under conditonals

   IFE FTNAMS,<
DIRLKP::RET >

;External Globals

	EXTERNAL ALCSB,PERSON,RELSB
	EXTERNAL ALCFOB,MOVST0,MOVSTR,CRIF,SREGV1,SRGRV1,XCLENQ,.STEX0,.TAKE0
	EXTERNAL AUTEXP,CHECK0,CHECKS,CKEXIT,CKXIT0,CMDINI,CMDLUP,CRFPRT
TOPS20<	EXTERNAL EDFORK,EXECFK,CHNTAB>
	EXTERNAL FLAGS2,HDITAB,HSTINI,IB,INIP,INIPDL
TOPS20<	EXTERNAL INTP,INTPDL>
	EXTERNAL INIRET,KBFTOR,KWDTBL
	EXTERNAL LIBVER,LINEW,MINWSZ,MSGSSQ,MYDIR
	EXTERNAL MYDIRS,NAMINI,OKTINT,PDL,PIDBLK,PIDMS,RELFOB
	EXTERNAL RFIELD,SAVMOD,SBTMV1,SCRBTM,SCRLFL,SCRREG,SCRRGR
	EXTERNAL SHRAGN,TAKPDL,TAKPTR,TXTFPG
	EXTERNAL TXTTOT,UUOH,V52FLG,ZEREND,ZERMEM
TOPS20<	EXTERNAL GETTYM,MSGJFN,MYSTR,STRBUF >
TOPS10<	EXTERNAL INTBLK,INTF,MYPPN,SAVPSZ,SENBLK,TTYUDX
	EXTERNAL USRTAB,..NZHO,..NZLO,..NZT,CRFFDH,LOKAPP >

;Internal globals

	INTERNAL TTINI, CTCLOK, CTCOK, ININAM
TOPS20< INTERNAL .LOGOU, TMRINT, CTLCIN >
	INTERNAL RJ.FLG, RJ.AMA, RJ.VMA, RJ.MMA, RJ.LMA

;RJ.FLG yields bits that are ON if a certain type of mail is DISALLOWED
;These end up in NETFLG
	RJ.VMA==1B35		;NO VMAIL/DMAIL
	RJ.AMA==1B34		;NO ARPA MAIL
	RJ.MMA==1B33		;NO MX MAIL (NO SUPPORT FOR THIS, RESERVED)
	RJ.LMA==1B32		;NO LOCAL MAIL (NO SUPPORT FOR THIS, RESERVED)
;1B0-1B11 - reserved for customers, all others reserved for DEC

IFNDEF RJ.FLG,<RJ.FLG==RJ.VMA!RJ.AMA>	 ;NO V/D MAILER, NO ARPA MAIL

;Initial values for KWDTBL - TBLUK-style table holding pointers to
; aliases and address lists

KWDTB0:	KWDT0N,,KWDT0N
	CMD1 S,SYSCOD,CM%NOR!CM%INV	; Force complete spelling of SYSTEM
	CMD1 SY,SYSCOD,CM%NOR!CM%INV
	CMD1 SYS,SYSCOD,CM%NOR!CM%INV
	CMD1 SYST,SYSCOD,CM%NOR!CM%INV
	CMD1 SYSTE,SYSCOD,CM%NOR!CM%INV
	CMD SYSTEM,SYSCOD
KWDT0N==.-KWDTB0-1


SUBTTL MS initialization

MSINI::	SETZM TXTTOT		; Clear the send buffer character count
	SETZM TXTFPG		; Clear pointer to list of text pages.
	SETZM FLAGS2		; Clear 2nd flags word
TOPS20<
	MOVE A,[SIXBIT /MS/]
	MOVE B,[SIXBIT /MS/]
	SETSN			; Cause monitor to keep statistics on use
	 JFCL
	SETOM EDFORK		; No editor fork yet
	SETOM EXECFK		;  or EXEC fork
	SETZM PIDMS		; [JCR] No PID yet
>;End TOPS20
;**;[3098] Add 4 lines at MSINI:+12L	MDR	18-NOV-87
TOPS10<				;[3098]
	MOVE A,[..NZHO,,..NZLO]	;[3098] Init nonzero low seg storage
	BLT A,..NZLO+..NZT-1	;[3098]  ..
>				;[3098] End TOPS10
	MOVEI A,IB.SZ		; Size of init block
	MOVEI B,IB		; Addr of same
	$CALL I%INIT
	JUMPF [FATAL (Can't initialize GLXLIB)]
TOPS10<	MOVE S1,[GLXVRS] >	; Get GLXLIB version number
	MOVEM S1,LIBVER		; Save GLXLIB Version number
	MOVE A,PIDBLK+PB.PID	; [JCR]Get our PID
	MOVEM A,PIDMS		; [JCR]SAVE FOR MSLCL
	MOVE A,[ZERMEM,,ZERMEM+1]
	SETZM ZERMEM
	BLT A,ZEREND		; Clear out data-base
TOPS10<
	MOVEI A,FDXSIZ		;Set up dummy FD
	HRLZM A,CRFFDH		; for default directory typeout
;**;[3098] Remove 2 lines at MSINI:+26L		MDR	18-NOV-87
	SETOM LOKAPP		;Nobody has the append interlock yet.
>;End TOPS10
	MOVE A,[CALL UUOH]	; Setup uuo handler call
	MOVEM A,.JB41##
	CALL HSTINI		; Clear the HOST table
	SETZM HDITAB		; Empty header-item table
	MOVEI A,KWDT0N+1+IFE KWDT0N,<1> ; Allocate a block for KWDTBL
	$CALL M%GMEM		;  ..
	MOVEM B,KWDTBL		;  ..
	MOVEI A,KWDT0N(B)	; Compute last address to fill
	HRLI B,KWDTB0		; Address of initial entries list
	BLT B,(A)		; Init the table
IFE KWDT0N,<
	AOS @KWDTBL		; Correct for zero-length table
>
	MOVEI A,[RET]		; Dummy routine
	MOVEM A,SCRREG		;  for non-video terminals
	MOVEM A,SCRRGR		;  ..
	MOVEM A,SCRBTM		;  ..
	SETZM MINWSZ		; Default to no fancy scrolling stuff
	SETZ A,			; Assume expert mode for default
	CALL .STEX0		; Set up COMND table pointers (default expert)
	MOVE T,[IOWD TAKPTN,TAKPDL]
	MOVEM T,TAKPTR		; Init take IFN stack pointer
	MOVEI A,.PRIIN		; Start getting cmds from primary input
	PUSH T,A		; Shove it on the stack
	MOVEM T,TAKPTR		;  ..
	CALL INIT		; Init interrupts and O.S.-specific stuff
	CALL TTINI		; Init terminal parameters
	SETOM	MSGSSQ		; Make sure "verb SAME" is OK
	CALL CMDINI		; Init command parser
	MOVEI A,2		; Default for auto-expunge is exit-command-only
	MOVEM A,AUTEXP		; Setup magic number
	TXNE F,F%AMOD		; Auto MOD hack?
	CITYPE <[Checking for new system messages...]
>
	CALL NAMINI		; Get info about possible networks
	CALL INITF		; Parse init file
	RET


SUBTTL INIT - init operating-system-dependent stuff

   TOPS20<
INIT:	MOVEI A,.FHSLF		; Setup interrupt stuff
	RPCAP
	TRZ B,-1		; Only enable LH caps
	IOR C,B
	EPCAP			; ...
	TXNE F,F%AMOD		; Unless doing auto MOD hack,
	JRST INIT0		;  in which case skip it for speed,
	CALL INTINI		;  init interrupt system
	MOVEI A,.FHSLF		; [ESM] Get capabilities
	RPCAP%
	TXNN B,SC%CTC		; Can we trap ^C?
	 JRST INIT0		; no, forget it then
	TXON C,SC%CTC
	EPCAP%			; let's do it
	MOVE A,[1,,CTLCIN]
	MOVEM A,CHNTAB+CTCCHN	; Set up processing address
	MOVEI A,.FHSLF
	MOVX B,1B<CTCCHN>
	AIC%			; Enable channel 0
	MOVSI A,.TICCC
	ATI%			; Assign ^C
INIT0:	GJINF
	DMOVEM A,MYDIR		; Save directory
	MOVE B,A
	HRROI A,MYDIRS		; Temp name for speed
	DIRST
	 JFCL
	SKIPE MYSTR		; Have a str: name yet?
	 JRST HAVSTR		; Yes, no need to run through here.
	MOVE A,[POINT 7,STRBUF]	; Temp string buffer
	MOVEI B,[ASCIZ /POBOX:</]
	CALL MOVSTR
	MOVEI B,MYDIRS		; Login directory string
	CALL MOVSTR
	MOVEI B,[ASCIZ />MAIL.TXT.1/]
	CALL MOVST0
;**;[3073] Change 1 line at INIT0:+14L	MDR	12-AUG-86
	MOVX A,<GJ%OLD!GJ%SHT!GJ%DEL!GJ%PHY> ;[3073]
	HRROI B,STRBUF
	GTJFN
	 ERJMP HAVSTR		; Should not happen
	MOVEM A,MSGJFN		; Save the jfn away
	HRROI A,MYSTR		; We need to save the structure
	MOVE B,MSGJFN		; Get JFN back for MAIL.TXT
	MOVX C,<FLD(.JSAOF,JS%DEV)+JS%PAF> ; We just want STR:
	JFNS%			; Put STR: in appropriate place
	 ERJMP .+1		; Don't care about errors
	SETZM MSGJFN		; We don't want this right now
	SETO A,			; Get rid of JFN
	RLJFN%
	 ERJMP .+1
HAVSTR:	MOVX A,.PRIOU		; Get line width of terminal
	MOVX B,.MORLW
	MTOPR
	MOVEM C,LINEW
	RET


INTINI:	MOVX A,.FHSLF
	EIR
	MOVX B,1B<TMRCHN>!1B<.ICILI> ; Timer and ill inst channels
	AIC
	CALLRET SETTIM		; Set up timer interrupt

   >;End TOPS20
TOPS10<
INIT:  	STKVAR <TEMP,<ARGBLK,10>,<QUERSP,.AEMAX>> ; Consume most of the stack
	SETZM USRTAB		; Zero the user cache table
	MOVE A,[-1,,.GTPPN]	; Get PPN
	GETTAB A,		;  ..
	 FATAL (Can't discover my PPN)
	MOVEM A,MYPPN		; Save it

	MOVE A,[3,,XPNCTC]	; Point to ctrl-C routine
	MOVX B,ER.ICC		; Bit to specify ctrl-C
	DMOVEM A,INTBLK		; Set it up
	SETZM INTBLK+2		; Clear new PC
	SETOM INTF		; Flag that interrupts are OK
	MOVEI A,INTBLK		; Turn on the interrupt
	MOVEM A,.JBINT		;  ..

	$CALL F%FCHN		; Eat channel zero so MSGJFN nonzero
	JUMPF R			;  means that a message file exists
	JUMPN A,R		; Nonzero channel returened?  All done then...
	OPEN [	EXP .IODMP		; Eat a disk DDB
		SIXBIT /DSK/
		EXP 0]
	 JFCL			; Who cares?
;
;	Here a QUEUE. finds out, via ACCTDAE, who we are
;
	MOVEI	C,<-1>+ARGBLK	; Point at the argument block storage
	PUSH	C,[QF.RSP!.QUMAE] ; Say we want to talk to actdae
	PUSH	C,[-1]		; Set the node to central
	MOVEI	B,QUERSP	; Point at the response storage
	HRLI	B,.AEMAX	; Get the number of words we can play with here
	PUSH	C,B		; Put len,,loc in the arg block
	PUSH	C,[QA.IMM!<1,,.QBAFN>] ; Get the subfunction argument type
	PUSH	C,[EXP UGOUP$]	; Say we want the user profile
	PUSH	C,[1,,.UGPPN]	; Store the ppn descriptor
	MOVEI	B,MYPPN		; Point to the ppn
	MOVEM	B,MYDIR		; Save for later use by GETUSR while we're at it
	PUSH	C,B		; And store that
	ANDI	C,-1		; Get rid of junk in the left half
	SUBI	C,ARGBLK	; Compute the number of words we filled in
	MOVEI	A,ARGBLK	; Point at the argument block
	HRL	A,C		; Copy the block length
	QUEUE.	A,		; Ask for the users profile
	  JRST [MOVE 	A,[ASCIZ/Anon/] ; We have to call him something
		MOVEM	A,MYDIRS ; We'll make him anonymous
		POPJ	P,]	; With that done skip the 8-7bit translation
	MOVEI	A,.AENAM+QUERSP ; Get the returned username
	HRLI	A,(POINT 8)	; Make it a byte pointer
	MOVEI	B,^D40		; MYDIRS (destination) byte count
	MOVE	C,[POINT 7,MYDIRS] ; Point to where the user name goes
	CALL	TRANS		; Translate 8-bit to 7-bit
	HRRZ 	B,.AEPNM+QUERSP	; Get the pointer to the personal name
	JUMPE	B,NOPNAM	; Zero indicates no personal name
	MOVEI	D,QUERSP	; We have a personal name, get its address
	ADD	D,B		; ..
	MOVEI	A,^D39
	CALL	ALCSB		; Get a chunk
	 JRST	NOPNAM		; Propagate failure
	MOVEM	B,TEMP		; Save string address
	MOVE	C,B		; Copy address of string space
	HRLI	C,(POINT 7,)	; Form byte pointer
	MOVE	A,[POINT 8,(D)]	; Make a byte pointer to ther personal name
	MOVEI	B,^D40		; ASCIZ # of chars in final personal name
	CALL	TRANS		; With the null
	MOVE	A,TEMP		; Return string address to caller
	EXCH	A,PERSON	; Stuff address of new string
	CAIE	A,0		; Was anything there before?
	CALL	RELSB		; Yes, return through deallocation routine

NOPNAM:	MOVE	B,MYPPN		; See if [1,2]
	CAMN	B,[1,,2]	; which is possible source of confusion
	WARN	(Your messages will be considered to be from Operator)
	POPJ	P,

;
;	Setup for translation from 8-bit to 7-bit.  CHTRN. block look like:
;
;	CH.FBR,,source count
;	source byte pointer
;	0
;	destination count
;	destination byte pointer
;	0
;
TRANS:	MOVEM	A,1+ARGBLK	; Source byte pointer
	SETZM	2+ARGBLK	; 0
	MOVEM	B,3+ARGBLK	; Destination count
	MOVEM	C,4+ARGBLK	; Destination byte pointer
	SETZM	5+ARGBLK	; 0
	MOVEI	B,1		; Count the nul
GETLEN:	ILDB	C,A		; Get the next character
	CAIE	C,0		; Is it a nul?
	 AOJA	B,GETLEN	; Nope count it and loop
	TXO	B,CH.FBR	; Declare 8-bit to 7-bit translation
	MOVEM	B,0+ARGBLK	; CH.FBR,,source count in first word
	MOVEI	A,ARGBLK	; Point to the argument block
	CHTRN.	A,		; Translate the username into ASCIZ
	  JFCL			; Don't panic
	RET

>;End TOPS10
;TTINI - Init terminal parameters, called at startup and by
; SET VIDEO-MODE command

   TOPS20<
TTINI:	MOVEI A,.CTTRM
	GTTYP
	SETZ C,
	CAIN B,.TTV52		; VT52?
	 HRROI C,[BYTE (7)33,"H",33,"J",0]
	CAIE B,.TT125		; VT125?
	CAIN B,.TT102		; or VT102?
	 MOVEI B,.TT100		; is the same as a generic 100
	CAIE B,.TT131		; VT131?
	CAIN B,.TT200		; VT200-style?
	 MOVEI B,.TT100		; these too are just like a vt100 to us
	CAIN B,.TT100
	 JRST [	HRROI C,[BYTE (7)33,"[","H",33,"[","J",0]
		MOVEI A,SREGV1		; Init ptrs to terminal-dependent rtns
		MOVEM A,SCRREG
		MOVEI A,SRGRV1
		MOVEM A,SCRRGR
		MOVEI A,SBTMV1
		MOVEM A,SCRBTM
		JRST .+1]
	CAIN B,.TTV05		; VT05
	 HRROI C,[BYTE (7)35,177,177,177,177,37,177,177,177,177,0]
	MOVEM C,V52FLG		; Remember string
	MOVEI D,SAVMOD
	CALL GETTYM		; Get current tty modes
	TDZ C,[3B9!3B19]	; Dont echo esc or ctrl-V
	SFCOC
	MOVEM C,2(D)
	RET
   >;End TOPS20
;TTINI - TOPS10 version

   TOPS10<
TTINI:	MOVNI C,1		; Get UDX of controlling TTY
	TRMNO. C,		;  ..
	 FATAL (Can't get UDX for controlling TTY)
	MOVEM C,TTYUDX		; Save for later
	MOVE A,[2,,B]		; Get page size
	MOVX B,.TOSSZ		; (actually the page stop length)  ..
	TRMOP. A,
	 FATAL <Can't get terminal's page size>
	MOVEM A,SAVPSZ		; Save for later
	MOVE A,[2,,B]		; Arg block for TRMOP. in B and C
	MOVX B,.TOWID		; Get line width of terminal
	TRMOP. A,		;  ..
	 FATAL (Can't get terminal's line width)
	MOVEM A,LINEW		; Save it
	MOVE A,[2,,B]		; Arg block again
	MOVX B,.TOTRM		; Get TTY type
	TRMOP. A,		; Get type
	 JFCL
	SETZ B,			; Assume not fancy terminal
	CAME A,[SIXBIT /VT61/]
	CAMN A,[SIXBIT /VT52/]
	 MOVE B,[POINT 7,[BYTE (7)33,"H",33,"J",0]]
	CAMN A,[SIXBIT /VT05/]
	 MOVE B,[POINT 7,[BYTE (7)35,177,177,177,177,37,177,177,177,177,0]]
	HLLZ A,A		; Assume VTnxx means VT100-compatible
	CAME A,[SIXBIT /VT2/]	; VT100 or VT200 series?
	 CAMN A,[SIXBIT /VT1/]	; Get appropriate clear-screen sequence
          JRST [MOVE B,[POINT 7,[BYTE (7)33,"[","H",33,"[","J",0]]
		MOVEI C,SREGV1		; Init ptrs to terminal-dependent rtns
		MOVEM C,SCRREG
		MOVEI C,SRGRV1
		MOVEM C,SCRRGR
		MOVEI C,SBTMV1
		MOVEM C,SCRBTM
		JRST .+1]
	MOVEM B,V52FLG		; Save for BLANK command
	RET
   >;End TOPS10
SUBTTL Interrupt routines

;Illegal instruction trap

   TOPS20<

ILITRP:	CIS
	JCERR <Illegal instruction trap>

;^C interrupt

TRPCTC:	$BGINT (1)
	CALL K%FLSH		; Let's not have ^C followed by garbage!
	TMSG <^C
>
	CALL @SCRRGR		; Remove scroll region, if any,
	CALL @SCRBTM		;  and go to bottom of screen
	SETZM SCRLFL
	HALTF%			; Let user out
	CALL TTINI		; See if the wise guy changed termtypes on us
	$DEBRK			; Dismiss

;Here on any and every ^C. It will then pass control over to whoever
;should handle the interrupt.
CTLCIN:	TXNE F,F%XPIP		; Are we doing an expunge?
	 JRST XPNCTC		;  Yes, handle interrupt there
	TXNN F,F%LOGO		; Is Logout-on-exit set?
	 JRST TRPCTC		;  No, handle ^C appropriately
	$BGINT (1)		; Logout-on-exit set, don't let user out.
	WARN <Control-C intercepted, type "EXIT" to logout>
	$DEBRK

; Timer interrupt


TMRINT:	$BGINT (3)		; Level 2
	MOVEM P,INTP		; Save pointer to excessively tiny stack
	MOVE P,[IOWD NPDL,INTPDL] ; Get pointer to more reasonable stack
	SKIPE OKTINT		; OK for timer at this time?
	 CALL TMRIN1		; Yes, check for new messages
TMRIN2:	CALL SETTIM		; Set next timer up
	MOVE P,INTP		; Restore stunted GLXLIB stack
	$DEBRK			; Dismiss the interrupt

TMRIN1:	CALL CHECK0		; Check for new guys
	 RET			; None, return now
	CALLRET CHECKS		; Print message on new guys and return

SETTIM:	MOVE A,[.FHSLF,,.TIMEL]	; Elapsed time
	MOVX B,^D5*^D60*^D1000	; 5 mins
	MOVEI C,5		; Chan 5
	TIMER
	 JFCL
	RET

   >;End TOPS20

SUBTTL Logout-on-exit and control-C routines

   TOPS20<
.LOGOU:	CONFRM
	TXOE F,F%LOGO		; Remember logout on exit
	JRST [	WARN <Logout-on-exit already enabled>
		RET]
	TXZ F,F%RSCN		; Don't exit if exec command
	WARN <Will logout on exit>
	RET
   >;End TOPS20

;Prevent control-C while expunging deleted messages

CTCLOK:	CALL XCLENQ		; Make ENQ exclusive
	 RET			; Can't, must be other readers
	TXO F,F%XPIP		; Flag expunge in progress
   TOPS20<
	MOVX A,.FHSLF
	MOVX B,1B<TMRCHN>	; Deactivate timer interrupts
	DIC
   >;End TOPS20
	RETSKP			; Done

;Here if ^C while expunge in progress

XPNCTC:
   TOPS20<
	$BGINT (1)
	TXON F,F%CTLC		; Remember ^C typed
	WARN <File update in progress - please wait>
	$DEBRK
   >;End TOPS20
   TOPS10<
	PUSH P,INTBLK+2		; Save return address
	AOSE INTF		; Interrupt already in progress?
	RET			; Yes, dismiss without reenabling
	SETOM INTF		; Flag that interrupts are OK now
	SETZM INTBLK+2		;  ..
	TXNN F,F%XPIP		; Expunge in progress?
	JRST [	$TEXT (KBFTOR,<^^C>)
		$CALL K%FLSH	; Make sure the ^C is seen
		PJRST CKXIT0 ]	; and exit gracefully (cleaning screen)
	TXON F,F%CTLC		; ctrl-C already typed?
	WARN <File update in progress - please wait>
	RET
   >;End TOPS10

;Here when expunge done

CTCOK:	TXZ F,F%XPIP		; Clear expunge in progress flag
	CALL SHRAGN		; Make ENQ shared again
	TXZE F,F%CTLC		; ^C typed while locked?
	CALLRET CKEXIT		; Yes, logout or exit as appropriate
   TOPS20<
	MOVX A,.FHSLF		; Reactivate timer interrupts
	MOVX B,1B<TMRCHN>
	AIC
   >;End TOPS20
	RET			; and return

;ININAM - Build FD for private MS.INIT (MS.INI on TOPS10)
;SYSNAM - Build FD for system MS.INIT
;Returns +1: Insufficient memory
;	 +2: OK, A/ size of FOB, B/ address of FOB

SYSNAM:	TXZA F,F%F1		; Remember SYSNAM entry
ININAM:	TXO F,F%F1		; Remember ININAM entry
	MOVEI A,FDXSIZ		; Allocate max FD size
	$CALL M%GMEM		;  ..
	JUMPF [	WARN (Can't process init file -- no memory)
		RET]
	MOVE D,B		; Place chunk addr in safe reg
	MOVEI A,FDXSIZ		; Put length into FD
	HRLZM A,.FDLEN(D)	;  ..
   TOPS20<
	MOVEI A,.FDSTG(B)	; Where to build string
	HRLI A,(POINT 7,)
;**;[2699] Change 1 line at ININAM:+11	MDR	20-MAY-86
	TXNN F,F%F1		;[2699] Private or system? (don't clear the bit)
	JRST [	MOVEI B,[ASCIZ /SYSTEM:/]
		CALL MOVSTR		; System
		JRST ININM0]
	MOVEI B,[ASCIZ /POBOX:</]
	CALL MOVSTR
	MOVEI B,MYDIRS		; My login directory
	CALL MOVSTR
	MOVEI B,">"
	IDPB B,A
ININM0:	MOVEI B,[ASCIZ /MS.INIT/]
	CALL MOVST0
   >
   TOPS10<
	DMOVE A,[SIXBIT /DSK/	; Device
		 SIXBIT /MS/]	; Name
	TXZN F,F%F1		; Private or system?
	MOVE A,[SIXBIT /STD/]	; System
	DMOVEM A,.FDSTR(D)
	MOVE A,[SIXBIT /INI/]	; Extension
	MOVEM A,.FDEXT(D)
	MOVE A,MYPPN		; Get logged-in PPN
	MOVEM A,.FDPPN(D)	; Stuff it
   >
	MOVEI A,FDXSIZ		; Size of FD
	HRLZM A,.FDLEN(D)
	MOVE A,D		; Allocate and link FOB
	CALL ALCFOB		;  ..
	 JRST [	WARN (Can't process init file -- insufficient memory)
		RET]
	RETSKP			; Win -- skip return
SUBTTL INITF - Parse init files (SYSTEM: and private)

; Process the SYSTEM:MS.INIT file first before processing
; POBOX:MS.INIT by reinstalling edit 2609 as edit 2697 - MDR

INITF:	CALL SYSNAM		; Build FD for system init file
	 JRST INITF1		; Error message already printed
	CALL INITX		; Go process init file
	 JFCL			; Don't care if it isn't there
INITF1:	CALL ININAM		; Build filespec for private init file
	 RET			; Error msg already printed
	CALL INITX		; Go process the file
	 JFCL			; Don't care if not there
	RET

;INITX - Attempt to open, and process an init file.
;Call:
;	A/ FOB size
;	B/ FOB address
;
;Return	+1: failure (file not found)
;	+2: success

INITX:	MOVE T,TAKPTR		; Init IFN stack pointer
	HLRE C,T		; First check room on the stack
	MOVN C,C		; Get size of area left
	CAIGE C,3		; Need three words
	JRST [MOVE C,FOB.FD(B)	; No room, point to FD for error msg
	      CALL CRIF		; Get to left margin
	      $TEXT (KBFTOR,<?Command files nested too deeply, detected in opening ^F/(C)/>)
	      CALLRET RELFOB]	; Release FOB and give failure return
	PUSH T,A		; Push FOB pointer and size onto IFN stack
	PUSH T,B		;  ..
	$CALL F%IOPN		; Open for read
	JUMPF [	POP T,B			; Recover FOB info
		POP T,A			;  ..
		CALL RELFOB		; Release chunks
		RET]			; Return
	CALL .TAKE0		; Set up COMND to take from file
	MOVEM P,INIP		; Save state of the world
	MOVEI A,PDL		; Compute how many words on PDL currently used
	HRRZ B,P		;  so we know how much to save
	SUBI B,(A)		;  ..
	MOVE A,[PDL,,INIPDL]	; Save entire stack context
	BLT A,INIPDL(B)
	MOVEI A,INITX0		; Where to go on EOF of init file
	MOVEM A,INIRET		;  ..
	JRST CMDLUP		; Go parse init file
INITX0:	MOVE P,INIP		; Restore state of world
	MOVE A,[INIPDL,,PDL]
	BLT A,(P)
	SETZM INIP		; Flag init file no longer in progress
	SETZM INIRET		;  ..
	$CALL K%FLSH		; Flush TTY buffers
	RETSKP			; Return

	END

; *** Edit 2471 to MSCNFG.MAC by PRATT on 14-Nov-85
; Changes to break up MS into a smaller module.
; *** Edit 2474 to MSCNFG.MAC by PRATT on 18-Nov-85
; Changes for TOPS10 to make MS.MAC smaller
; *** Edit 2484 to MSCNFG.MAC by SANTEE on 21-Nov-85
; Clean up the various edit histories.
; *** Edit 2485 to MSCNFG.MAC by MAYO on 21-Nov-85
;
; *** Edit 2486 to MSCNFG.MAC by PRATT on 22-Nov-85
; Copyright statements
; *** Edit 2489 to MSCNFG.MAC by PRATT on 26-Nov-85
; Take SYSTEM:MS.INIT before private MS.INIT (or .INI files on the -10)
; *** Edit 2607 to MSCNFG.MAC by SANTEE on 10-Dec-85
; Make MS/MX get along well together. Have MS write dashes at the end of
; messages. While we're there remove some of the NETMAI code.
; *** Edit 2609 to MSCNFG.MAC by PRATT on 11-Dec-85
; Put .INIT file stuff back the way it was. Don't need it anymore and TOPS-10
; people don't want it.
; *** Edit 2622 to MSCNFG.MAC by PRATT on 23-Dec-85
; Fix "MOVE or DELETE" length invalid error, SET DEF DIR, SET DEF PROT (-10)
; *** Edit 2650 to MSCNFG.MAC by SANTEE on 1-Feb-86
; Eliminate calls to set up the username data base from USERS.TXT. This is has
; been replaced by SM's calls to the accounting system. -10 only.
; *** Edit 2651 to MSCNFG.MAC by SANTEE on 2-Feb-86
; Eliminate the need for MSUTAB at all. Move the few useful lines elsewhere.
; *** Edit 2652 to MSCNFG.MAC by SANTEE on 2-Feb-86
; The last edit hit one too many words. Fix it.
; *** Edit 2664 to MSCNFG.MAC by APPELLOF on 3-Mar-86
; Get GLXLIB version number properly for TOPS-10
; *** Edit 2668 to MSCNFG.MAC by SANTEE on 3-Mar-86
; When we decided to get the users name from the accounting system we broke our
; warning message to the operator. Fix it up.
; *** Edit 2677 to MSCNFG.MAC by SANTEE on 7-Mar-86
; Take GLXVER out of the EXTERNAL statement.
; *** Edit 2689 to MSCNFG.MAC by APPELLOF on 26-Mar-86
; Prevent ERF (Error Reading File) on TOPS-10 if MX is appending when we check
; the size of the mail file. Also cut down on the number of LOOKUPs we do.
; *** Edit 2690 to MSCNFG.MAC by APPELLOF on 31-Mar-86
; Make TOPS-10 preserve TTY STOP, etc. when exiting text-scroll mode.
; *** Edit 2697 to MSCNFG.MAC by RASPUZZI on 30-Apr-86
; Reinstate edit 2609 - Take SYSTEM:MS.INIT before private MS.INIT
; *** Edit 2699 to MSCNFG.MAC by RASPUZZI on 20-May-86
; More of edit 2697 - make MS smart enough to search system wide logical name
; of SYSTEM: when taking SYSTEM:MS.INIT
; *** Edit 2717 to MSCNFG.MAC by PRATT on 6-Jun-86
; Make sure Arpa mail delivery is off by default

; *** Edit 2718 to MSCNFG.MAC by SANTEE on 10-Jun-86
; Get the personal name from the accounting system on TOPS-10. Also, while I
; was there clean up ^C (print it out at the right time and clear the scrolling
; region if set up) and make the listing just a little bit prettier. 
; *** Edit 2719 to MSCNFG.MAC by RASPUZZI on 13-Jun-86
; If we don't have a STR: in MYSTR at init time, get one so we won't fail if
; someone is lazy and does a MS SEND to EXEC. 
; *** Edit 2721 to MSCNFG.MAC by RASPUZZI on 16-Jun-86
; Fix minor problem with edit 2719 (change SETZ A, to SETO A,)
; *** Edit 2729 to MSCNFG.MAC by RASPUZZI on 1-Jul-86
; Consider deleted files when getting a handle on MAIL.TXT for MS SEND problem 
; *** Edit 3073 to MSCNFG.MAC by RASPUZZI on 12-Aug-86
; Prevent MS from fouling up the MS####.MAI file spec for MX by using the
; GJ%PHY bit in the GTJFN% for MAIL.TXT.1.
; *** Edit 3098 to MSCNFG.MAC by RASPUZZI on 18-Nov-87
; Redo part of edit 3096 so that some initialization is done a few instructions
; earlier. Done for Ned.