#-h- rm.r 1409 asc 07-may-80 12:30:29 #-h- main 272 asc 07-may-80 12:30:12 #--------------------------------------------------------------------- # include symbol definitions # include symbols #--------------------------------------------------------------------- ## main program for rm # call initr4 # call rm # call endr4 # end # #-h- rms 760 asc 07-may-80 12:30:13 ## subroutine rm -- removes files # subroutine rm subroutine main integer i, getarg, verbos, tty, getlin, narg character buf(MAXLINE), clower verbos = NO for (i=1; getarg(i,buf,FILENAMESIZE) != EOF; i=i+1) if (buf(1) == MINUS & clower(buf(2)) == LETV) verbos = YES else if (buf(1) == QMARK & buf(2) == EOS) call error("usage: rm [-v] [file] ...") if (verbos == YES) narg = i - 2 else narg = i - 1 if (narg > 0) for (i=1; getarg(i, buf, FILENAMESIZE) != EOF; i=i+1) { if (buf(1) != MINUS) call rmfile(buf, verbos) } else if (tty(STDIN) == NO) for (i=getlin(buf, STDIN); i != EOF; i=getlin(buf, STDIN)) { buf(i) = EOS # overwrite NEWLINE call rmfile(buf, verbos) } return end #-h- rmfile 230 asc 07-may-80 12:30:15 ## subroutine to remove files, and optionally to list file name on ERROUT subroutine rmfile(file, verbos) character file(FILENAMESIZE) integer verbos if (verbos == YES) call remark(file) call remove(file) return end