PIPPRO M0210, SET FILE PROTECTI	MACRO M1110  22-AUG-78 01:35

TABLE OF CONTENTS



     7-    1	**** PIPPRO VERSION M0210 ****

PIPPRO M0210, SET FILE PROTECTI	MACRO M1110  22-AUG-78 01:35  PAGE 7





      1						.TITLE	PIPPRO M0210, SET FILE PROTECTION COMMAND - PIP

						.SBTTL	**** PIPPRO VERSION M0210 ****

						.IDENT	/M0210/

      2					; ALTERED WEDNESDAY 8-JAN-75 12:00

      3					;

      4					; B. SCHREIBER	27-AUG-77

      5					;

      6					;	BLS025 -- ADD EXIT WITH STATUS

      7					;

      8					; B. SCHREIBER	7-JUN-78

      9					;

     10					;	BLS052 -- INTEGRATE ODS-2 CHANGES FROM A. GOLDSTEIN AND E.

     11					;		MARISON.

     12					;

     13					; COPYRIGHT (C) 1978, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.

     14					; COPYRIGHT (C) 1977, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.

     15					; COPYRIGHT 1974, DIGITAL EQUIPMENT CORP., MAYNARD MASS.

     16

     17					; THIS SOFTWARE IS FURNISHED TO PURCHASER UNDER A LICENSE FOR USE

     18					; ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH INCLUSION

     19					; OF DEC'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH SYSTEM, EXCEPT

     20					; AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC.

     21

     22					; THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT

     23					; NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL

     24					; EQUIPMENT CORPORATION.

     25

     26					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY

     27					; OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     28					;

     29					; PETER H. LIPMAN	2-MAY-74

     30

     31						.MCALL	FDOF$L

     32	000000					FDOF$L			;DEFINE FDB OFFSETS LOCALLY

     33						.MCALL	CALL,RETURN

     34					; EXAMPLE:

     35					;	TEST.DAT;5/PRO/WOR:R/OWN:RWE/GRP:R/SYS:RWE

     36					; THE SUB SWITCHES ARE

     37					;	/SYSTEM

     38					;	/OWNER

     39					;	/GROUP

     40					;	/WORLD

     41					; THE VALUES FOR ANY OF THESE SWITCHES IS UP TO 4 ASCII

     42					; CHARACTERS IN ANY ORDER WHERE:

     43					;	R=READ PRIVILEGE

     44					;	W=WRITE PRIVILEGE

     45					;	E=EXTEND PRIVILEGE

     46					;	D=DELETE PRIVILEGE

     47					; IF A GIVEN SUB SWITCH IS SPECIFIED AND NO VALUE FOR THAT SWITCH IS

     48					; SPECIFIED, THEN NO PRIVILEGES ARE GRANTED FOR THAT

     49					; GROUP.  IF A GIVEN SUB SWITCH ISN'T MENTIONED, THE PRIVILEGES

     50					; FOR THAT GROUP ARE UNCHANGED.

     51					;

     52

     53

     54	000000					PURE.I

     55

PIPPRO M0210, SET FILE PROTECTI	MACRO M1110  22-AUG-78 01:35  PAGE 7-1

