      SUBROUTINE MAIN
      LOGICAL*1 LINE(512), STR(512)
      INTEGER EQUAL, GETLIN, GETWRD, OPEN
      INTEGER INFILE(4), LEN, LEVEL, LOC
      INTEGER GETARG, I
      LOGICAL*1 INCLD(8)
      DATA INCLD(1) /105/
      DATA INCLD(2) /110/
      DATA INCLD(3) /99/
      DATA INCLD(4) /108/
      DATA INCLD(5) /117/
      DATA INCLD(6) /100/
      DATA INCLD(7) /101/
      DATA INCLD(8) /0/
      CALL QUERY(23Husage:  incl [file] ...)
      I=1
23000 CONTINUE
      IF (.NOT.(GETARG(I, LINE, 512) .EQ. -1))GOTO 23003
      IF (.NOT.(I.NE. 1))GOTO 23005
      GOTO 23002
23005 CONTINUE
      INFILE(1) = 1
      GOTO 23004
23003 CONTINUE
      IF (.NOT.(LINE(1) .EQ. 45 .AND. LINE(2) .EQ. 0))GOTO 23007
      INFILE(1) = 1
      GOTO 23008
23007 CONTINUE
      INFILE(1) = OPEN(LINE,1)
      IF (.NOT.(INFILE(1) .EQ. -3))GOTO 23009
      CALL CANT (LINE)
23009 CONTINUE
23008 CONTINUE
23004 CONTINUE
      LEVEL=1
23011 IF (.NOT.(LEVEL .GT. 0))GOTO 23013
23014 IF (.NOT.(GETLIN(LINE, INFILE(LEVEL)) .NE. -1))GOTO 23015
      LOC = 1
      LEN = GETWRD(LINE, LOC, STR)
      CALL FOLD(STR)
      IF (.NOT.(EQUAL(STR,INCLD) .EQ. 0))GOTO 23016
      CALL PUTLIN (LINE, 2)
      GOTO 23017
23016 CONTINUE
      LEVEL = LEVEL + 1
      IF (.NOT.(LEVEL .GT. 4))GOTO 23018
      CALL ERROR (27Hincludes nested too deeply.)
23018 CONTINUE
      LEN = GETWRD(LINE, LOC,STR)
      INFILE(LEVEL) = OPEN(STR,1)
      IF (.NOT.(INFILE(LEVEL) .EQ. -3))GOTO 23020
      CALL CANT (STR)
23020 CONTINUE
23017 CONTINUE
      GOTO 23014
23015 CONTINUE
      IF (.NOT.(INFILE(LEVEL) .NE. 1))GOTO 23022
      CALL CLOSE (INFILE(LEVEL))
23022 CONTINUE
23012 LEVEL = LEVEL - 1
      GOTO 23011
23013 CONTINUE
      IF (.NOT.(INFILE(1) .NE. 1))GOTO 23024
      CALL CLOSE (INFILE(1))
23024 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      RETURN
      END
