      SUBROUTINE MAIN
      LOGICAL*1 ARG(402)
      INTEGER GETARG, OPEN, CTOI, ADDSET
      INTEGER FD, I, J, L, U, LP, LIST(200), PAGSIZ, PFLAG, JUNK
      LOGICAL*1 USESTR(38)
      DATA USESTR(1)/117/,USESTR(2)/115/,USESTR(3)/97/,USESTR(4)/103/,US
     *ESTR(5)/101/,USESTR(6)/58/,USESTR(7)/32/,USESTR(8)/32/,USESTR(9)/1
     *12/,USESTR(10)/108/,USESTR(11)/32/,USESTR(12)/91/,USESTR(13)/45/,U
     *SESTR(14)/112/,USESTR(15)/60/,USESTR(16)/110/,USESTR(17)/62/,USEST
     *R(18)/93/,USESTR(19)/32/,USESTR(20)/110/,USESTR(21)/117/,USESTR(22
     *)/109/,USESTR(23)/98/,USESTR(24)/101/,USESTR(25)/114/,USESTR(26)/1
     *15/,USESTR(27)/32/,USESTR(28)/91/,USESTR(29)/102/,USESTR(30)/105/,
     *USESTR(31)/108/,USESTR(32)/101/,USESTR(33)/93/,USESTR(34)/32/,USES
     *TR(35)/46/,USESTR(36)/46/,USESTR(37)/46/,USESTR(38)/0/
      CALL QUERY(USESTR)
      PFLAG = 0
      I = 1
      PAGSIZ = 1
      LIST(1) = -1
      I=1
23000 IF (.NOT.(GETARG(I, ARG, 402) .NE. -1))GOTO 23002
      IF (.NOT.(ARG(1) .EQ. 45 .AND. ARG(2) .NE. 0))GOTO 23003
      CALL DOFLAG(ARG, PFLAG, PAGSIZ)
      GOTO 23001
23003 CONTINUE
      IF (.NOT.(LIST(1) .EQ. -1))GOTO 23005
      LP = GNUM (ARG, LIST)
      GOTO 23006
23005 CONTINUE
      IF (.NOT.(ARG(1) .EQ. 45 .AND. ARG(2) .EQ. 0))GOTO 23007
      FD = 1
      GOTO 23008
23007 CONTINUE
      FD = OPEN(ARG, 1)
23008 CONTINUE
      IF (.NOT.(FD .EQ. -3))GOTO 23009
      CALL CANT(ARG)
23009 CONTINUE
      IF (.NOT.(LIST(1) .EQ. -1))GOTO 23011
      CALL ERROR (USESTR)
23011 CONTINUE
      CALL PLINES(FD, LIST, PAGSIZ)
      IF (.NOT.(FD .NE. 1))GOTO 23013
      CALL CLOSE(FD)
23013 CONTINUE
23006 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF (.NOT.(LIST(1) .EQ. -1))GOTO 23015
      CALL ERROR (USESTR)
23015 CONTINUE
      IF (.NOT.(FD .EQ. -3))GOTO 23017
      CALL PLINES(1, LIST, PAGSIZ)
23017 CONTINUE
      RETURN
      END
      SUBROUTINE DOFLAG (ARG, PFLAG, PAGSIZ)
      LOGICAL*1 ARG(100)
      INTEGER PFLAG, PAGSIZ
      INTEGER CTOI
      LOGICAL*1 ST001Z(14)
      LOGICAL*1 ST002Z(26)
      DATA ST001Z(1)/98/,ST001Z(2)/97/,ST001Z(3)/100/,ST001Z(4)/32/,ST00
     *1Z(5)/112/,ST001Z(6)/97/,ST001Z(7)/103/,ST001Z(8)/101/,ST001Z(9)/3
     *2/,ST001Z(10)/115/,ST001Z(11)/105/,ST001Z(12)/122/,ST001Z(13)/101/
     *,ST001Z(14)/0/
      DATA ST002Z(1)/105/,ST002Z(2)/103/,ST002Z(3)/110/,ST002Z(4)/111/,S
     *T002Z(5)/114/,ST002Z(6)/105/,ST002Z(7)/110/,ST002Z(8)/103/,ST002Z(
     *9)/32/,ST002Z(10)/105/,ST002Z(11)/110/,ST002Z(12)/118/,ST002Z(13)/
     *97/,ST002Z(14)/108/,ST002Z(15)/105/,ST002Z(16)/100/,ST002Z(17)/32/
     *,ST002Z(18)/97/,ST002Z(19)/114/,ST002Z(20)/103/,ST002Z(21)/117/,ST
     *002Z(22)/109/,ST002Z(23)/101/,ST002Z(24)/110/,ST002Z(25)/116/,ST00
     *2Z(26)/0/
      IF (.NOT.(ARG(2) .EQ. 112 .OR. ARG(2) .EQ. 80))GOTO 23019
      PFLAG = 1
      J = 3
      PAGSIZ = CTOI(ARG, J)
      IF (.NOT.(PAGSIZ .LT. 0 .OR. ARG(J) .NE. 0))GOTO 23021
      CALL ERROR(ST001Z)