**** PIPPRO VERSION M0210 ****



     56	000000				PROTCT::

     57	000000	012701 	001000 			MOV	#1000,R1	;ALLOCATE A HEADER BUFFER

     58	000004					CALL	.DYALC

     59	000010	010067 	000000G			MOV	R0,.HDRAD	;AND SAVE IT'S ADDRESS IN .HDRAD

     60	000014					CALL	FSTOUT		;SET UP FOR FIRST FILE IN OUTPUT LIST

     61	000020	012700 	000000G			MOV	#FDBOUT,R0

     62	000024	052767 	000000G	000000G	PROTC1:	BIS	#FRSTIM,CPYCTL

     63	000032					CALL	PARSE

     64	000036	103003 				BCC	10$

     65	000040					CALL	PRSERR

     66	000044	000544 				BR	PRONXT

     67	000046	132760 	000000G	000017 	10$:	BITB	#FD.DIR,F.RCTL(R0) ;MUST BE A DIRECTORY DEVICE

     68	000054	001003 				BNE	20$		;BRANCH IF IT IS

     69	000056					ERROUX	DI08,1		;ERROR

	000056	104413 				TRAP	X

	000060	000000G				.WORD	DI08SZ

	000062	000000G				.WORD	DI08MG

     70	000064	016067 	000120 	000000G	20$:	MOV	F.FVER(R0),VERSAV

     71	000072				PROTC2:										;BLS052

     72						.IF NDF	O$$DS2								;BLS052

     73						MOV	VERSAV,F.FVER(R0)						;BLS052

     74						.ENDC									;BLS052

     75	000072					CALL	FNDNXT								;**-1

     76	000076	103512 				BCS	70$

     77	000100	042767 	000000G	000000G		BIC	#FRSTIM,CPYCTL

     78	000106					CALL	.GFOWN		;SET UP FILE OWNER FOR /FO OPTION

     79					;

     80					; READ ATTRIBUTES

     81	000112	016702 	000000G			MOV	PROWRD,R2

     82	000116	022702 	177777 			CMP	#-1,R2		;WAS PROTECTION VALUE SPECIFIED

     83	000122	001050 				BNE	65$		;BRANCH IF YES, DON'T READ ATTRIBUTES

     84	000124	012701 	000102G			MOV	#FDBOUT+F.FNB,R1

     85	000130					CALL	RDATT

     86	000134	103476 				BCS	85$		;BRANCH IF FAILED TO READ ATTRIBUTES

     87	000136	012701 	000004 			MOV	#4,R1		;NUMBER OF GROUPS

     88	000142	016703 	000000G			MOV	.HDRAD,R3

     89						.IF DF	O$$DS2								;BLS052

     90	000146	016303 	000062 			MOV	AB.FP(R3),R3	;EHM026 R3=CURRENT PROTECTION			;BLS052

     91						.IFF									;BLS052

     92						MOV	HH.FP(R3),R3	;R3=CURRENT PROTECTION

     93						.ENDC									;BLS052

     94	000152	005002 				CLR	R2

     95	000154	012704 	000000G			MOV	#WOPROB,R4	;WORLD PROTECTION BIT

     96	000160	012705 	000000G			MOV	#WORPRO,R5	;ADR FOR ARRAY OF PROT CODES

     97	000164				40$:

     98						.IF	GT,R$$EIS

     99						ASHC	#4,R2		;SHIFT NEXT GROUP INTO R2

    100						.IFF

    101	000164	012746 	000004 			MOV	#4,-(SP)

    102	000170	006303 			42$:	ASL	R3		;COMBINED SHIFT 1 BIT

    103	000172	006102 				ROL	R2

    104	000174	005316 				DEC	(SP)		;4 TIMES

    105	000176	003374 				BGT	42$

    106	000200	005726 				TST	(SP)+

    107						.ENDC

    108

    109	000202	030467 	000000G			BIT	R4,CPYCTL	;SWITCH SPECIFIED FOR THIS GROUP

PIPPRO M0210, SET FILE PROTECTI	MACRO M1110  22-AUG-78 01:35  PAGE 7-2

