      SUBROUTINE MAIN
      LOGICAL*1 BUF(400), ARG(40)
      INTEGER FDB, GETFDB, CCTL, CCTYPE, DECLIN, I, GETARG, UNIT, OPEN
      I = 1
23000 CONTINUE
      IF(.NOT.(GETARG(I, ARG, 40) .EQ. -1))GOTO 23003
      IF(.NOT.(I .EQ. 1))GOTO 23005
      I = I + 1
      UNIT = 1
      GOTO 23006
23005 CONTINUE
      GOTO 23002
23006 CONTINUE
      GOTO 23004
23003 CONTINUE
      I = I + 1
      UNIT = OPEN(ARG, 1)
      IF(.NOT.(UNIT .EQ. -3))GOTO 23007
      CALL CANT(ARG)
23007 CONTINUE
23004 CONTINUE
      FDB = GETFDB(UNIT)
      CCTL = CCTYPE(FDB)
23009 IF(.NOT.(DECLIN(BUF, FDB, CCTL) .NE. -1))GOTO 23010
      CALL PUTLIN(BUF, 2)
      GOTO 23009
23010 CONTINUE
      IF(.NOT.(UNIT .NE. 1))GOTO 23011
      CALL CLOSE(UNIT)
23011 CONTINUE
23001 GOTO 23000
23002 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DECLIN(BUF, FDB, CCTL)
      INTEGER FDB, CCTL, N, GETS, I, J, LENGTH
      LOGICAL*1 BUF(100)
      N = GETS(FDB, BUF, 400-2)
      IF(.NOT.(N .LT. 0))GOTO 23013
      DECLIN = -1
      BUF(1) = 0
      GOTO 23014
23013 CONTINUE
      IF(.NOT.(CCTL .EQ. 2))GOTO 23015
      N = N + 1
      BUF(N) = 10
      GOTO 23016
23015 CONTINUE
      IF(.NOT.(CCTL .EQ. 1))GOTO 23017
      IF(.NOT.(BUF(1) .EQ. 49))GOTO 23019
      BUF(1) = 12
      GOTO 23020
23019 CONTINUE
      IF(.NOT.(BUF(1) .EQ. 48))GOTO 23021
      BUF(1) = 10
      GOTO 23022
23021 CONTINUE
      BUF(1) = 13
23022 CONTINUE
23020 CONTINUE
      N = N + 1
      BUF(N) = 10
23017 CONTINUE
23016 CONTINUE
      I = 1
      J=1
23023 IF(.NOT.(J .LE. N))GOTO 23025
      IF(.NOT.(BUF(J) .NE. 13 .AND. BUF(J) .NE. 0))GOTO 23026
      BUF(I) = BUF(J)
      I = I + 1
23026 CONTINUE
23024 J=J+1
      GOTO 23023
23025 CONTINUE
      BUF(I) = 0
      DECLIN = LENGTH(BUF)
23014 CONTINUE
      RETURN
      END
