      SUBROUTINE MAIN
      LOGICAL*1 GETCH
      LOGICAL*1 C, BUF(400)
      INTEGER NL, I, INT
      INTEGER OPEN, GETARG
      NL = 0
      I=1
23000 IF(.NOT.(GETARG(I,BUF,400).NE.-1))GOTO 23002
      IF(.NOT.(BUF(1) .EQ. 63 .AND. BUF(2) .EQ. 0))GOTO 23003
      CALL ERROR (23Husage: lcnt [file ...].)
      GOTO 23004
23003 CONTINUE
      IF(.NOT.(BUF(1) .EQ. 45 .AND. BUF(2) .EQ. 0))GOTO 23005
      INT = 1
      GOTO 23006
23005 CONTINUE
      INT = OPEN(BUF, 1)
      IF(.NOT.(INT .EQ. -3))GOTO 23007
      CALL CANT (BUF)
23007 CONTINUE
23006 CONTINUE
23004 CONTINUE
23009 IF(.NOT.(GETCH(C, INT) .NE. -1))GOTO 23010
      IF(.NOT.(C .EQ. 10))GOTO 23011
      NL = NL + 1
23011 CONTINUE
      GOTO 23009
23010 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 = NL + 1
23019 CONTINUE
      GOTO 23017
23018 CONTINUE
23015 CONTINUE
      CALL PUTDEC (NL, 1)
      CALL PUTC (10)
      RETURN
      END
