From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,dbe6b8f0f831d25 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1992-02-13 23:26:50 PST Path: sparky!uunet!decwrl!csus.edu!ucdavis!yvette.ucdavis.edu!jack From: jack@yvette.ucdavis.edu (John M. Crowell) Newsgroups: comp.sys.dec Subject: Re: Soln: Attn RT-11 gurus: file protect detection Message-ID: <17730@aggie.ucdavis.edu> Date: 13 Feb 92 16:51:35 GMT References: <1992Feb6.104432.1599@vixvax.mgi.com> <1992Feb6.200201.1602@vixvax.mgi.com> <1992Feb7.131645.1612@vixvax.mgi.com> Sender: usenet@aggie.ucdavis.edu Followup-To: 5285 Organization: Computing Support Services, UC Davis In article <1992Feb7.131645.1612@vixvax.mgi.com> cepek@vixvax.mgi.com writes: > > On RT-11, is there a way to find out if a file is protected (without > having to muddle through the directory itself)? > : > Well the obvious (to me at least) way to determine whether a file is protected is to look at its status word with the .GFSTA programmed request, which returns the status word in R0. e.g. .GFSTA #area,#chan,#dblk bcs error tst r0 ; bit 15 =1 => protected bmi aprot ; branch if file protected . . . dblk: .word ; .RAD50 of device goes here .word ; .RAD50 of file name goes .word ; in these two words .word ; .RAD50 of extension goes here Of course you can accomplish the same thing with .GFINF using an offset of zero to point to the status word: .GFINF #area,#chan,#dblk,#0 bcs error tst r0 bmi aprot If you're using an antiquated version of RT-11 that doesn't have .GFSTA and .GFINF, you can use the USR callback on a .LOOKUP (triggered by an odd address for the dblk entry. e.g. ; directory entry offsets e.stat = 0 ; offset to status word e.date = 14 ; offset to date word .lookup #farea,#chan bcs error tst status ; look at status word bmi aprot ; branch if file protected . . .close #chan . . . ; Check file status ; This routine is entered after file is found ; with R1 pointing to the date word in the ; directory entry in the USR buffer. chksta: mov (r1),status rts pc . . . status: .word 0 ; file status goes here farea: .byte chan,1 ; these will be filled in by .LOOKUP .word dblk+1 ; odd address triggers callback .word 0 ; no sequence number .word 0 ; this word is ignored .word chkstq ; address of callback routine For more information and more examples of USR callback routines, see the February, 1990 issue of the DECUS Newsletter.