23021 CONTINUE
      IF (.NOT.(PAGSIZ .EQ. 0))GOTO 23023
      PAGSIZ = 23
23023 CONTINUE
      GOTO 23020
23019 CONTINUE
      CALL REMARK (ST002Z)
23020 CONTINUE
      RETURN
      END
      INTEGER FUNCTION GET(N, BUF, FD)
      INTEGER N, FD
      LOGICAL*1 BUF(3000)
      INTEGER I
      LOGICAL*1 GETCH, C
      I = 1
      M = N
23025 IF (.NOT.(M .GT. 0))GOTO 23027
23028 IF (.NOT.(GETCH(C, FD) .NE. -1))GOTO 23029
      IF (.NOT.(I .LT. 3000))GOTO 23030
      BUF(I) = C
      I = I + 1
23030 CONTINUE
      IF (.NOT.(C .EQ. 10))GOTO 23032
      GOTO 23029
23032 CONTINUE
      GOTO 23028
23029 CONTINUE
      IF (.NOT.(C .EQ. -1))GOTO 23034
      GOTO 23027
23034 CONTINUE
23026 M = M - 1
      GOTO 23025
23027 CONTINUE
      BUF(I) = 0
      IF (.NOT.(C .EQ. -1))GOTO 23036
      GET=(-1)
      RETURN
23036 CONTINUE
      GET=(N)
      RETURN
      END
      INTEGER FUNCTION GNUM (ARG, LIST)
      INTEGER LIST(100), LP, J
      LOGICAL*1 ARG(100)
      INTEGER CTOI
      LOGICAL*1 ST003Z(17)
      LOGICAL*1 ST004Z(11)
      LOGICAL*1 ST005Z(10)
      LOGICAL*1 ST006Z(17)
      LOGICAL*1 ST007Z(17)
      DATA ST003Z(1)/116/,ST003Z(2)/111/,ST003Z(3)/111/,ST003Z(4)/32/,ST
     *003Z(5)/109/,ST003Z(6)/97/,ST003Z(7)/110/,ST003Z(8)/121/,ST003Z(9)
     */32/,ST003Z(10)/110/,ST003Z(11)/117/,ST003Z(12)/109/,ST003Z(13)/98
     */,ST003Z(14)/101/,ST003Z(15)/114/,ST003Z(16)/115/,ST003Z(17)/0/
      DATA ST004Z(1)/98/,ST004Z(2)/97/,ST004Z(3)/100/,ST004Z(4)/32/,ST00
     *4Z(5)/110/,ST004Z(6)/117/,ST004Z(7)/109/,ST004Z(8)/98/,ST004Z(9)/1
     *01/,ST004Z(10)/114/,ST004Z(11)/0/
      DATA ST005Z(1)/98/,ST005Z(2)/97/,ST005Z(3)/100/,ST005Z(4)/32/,ST00
     *5Z(5)/114/,ST005Z(6)/97/,ST005Z(7)/110/,ST005Z(8)/103/,ST005Z(9)/1
     *01/,ST005Z(10)/0/
      DATA ST006Z(1)/116/,ST006Z(2)/111/,ST006Z(3)/111/,ST006Z(4)/32/,ST
     *006Z(5)/109/,ST006Z(6)/97/,ST006Z(7)/110/,ST006Z(8)/121/,ST006Z(9)
     */32/,ST006Z(10)/110/,ST006Z(11)/117/,ST006Z(12)/109/,ST006Z(13)/98
     */,ST006Z(14)/101/,ST006Z(15)/114/,ST006Z(16)/115/,ST006Z(17)/0/
      DATA ST007Z(1)/116/,ST007Z(2)/111/,ST007Z(3)/111/,ST007Z(4)/32/,ST
     *007Z(5)/109/,ST007Z(6)/97/,ST007Z(7)/110/,ST007Z(8)/121/,ST007Z(9)
     */32/,ST007Z(10)/110/,ST007Z(11)/117/,ST007Z(12)/109/,ST007Z(13)/98
     */,ST007Z(14)/101/,ST007Z(15)/114/,ST007Z(16)/115/,ST007Z(17)/0/
      LP = 0
      J=1
