      SUBROUTINE MAIN
      LOGICAL*1 BUF(402)
      INTEGER GETARG, OPEN, GETLIN
      INTEGER I, INT
      LOGICAL*1 ST001Z(24)
      DATA ST001Z(1)/117/,ST001Z(2)/115/,ST001Z(3)/97/,ST001Z(4)/103/,ST
     *001Z(5)/101/,ST001Z(6)/58/,ST001Z(7)/32/,ST001Z(8)/32/,ST001Z(9)/1
     *07/,ST001Z(10)/119/,ST001Z(11)/105/,ST001Z(12)/99/,ST001Z(13)/32/,
     *ST001Z(14)/91/,ST001Z(15)/102/,ST001Z(16)/105/,ST001Z(17)/108/,ST0
     *01Z(18)/101/,ST001Z(19)/93/,ST001Z(20)/32/,ST001Z(21)/46/,ST001Z(2
     *2)/46/,ST001Z(23)/46/,ST001Z(24)/0/
      CALL QUERY(ST001Z)
      I=1
23000 IF (.NOT.(GETARG(I,BUF,402).NE.-1))GOTO 23002
      IF (.NOT.(BUF(1) .EQ. 45 .AND. BUF(2) .EQ. 0))GOTO 23003
      INT = 1
      GOTO 23004
23003 CONTINUE
      INT = OPEN(BUF,1)
      IF (.NOT.(INT .EQ. -3))GOTO 23005
      CALL CANT(BUF)
23005 CONTINUE
23004 CONTINUE
23007 IF (.NOT.(GETLIN(BUF,INT) .NE. -1))GOTO 23008
      CALL PUTROT(BUF, 2)
      GOTO 23007
23008 CONTINUE
      IF (.NOT.(INT .NE. 1))GOTO 23009
      CALL CLOSE(INT)
23009 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF (.NOT.(I.EQ.1))GOTO 23011
23013 IF (.NOT.(GETLIN(BUF,1) .NE. -1))GOTO 23014
      CALL PUTROT(BUF, 2)
      GOTO 23013
23014 CONTINUE
23011 CONTINUE
      RETURN
      END
      SUBROUTINE PUTROT (BUF, OUTFIL)
      LOGICAL*1 TYPE
      LOGICAL*1 BUF(100), T
      INTEGER I, OUTFIL
      I=1
23015 IF (.NOT.(BUF(I) .NE. 10))GOTO 23017
      T = TYPE(BUF(I))
      IF (.NOT.(T .EQ. 1 .OR. T .EQ. 2))GOTO 23018
      CALL ROTATE(BUF, I, OUTFIL)
      T = TYPE(BUF(I+1))
23020 IF (.NOT.(T.EQ.1 .OR. T.EQ.2))GOTO 23022
      I = I + 1
23021 T=TYPE(BUF(I+1))
      GOTO 23020
23022 CONTINUE
23018 CONTINUE
23016 I=I+1
      GOTO 23015
23017 CONTINUE
      RETURN
      END
      SUBROUTINE ROTATE(BUF, N, OUTFIL)
      LOGICAL*1 BUF(100)
      INTEGER I, N, OUTFIL
      I=N
23023 IF (.NOT.(BUF(I) .NE. 10))GOTO 23025
      CALL PUTCH(BUF(I), OUTFIL)
23024 I=I+1
      GOTO 23023
23025 CONTINUE
      CALL PUTCH(36, OUTFIL)
      I=1
23026 IF (.NOT.(I.LT.N))GOTO 23028
      CALL PUTCH(BUF(I), OUTFIL)
23027 I=I+1
      GOTO 23026
23028 CONTINUE
      CALL PUTCH(10, OUTFIL)
      RETURN
      END
