      SUBROUTINE MAIN
      LOGICAL*1 GETCH
      LOGICAL*1 C, BUF(512)
      INTEGER NL(2), I, INT
      INTEGER OPEN, GETARG, DITOC
      CALL QUERY(23Husage:  lcnt [file] ...)
      NL(1) = 0
      NL(2) = 0
      I=1
23000 IF (.NOT.(GETARG(I,BUF,512).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.(GETCH(C, INT) .NE. -1))GOTO 23008
      IF (.NOT.(C .EQ. 10))GOTO 23009
      NL(2) = NL(2) + 1
      IF (.NOT.(NL(2) .GE. 10000))GOTO 23011
      NL(1) = NL(1) + 1
      NL(2) = 0
23011 CONTINUE
23009 CONTINUE
      GOTO 23007
23008 CONTINUE
      IF (.NOT.(INT .NE. 1))GOTO 23013
      CALL CLOSE(INT)
23013 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF (.NOT.(I .EQ. 1))GOTO 23015
23017 IF (.NOT.(GETCH(C,1) .NE. -1))GOTO 23018
      IF (.NOT.(C .EQ. 10))GOTO 23019
      NL(2) = NL(2) + 1
      IF (.NOT.(NL(2) .GE. 10000))GOTO 23021
      NL(1) = NL(1) + 1
      NL(2) = 0
23021 CONTINUE
23019 CONTINUE
      GOTO 23017
23018 CONTINUE
23015 CONTINUE
      I = DITOC(NL, BUF, 20)
      CALL PUTLIN(BUF, 2)
      CALL PUTCH(10,2)
      RETURN
      END
