perm filename NET.OLD[S,NET] blob sn#810603 filedate 1986-02-18 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002		TITLE NET  History A B C D X Y Z P NAMLEN PDLEN NAMES PDL NLIST NSTAT NDOWN NUP NETNAM CRLF START SHOW CMDERR CMD CMD1 CMD2 CMDD CMDU NETLUZ TYPSIX TYPSI1
C00007 ENDMK
C⊗;
	TITLE NET ;⊗ History A B C D X Y Z P NAMLEN PDLEN NAMES PDL NLIST NSTAT NDOWN NUP NETNAM CRLF START SHOW CMDERR CMD CMD1 CMD2 CMDD CMDU NETLUZ TYPSIX TYPSI1

COMMENT $

Program to take networks up and down and other useful things.

History (add changes at end):

16 Feb 86  JJW	Initial implementation

History: add changes above this line.

$	;end of comment

OPDEF NETUUO [CALLI 400135]

A←1
B←2
C←3
D←4
X←5
Y←6
Z←7
P←17

NAMLEN←10
PDLEN←40

NAMES:	BLOCK NAMLEN
PDL:	BLOCK PDLEN

;Argument blocks for NETUUO functions

NLIST:	1
	0
	-NAMLEN,,NAMES

NSTAT:	2
	0
	0

NDOWN:	3
	0
	0

NUP:	4
	0
	0

NETNAM:	0
CRLF:	BYTE (7)15,12

START:	RESET
	MOVE P,[IOWD PDLEN,PDL]

	;Get list of network names
	MOVEI A,NLIST
	NETUUO A,
	 PUSHJ P,NETLUZ

	;Print name and status of each network
	SETZ C,
SHOW:	SKIPN A,NAMES(C)	;Get a network name
	JRST CMD		;No more networks
	MOVEM A,NSTAT+1		;Put in arg block
	PUSHJ P,TYPSIX
	OUTSTR [ASCIZ/:	/]
	MOVEI A,NSTAT
	NETUUO A,
	 PUSHJ P,NETLUZ
	;Print status.  This is still subject to change.
	HRRE A,NSTAT+2
	SKIPE A
	SKIPA B,[[ASCIZ/Up/]]
	MOVEI B,[ASCIZ/Down/]
	OUTSTR (B)
	OUTSTR CRLF
	AOJA C,SHOW

CMDERR:	OUTSTR [ASCIZ/? Please type a legal name.
/]
CMD:	OUTSTR [ASCIZ/
Network /]
	INCHRW D
	CAIL D,140
	SUBI D,40
	;Match input character to network name.  All networks start with
	;unique characters for now, make this smarter if they ever don't.
	SETZ C,
CMD1:	SKIPN B,NAMES(C)
	JRST CMDERR
	SETZ A,
	LSHC A,6
	CAIE D,40(A)		;Skip if first char matches
	AOJA C,CMD1
	MOVE A,B		;Print rest of name
	PUSHJ P,TYPSIX
	MOVE B,NAMES(C)		;Save name for later use
	MOVEM B,NETNAM
CMD2:	OUTSTR [ASCIZ/ function /]
	INCHRW D
	CAIL D,140
	SUBI D,40
	CAIN D,"D"
	JRST CMDD
	CAIN D,"U"
	JRST CMDU
	CAIN D,15
	INCHRW D		;Read LF following CR
	CAIE D,12
	CAIN D,175
	JRST CMD		;Abort command, start over
	OUTSTR [ASCIZ/?
Please type a legal/]
	JRST CMD2

CMDD:	OUTSTR [ASCIZ/own/]	;Take network down
	MOVE A,NETNAM
	MOVEM A,NDOWN+1
	MOVEI A,NDOWN
	NETUUO A,
	 PUSHJ P,NETLUZ
	OUTSTR [ASCIZ/ -- OK --
/]
	JRST CMD

CMDU:	OUTSTR [ASCIZ/p/]	;Bring network up
	MOVE A,NETNAM
	MOVEM A,NUP+1
	MOVEI A,NUP
	NETUUO A,
	 PUSHJ P,NETLUZ
	OUTSTR [ASCIZ/ -- OK --
/]
	JRST CMD

NETLUZ:	OUTSTR [ASCIZ/
Network UUO failed.  Perhaps you don't have the DEV privilege.
/]
	EXIT

;Type sixbit name in A.
TYPSIX:	MOVE Y,A
TYPSI1:	SETZ X,
	LSHC X,6
	ADDI X,40
	OUTCHR X
	JUMPN Y,TYPSI1
	POPJ P,

	END START