**** PIPPRO VERSION M0210 ****



    110	000206	001003 				BNE	45$		;BRANCH IF YES

    111	000210	062705 	000004 			ADD	#4,R5		;SKIP PROTECTION CODES FOR THIS GROUP

    112	000214	000410 				BR	60$

    113	000216	052702 	000017 		45$:	BIS	#17,R2		;YES, SET (NO ACCESS) PROTECTION BITS

    114	000222	012700 	000004 			MOV	#4,R0		;LOOK AT 4 CHARS OF PROT CODE

    115	000226				50$:	CALL	PROBIT

    116	000232					SOB	R0,50$

    117	000236	006304 			60$:	ASL	R4		;BIT FOR NEXT PROTECTION GROUP

    118	000240					SOB	R1,40$

    119					;

    120					; NOW R2=NEW PROTECTION CODE WORD, WRITE ATTRIBUTES

    121	000244	010277 	000000G		65$:	MOV	R2,@.HDRAD

    122	000250	010605 				MOV	SP,R5		;PRESERVE THE STACK POINTER

    123	000252	005046 				CLR	-(SP)		;PUSH THE ATTRIBUTE LIST

    124	000254	016746 	000000G			MOV	.HDRAD,-(SP)	;WRITE THE PROTECTION WORD

    125	000260	012746 	000000G			MOV	#HA.FP,-(SP)

    126	000264	005767 	000000G			TST	.FOWNR		;FORCING FILE OWNER THE SAME AS DIRECTORY

    127	000270	001404 				BEQ	68$		;BRANCH IF NO

    128	000272	012746 	000000G			MOV	#.FOWNR,-(SP)	;WRITE THE FILE OWNER

    129	000276	012746 	000000G			MOV	#HA.UI,-(SP)

    130	000302	010601 			68$:	MOV	SP,R1

    131	000304	012700 	000000G			MOV	#FDBOUT,R0

    132	000310	010546 				MOV	R5,-(SP)	;R5 IS DESTOYED BY WRITE ATT ERROR

    133	000312					CALL	WRTATT		;ISSUE THE WRITE ATTRIBUTES QI/O AND WAIT

    134	000316	012605 				MOV	(SP)+,R5

    135	000320	010506 				MOV	R5,SP		;RESTORE THE STACK

    136	000322	000410 				BR	PRONX1

    137					;

    138					; FAILED TO FIND FILE

    139	000324				70$:	CALL	FNDERR

    140	000330	000412 				BR	PRONXT

    141					;

    142					; FAILED TO READ ATTRIBUTES

    143	000332				85$:	ERROUT	UN02,0,0

	000332	104426 				TRAP	X

	000334	000000G				.WORD	UN02SZ

	000336	000000G				.WORD	UN02MG

    144	000340					CALL	SETWAR		;SET WARNING STATUS

    145					;

    146					; COME HERE TO CONTINUE WITH NEXT WILD CARD FILE

    147	000344	012700 	000000G		PRONX1:	MOV	#FDBOUT,R0

    148	000350					CALL	NXTFIL		;ANY MORE FILES IN THIS FILE SPEC?

    149	000354	103246 				BCC	PROTC2		;BRANCH IF YES, PROCESS THE NEXT

    150					;

    151					; DO NEXT FILE IN LIST IF ANY MORE

    152	000356				PRONXT:	CALL	INIPRO		;REINIT THE PROTECTION VALUES

    153	000362					CALL	NXTOUT

    154	000366	103216 				BCC	PROTC1		;BRANCH IF MORE FILES TO DO

    155	000370	000167 	000000G			JMP	CLOSX

    156					;

    157					; CHECK CHAR @R5 AGAINST CHARS "RWED", IF ONE OF THOSE, CLEAR

    158					; APPROPRIATE BIT IN R2.  BUMP R5 ON EXIT

    159	000374	122715 	000122 		PROBIT:	CMPB	#'R,@R5

    160	000400	001002 				BNE	10$

    161	000402	042702 	000000G			BIC	#HF.RDV,R2

    162	000406	122715 	000127 		10$:	CMPB	#'W,@R5

    163	000412	001002 				BNE	20$

PIPPRO M0210, SET FILE PROTECTI	MACRO M1110  22-AUG-78 01:35  PAGE 7-3

**** PIPPRO VERSION M0210 ****



    164	000414	042702 	000000G			BIC	#HF.WRV,R2

    165	000420	122715 	000105 		20$:	CMPB	#'E,@R5

    166	000424	001002 				BNE	30$

    167	000426	042702 	000000G			BIC	#HF.EXT,R2

    168	000432	122725 	000104 		30$:	CMPB	#'D,(R5)+

    169	000436	001002 				BNE	40$

    170	000440	042702 	000000G			BIC	#HF.DEL,R2

    171	000444				40$:	RETURN

    172					;

    173					;

    174		000001 				.END

PIPPRO M0210, SET FILE PROTECTI	MACRO M1110  22-AUG-78 01:35  PAGE 7-4

SYMBOL TABLE