23038 IF (.NOT.(ARG(J) .NE. 0))GOTO 23040
      LP = LP + 1
      IF (.NOT.(LP .GT. 200))GOTO 23041
      CALL ERROR (ST003Z)
23041 CONTINUE
      LIST(LP) = CTOI(ARG, J)
      IF (.NOT.(LIST(LP) .LE. 0))GOTO 23043
      CALL ERROR (ST004Z)
23043 CONTINUE
      IF (.NOT.(ARG(J) .EQ. 45))GOTO 23045
      J = J + 1
      U = CTOI(ARG, J)
      L = LIST(LP)
      IF (.NOT.( U .LT. L))GOTO 23047
      CALL ERROR(ST005Z)
23047 CONTINUE
      L = L + 1
23049 IF (.NOT.(L .LE. U))GOTO 23051
      LP = LP + 1
      IF (.NOT.(LP .GT. 200))GOTO 23052
      CALL ERROR (ST006Z)
23052 CONTINUE
      LIST(LP) = L
23050 L = L + 1
      GOTO 23049
23051 CONTINUE
23045 CONTINUE
23054 IF (.NOT.(ARG(J) .EQ. 44 .OR. ARG(J) .EQ. 32 .OR. ARG(J) .EQ. 9))G
     *OTO 23055
      J = J + 1
      GOTO 23054
23055 CONTINUE
23039 GOTO 23038
23040 CONTINUE
      IF (.NOT.(LP+1 .GT. 200))GOTO 23056
      CALL ERROR (ST007Z)
23056 CONTINUE
      LIST(LP+1) = -1
      CALL SHELL (LIST, LP)
      GNUM = LP
      RETURN
      END
      SUBROUTINE PLINES(FD, LIST, PAGSIZ)
      INTEGER FD, LIST(200), PAGSIZ
      INTEGER I, J, N, GET, SKIP, LEN, JUNK
      LOGICAL*1 BUF(3000)
      N = 0
      I = 1
23058 IF (.NOT.(LIST(I) .NE. -1))GOTO 23060
      IF (.NOT.(SKIP(PAGSIZ*(LIST(I) - N - 1), FD) .EQ. -1))GOTO 23061
      RETURN
23061 CONTINUE
      LEN = GET(PAGSIZ, BUF, FD)
      J = I
23063 IF (.NOT.(LIST(J) .EQ. LIST(I)))GOTO 23065
      CALL PUTLIN(BUF, 2)
23064 I = I + 1
      GOTO 23063
23065 CONTINUE
      IF (.NOT.(LEN .EQ. -1))GOTO 23066
      RETURN
23066 CONTINUE
      N = LIST(J)
23059 GOTO 23058
23060 CONTINUE
      IF (.NOT.(FD .EQ. 1))GOTO 23068
      JUNK = SKIP(30000, FD)
23068 CONTINUE
      RETURN
      END
      INTEGER FUNCTION SKIP(N, FD)
      INTEGER N, FD
      INTEGER M
      LOGICAL*1 GETCH, C
      M = N
23070 IF (.NOT.(M .GT. 0))GOTO 23072
23073 IF (.NOT.(GETCH(C, FD) .NE. -1))GOTO 23074
      IF (.NOT.(C .EQ. 10))GOTO 23075
      GOTO 23074
23075 CONTINUE
      GOTO 23073
23074 CONTINUE
      IF (.NOT.(C .EQ. -1))GOTO 23077
      GOTO 23072
23077 CONTINUE
23071 M = M - 1
      GOTO 23070
23072 CONTINUE
      IF (.NOT.(C .EQ. -1))GOTO 23079
      SKIP=(-1)
      RETURN
23079 CONTINUE
      SKIP=(N)
      RETURN
      END