home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!aswx266
- From: aswx266@chpc.utexas.edu (Michael Lemke)
- Subject: Re: Q: VMS OWNERSHIP
- Message-ID: <1992Jul28.222243.19282@chpc.utexas.edu>
- Organization: The University of Texas System - CHPC
- References: <01GMEK6MLDG88WVZ3V@MIS.AVPMI.YORKU.CA> <1992Jul28.154701.1@cstp.umkc.edu>
- Date: Tue, 28 Jul 92 22:22:43 GMT
- Lines: 83
-
- In article <1992Jul28.154701.1@cstp.umkc.edu> mckeever@cstp.umkc.edu writes:
- >In article <01GMEK6MLDG88WVZ3V@MIS.AVPMI.YORKU.CA>, JMCCARTHY@MIS.AVPMI.YORKU.CA (John McCarthy) writes:
- >
- >> The basic problem that I want to solve is to allow someone else (e.g. the
- >> departmental secretary) to update a file that I currently own. However, I don't
- >> want anybody else to get to it, and I don't want her to be able to change the
- >> access rights.
- >>
- [some ideas about ACL's deleted]
-
- [>points out the problem with new versions when using editor]
-
- >The fix is not to let her use an editor to update the file. If she is just
- >adding info to the end of the file, have her edit a temporary file and then
- >use APPEND to tack her changes onto the end of the file owned by you. If
- >she needs to make random changes all over the file, the workaround is not
- >as easy. You'll have to write some sort of program that changes the
- >contents of the file without writing a new version. You could have her
- >edit the file, make her changes, save a temporary file, and then run a C
- >program that just empties out the old data and rewrites it with the
- >information in the temporary file. Not pretty and if it's a big file not
- >very efficient either. It seems to me to be the quickest fix though.
- >
-
- No need to write a program. COPY/OVER/REPLACE does what is needed. I
- once wrote a procedure which does exactly what you describe. I include
- it here. It has a silly default for the file name which was approriate
- for my application but you might want to change it. See notes in the
- procedure. If, however, you only need it for a single fixed file (as I
- did) just define a logical STARLIST and use the proc as is.
-
- Michael
-
- ================================================================================
-
- $ IF P1 .NES. " ?" THEN GOTO NO_HELP
- $ TYP/PAGE SYS$INPUT
- S T A R E D . C O M
- ===================
-
- Edits a file without producing a new version, i.e. it *overwrites* the file to
- be edited. This allows to edit a file of another user provided the file has
- write permission. Uses SYS$SCRATCH for temporary file.
-
- This procedure looks for a logical name STARLIST. If not defined, the default
- file specification is STARLIST.DAT. The default edit command is EDIT.
-
- P1: Edit command (optional), e.g.: VI OTTO.FOR (default: EDIT STARLIST)
-
- 19-FEB-1991 22:37:24.79
- $ EXIT
- $NO_HELP:
- $ EDIT_COMMAND = P1
- $ IF EDIT_COMMAND .EQS. " " THEN EDIT_COMMAND := EDIT
- $ EDIT_COMMAND = F$EDIT( EDIT_COMMAND, "TRIM,UPCASE,COMPRESS" )
- $ EDITOR = F$ELEMENT( 0, " ", EDIT_COMMAND )
- $ FILE = F$ELEMENT( 1, " ", EDIT_COMMAND )
- $ IF FILE .EQS. " " THEN FILE := STARLIST
- $ FILE = F$PARSE( FILE, "STARLIST.DAT" )
- $ FILE_1 = F$SEARCH( FILE )
- $ IF FILE_1 .EQS. ""
- $ THEN
- $ FILE = F$PARSE( FILE, "STARLIST.DAT" )
- $ ELSE
- $ FILE = FILE_1
- $ ENDIF
- $ OLD_FILE = F$SEARCH( "SYS$SCRATCH:STARED.TMP" )
- $ ON WARNING THEN GOTO ERR_ED
- $ DEFINE/USER SYS$INPUT SYS$COMMAND
- $ 'EDITOR'/OUT=SYS$SCRATCH:STARED.TMP 'FILE'
- $ ON WARNING THEN CONTINUE
- $ IF OLD_FILE .NES. F$SEARCH( "SYS$SCRATCH:STARED.TMP" )
- $ THEN
- $ COPY/NOLOG/OVER/REPLACE SYS$SCRATCH:STARED.TMP 'FILE'
- $ DELETE/NOLOG SYS$SCRATCH:STARED.TMP;
- $ ENDIF
- $ EXIT
- $ERR_ED:
- $ WRITE SYS$OUTPUT "Your editor ''EDITOR' can't be used. Sorry."
- --
- Michael Lemke
- Astronomy, UT Austin, Texas
- (michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
-