AB.CDT  000105   	F.BGBC= 000057   	F.MBFG= 000056   	NB.NXD= 020000   	R$$DYM= 000001

AB.CHU  000064   	F.BKDN= 000026   	F.NRBD= 000024   	NB.WLV= 010000   	R$$EIS= 000000

AB.EXP  000122   	F.BKDS= 000020   	F.NREC= 000030   	NXTFIL= ****** GX	R$$VMS= 000001

AB.FNU  000000   	F.BKEF= 000050   	F.OVBS= 000030   	NXTOUT= ****** GX	R$$11M= 000001

AB.FP   000062   	F.BKP1= 000051   	F.RACC= 000016   	N.DID = 000024   	SETWAR= ****** GX

AB.FSQ  000002   	F.BKST= 000024   	F.RATT= 000001   	N.DVNM= 000032   	S.FATT= 000016

AB.GC   000061   	F.BKVB= 000064   	F.RCNM= 000034   	N.FID = 000000   	S.FDB = 000140

AB.NAM  000006   	F.CHR = 000075   	F.RCTL= 000017   	N.FNAM= 000006   	S.FNAM= 000006

AB.PC   000060   	F.CNTG= 000034   	F.RSIZ= 000002   	N.FTYP= 000014   	S.FNB = 000036

AB.RDT  000070   	F.DFNB= 000046   	F.RTYP= 000000   	N.FVER= 000016   	S.FNBW= 000017

AB.REV  000066   	F.DSPT= 000044   	F.SEQN= 000100   	N.NEXT= 000022   	S.FNTY= 000004

AB.UAT  000020   	F.DVNM= 000134   	F.SPDV= 000072   	N.STAT= 000020   	S.FTYP= 000002

CLOSX = ****** GX	F.EFBK= 000010   	F.SPUN= 000074   	N.UNIT= 000034   	S.NFEN= 000020

CPYCTL= ****** GX	F.EFN = 000050   	F.STBK= 000036   	O$$DS2= 000001   	UN02MG= ****** GX

DI08MG= ****** GX	F.EOBB= 000032   	F.UNIT= 000136   	PARSE = ****** GX	UN02SZ= ****** GX

DI08SZ= ****** GX	F.ERR = 000052   	F.URBD= 000020   	PROBIT  000374R     002	VERSAV= ****** GX

FDBOUT= ****** GX	F.FACC= 000043   	F.VBN = 000064   	PRONXT  000356R     002	WOPROB= ****** GX

FD.DIR= ****** GX	F.FFBY= 000014   	F.VBSZ= 000060   	PRONX1  000344R     002	WORPRO= ****** GX

FNDERR= ****** GX	F.FNAM= 000110   	HA.FP = ****** GX	PROTCT  000000RG    002	WRTATT= ****** GX

FNDNXT= ****** GX	F.FNB = 000102   	HA.UI = ****** GX	PROTC1  000024R     002	X     = 000026

FRSTIM= ****** GX	F.FTYP= 000116   	HF.DEL= ****** GX	PROTC2  000072R     002	.DYALC= ****** GX

FSTOUT= ****** GX	F.FVER= 000120   	HF.EXT= ****** GX	PROWRD= ****** GX	.FOWNR= ****** GX

F.ACTL= 000076   	F.HIBK= 000004   	HF.RDV= ****** GX	PRSERR= ****** GX	.GFOWN= ****** GX

F.ALOC= 000040   	F.LUN = 000042   	HF.WRV= ****** GX	RDATT = ****** GX	.HDRAD= ****** GX

F.BBFS= 000062   	F.MBCT= 000054   	INIPRO= ****** GX	R$$DPB= 000001   	...TPC= 000140

F.BDB = 000070   	F.MBC1= 000055



. ABS.	000131	   000

      	000000	   001

PURE$I	000446	   002

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  3875 WORDS  ( 16 PAGES)

DYNAMIC MEMORY:  4884 WORDS  ( 18 PAGES)

ELAPSED TIME:  00:00:17

OBJ$:PIPPRO,LIS$:PIPPRO/-SP=SRC$:PIPMAC,PIPPRO

