      SUBROUTINE MAIN
      LOGICAL*1 LIN(400)
      INTEGER I, FD
      INTEGER GETARG, OPEN
      FD = -3
      I=1
23000 IF(.NOT.(GETARG(I, LIN, 40) .NE. -1))GOTO 23002
      IF(.NOT.(LIN(1) .EQ. 63 .AND. LIN(2) .EQ. 0))GOTO 23003
      CALL ERROR (21Husage:  rev [files.].)
      GOTO 23004
23003 CONTINUE
      IF(.NOT.(LIN(1) .EQ. 45 .AND. LIN(2) .EQ. 0))GOTO 23005
      FD = 1
      GOTO 23006
23005 CONTINUE
      FD = OPEN(LIN, 1)
      IF(.NOT.(FD .EQ. -3))GOTO 23007
      CALL CANT(LIN)
23007 CONTINUE
23006 CONTINUE
23004 CONTINUE
      CALL REVL(FD)
      IF(.NOT.(FD .NE. 1))GOTO 23009
      CALL CLOSE(FD)
23009 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF(.NOT.(FD .EQ. -3))GOTO 23011
      CALL REVL(1)
23011 CONTINUE
      RETURN
      END
      SUBROUTINE REVL(FD)
      INTEGER FD, I
      INTEGER GETLIN
      LOGICAL*1 LIN(400)
      I = GETLIN(LIN, FD)
23013 IF(.NOT.(I .NE. -1))GOTO 23015
      I = I - 1
23016 IF(.NOT.(I .GT. 0))GOTO 23018
      CALL PUTC(LIN(I))
23017 I = I - 1
      GOTO 23016
23018 CONTINUE
      CALL PUTC(10)
23014 I = GETLIN(LIN, FD)
      GOTO 23013
23015 CONTINUE
      RETURN
      END
