%%s 0/0/0 %%d D 1.1 25-Mar-82 12:12:43 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- rev.r 1184 asc 25-mar-82 08:32:05 v1.1 (sw-tools v1.1) #-h- defns 60 asc 25-mar-82 08:31:39 v1.1 (sw-tools v1.1) # include general symbol definitions # include ratdef #-h- main 620 asc 25-mar-82 08:31:40 v1.1 (sw-tools v1.1) # rev - reverse lines DRIVER(rev) character lin(MAXLINE) integer i, fd integer getarg, open call query("usage: rev [file] ...") fd = ERR for (i=1; getarg(i, lin, FILENAMESIZE) != EOF; i=i+1) { if (lin(1) == '-' & lin(2) == EOS) fd = STDIN else { fd = open(lin, READ) if (fd == ERR) call cant(lin) } call revl(fd) if (fd != STDIN) call close(fd) } if (fd == ERR) #no files given, read STDIN call revl(STDIN) DRETURN end #-h- revl 285 asc 25-mar-82 08:31:42 v1.1 (sw-tools v1.1) ## revl - reverse lines in file 'fd' subroutine revl(fd) integer fd, i integer getlin character lin(MAXLINE) for (i = getlin(lin, fd); i != EOF; i = getlin(lin, fd)) { for (i = i - 1; i > 0; i = i - 1) call putc(lin(i)) call putc('@n') } return end #-h- rev.fmt 326 asc 25-mar-82 08:32:07 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Rev (1) 11-Jul-79 reverse lines .sy rev [file] ... .ds Rev copies the named files to the standard output, reversing the order of the characters in every line. If no files are given, or the filename '-' is specified, rev reads from the standard input. .au David Hanson and friends (U. of Arizona) .di .bu %%E 1