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-07 13:39:02 PST Path: sparky!uunet!timbuk.cray.com!web!vixvax.mgi.com!cepek From: cepek@vixvax.mgi.com Newsgroups: comp.sys.dec Subject: Soln: Attn RT-11 gurus: file protect detection Message-ID: <1992Feb7.131645.1612@vixvax.mgi.com> Date: 7 Feb 92 13:16:45 CDT References: <1992Feb6.104432.1599@vixvax.mgi.com> <1992Feb6.200201.1602@vixvax.mgi.com> Organization: Management Graphics, Inc. > In article <1992Feb6.104432.1599@vixvax.mgi.com>, I wrote: > On RT-11, is there a way to find out if a file is protected (without > having to muddle through the directory itself)? > : I've found something that works. First do a .ENTER for the file. This attempts to create a tentative entry in the directory for the (new) file. It will fail if a protected file by that name already exists. So far so good. If the file doesn't exist already, or does exist but is not protected, the .ENTER will succeed (barring other errors). If this file (channel) is then closed, the original file will be replaced with the new, empty one - this would be bad. So instead free up the channel with a .PURGE request. This abandons the tentative directory entry, leaving everything else alone. Viola. And best of all I can do it from C, by using a recent creation of mine - a C-callable EMT utility routine for EMT 374 and EMT 375 calls. Most RTLs have them, I know, but they also have a bug which zaps the high-bit of the return value for error indication, which screws up quite a few I/O requests expecting to be able to return unsigned ints. (Mine also returns the error byte as well as R0). Fare thee well. ,--------------------------------,___________________________ / Mike Cepek, Sr. Software Eng. / Internet: CEPEK@MGI.COM / \ Management Graphics, Inc. \ Voice: +1 612/851-6112 \ "Make / 1401 East 79th Street / Operator: +1 612/854-1220 / it so." \ Minneapolis, MN 55425 USA \ Fax: +1 612/854-6913 \ `-------------------------------/___________________________/