%%s 3/3/146 %%d D 1.3 15-Jun-83 11:48:49 sventek 3 2 %%c Removed trailing periods from quoted strings, as they are no longer needed. %%s 7/3/142 %%d D 1.2 09-Apr-82 10:25:49 j 2 1 %%c modified the definition of ALL_ACCESS in rm.w`rm.r`rmfile to avoid %%c integer overflow problems on 16-bit machines. Since the definitions %%c of access modes for `chmod' will have to be revamped in a portable %%c way in the future, anyways, this "fix" is of little more than bugfix %%c importance %%s 0/0/0 %%d D 1.1 25-Mar-82 12:12:49 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 #-h- crm 290 asc 25-mar-82 08:33:10 v1.1 (sw-tools v1.1) ## CRm Common block for "rm" tool. common / crm / force, inter, verbos, ttyin integer force # Force deletion without question. integer inter # If YES, confirm before deleting. integer verbos # Output names of deleted files. filedes ttyin # unit for reading terminal when inter == YES %%D 2 #-h- rm.r 2047 asc 25-mar-82 08:33:12 v1.1 (sw-tools v1.1) %%E 2 %%I 2 %%D 3 #-h- rm.r 2108 asc 09-apr-82 10:23:54 j (sventek j) %%E 3 %%E 2 %%I 3 #-h- rm.r 2118 asc 15-jun-83 11:48:34 sventek (joseph sventek) %%E 3 #-h- main 919 asc 25-mar-82 08:32:46 v1.1 (sw-tools v1.1) ## Rm Remove files. DRIVER(rm) character buf(MAXLINE) integer i, narg integer getarg, getlin, isatty, index # function(s) filedes open # function(s) include crm string tty TERMINAL_IN call query( "usage: rm [-fiv] [file] ...") force = NO verbos = NO inter = NO ttyin = open(tty, READ) # unit for prompting for( i = 1 ; getarg( i, buf, FILENAMESIZE) != EOF ; i = i + 1 ) if( buf(1) == '-' ) { call fold(buf) if (index(buf, 'f') > 0) force = YES if (index(buf, 'i') > 0) inter = YES if (index(buf, 'v') > 0) verbos = YES call delarg(i) i = i - 1 } if( i > 1 ) # There were file args. for( i = 1 ; getarg( i, buf, FILENAMESIZE) != EOF ; i = i + 1 ) call rmfile(buf) else if( isatty(STDIN) == NO ) for( i = getlin( buf, STDIN) ; i != EOF ; i = getlin( buf, STDIN) ) { buf(i) = EOS # overwrite '@n' call rmfile(buf) } DRETURN end %%D 2 #-h- rmfile 982 asc 25-mar-82 08:32:48 v1.1 (sw-tools v1.1) %%E 2 %%I 2 %%D 3 #-h- rmfile 1050 asc 09-apr-82 10:23:36 j (sventek j) %%E 3 %%E 2 %%I 3 #-h- rmfile 1049 asc 15-jun-83 11:48:19 sventek (joseph sventek) %%E 3 ### RmFile Remove a file. subroutine rmfile(file) %%D 2 define(ALL_ACCESS,65535) %%E 2 %%I 2 ifdef(LARGE_ADDRESS_SPACE) define(ALL_ACCESS,65535) elsedef define(ALL_ACCESS,-1) enddef %%E 2 character file(FILENAMESIZE), pstr(MAXLINE), yesno(MAXLINE) character clower # function(s) integer junk integer chmod, prompt, remove # function(s) include crm string suff1 ": delete? (y/n) " string suff2 ": is protected; delete? (y/n) " string errst "? Can't remove file ``" if (inter == YES & force == NO & ttyin != ERR) { call concat(file, suff1, pstr) junk = prompt( pstr, yesno, ttyin) if( clower(yesno(1)) != 'y' ) return } if( remove(file) != ERR ) { if( verbos == YES ) call remark(file) return } if( force == NO & ttyin != ERR) { call concat(file, suff2, pstr) junk = prompt( pstr, yesno, ttyin) if( clower(yesno(1)) != 'y' ) return } if( chmod( file, ALL_ACCESS) != ERR ) andif( remove(file) != ERR ) { if( verbos == YES ) call remark(file) return } call putlin( errst, ERROUT) call putlin( file, ERROUT) %%D 3 call remark( "''.") %%E 3 %%I 3 call remark( "''") %%E 3 return end #-h- rm.fmt 885 asc 25-mar-82 08:33:15 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Rm (1) 29-Oct-81 remove files .sy rm [-fiv] [file] ... .ds rm removes the files specified. If none are specified and standard input is not a terminal, `rm' reads the names of the files to delete from the standard input. The options are: .sp .in +8 .ti -3 -v (verbose) display each file's name as it is deleted .sp .ti -3 -f (force) attempt deletion regardless of protection .sp .ti -3 -i (interactive) prompt for confirmation before deleting unless the "-f" option is in effect. .in -8 .sp If a file is protected from delete access, you are asked if you want to try anyway. If you respond with a "y", rm will try to unprotect the file and then delete it. .fl .sa The Unix command 'rm' .di A message is printed if the file could not be removed. .au Joe Sventek (DEC machines); Debbie Scherrer (CDC machines) The "-f" and "-i" options were added by Dave Martin. .bu %%E 1