#-h- cat.r 1533 asc 07-may-80 12:06:19 #-h- main 564 asc 07-may-80 12:06:10 #-------------------------------------------------------------------- #include symbols definitions # include symbols #--------------------------------------------------------------------- ## cat -- main program #BKY subroutine driver # call initr4 # call cat # call endr4 # end #BKY #assembly code main program (used to avoid loading fortran I/O) #BKY % #BKY ident main #BKY entry main #BKY vfd 42/0lmain,18/main #BKY ext driver #BKY rj uzero00 #BKY rj driver #BKY end main #BKY% #-h- cats 871 asc 07-may-80 12:06:11 #------------------------------------------------------------------ ## cat - concatenate named files onto standard output # subroutine cat subroutine main character buf(MAXLINE) integer getarg, open integer i, int #BKY integer gettyp, ovride, junk for (i=1; getarg(i, buf, MAXLINE) != EOF; i=i+1) { if (buf(1) == MINUS & buf(2) == EOS) int = STDIN else if (buf(1) == QMARK & buf(2) == EOS) call error ('usage: cat [file] .') else int = open(buf, READ) if (int == ERR) call cant(buf) #For BKY, set stdout type to that of first input file, unless overridden #BKY if (i == 1 & ovride(STDOUT) == NO) #BKY call settyp(STDOUT, gettyp(int,junk)) call fcopy(int, STDOUT) if (int != STDIN) call close(int) } if (i == 1) # no arguments passed call fcopy (STDIN, STDOUT) return end