      SUBROUTINE MAIN
      INTEGER FOUND, REPS, SECS, I, GETARG, J, N, CTOI, LENGTH, SSPAWN, 
     *ASTART
      INTEGER LOCCOM
      LOGICAL*1 ARG(512), PROCES(40), DESCR(7), CLOWER
      LOGICAL*1 SUFFIX(7)
      LOGICAL*1 SH(3)
      LOGICAL*1 ARGS(256)
      LOGICAL*1 USESTR(62)
      DATA SUFFIX(1)/46/,SUFFIX(2)/116/,SUFFIX(3)/115/,SUFFIX(4)/107/,SU
     *FFIX(5)/0/,SUFFIX(6)/10/,SUFFIX(7)/0/
      DATA SH(1)/115/,SH(2)/104/,SH(3)/0/
      DATA ARGS(1)/115/,ARGS(2)/104/,ARGS(3)/32/,ARGS(4)/45/,ARGS(5)/99/
     *,ARGS(6)/32/,ARGS(7)/0/
      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
     *15/,USESTR(10)/99/,USESTR(11)/104/,USESTR(12)/101/,USESTR(13)/100/
     *,USESTR(14)/32/,USESTR(15)/91/,USESTR(16)/45/,USESTR(17)/114/,USES
     *TR(18)/60/,USESTR(19)/114/,USESTR(20)/101/,USESTR(21)/112/,USESTR(
     *22)/101/,USESTR(23)/116/,USESTR(24)/105/,USESTR(25)/116/,USESTR(26
     *)/105/,USESTR(27)/111/,USESTR(28)/110/,USESTR(29)/115/,USESTR(30)/
     *62/,USESTR(31)/93/,USESTR(32)/32/,USESTR(33)/91/,USESTR(34)/45/,US
     *ESTR(35)/116/,USESTR(36)/60/,USESTR(37)/115/,USESTR(38)/101/,USEST
     *R(39)/99/,USESTR(40)/111/,USESTR(41)/110/,USESTR(42)/100/,USESTR(4
     *3)/115/,USESTR(44)/62/,USESTR(45)/93/,USESTR(46)/32/,USESTR(47)/34
     */,USESTR(48)/115/,USESTR(49)/104/,USESTR(50)/101/,USESTR(51)/108/,
     *USESTR(52)/108/,USESTR(53)/32/,USESTR(54)/99/,USESTR(55)/111/,USES
     *TR(56)/109/,USESTR(57)/109/,USESTR(58)/97/,USESTR(59)/110/,USESTR(
     *60)/100/,USESTR(61)/34/,USESTR(62)/0/
      CALL QUERY(USESTR)
      ASTART = LENGTH(ARGS) + 1
      FOUND = 0
      REPS = 1
      SECS = 1
      I=1
23000 IF (.NOT.(GETARG(I, ARG, 512) .NE. -1))GOTO 23002
      IF (.NOT.(ARG(1) .EQ. 45 .AND. CLOWER(ARG(2)) .EQ. 114))GOTO 23003
      J = 3
      N = CTOI(ARG, J)
      IF (.NOT.(N .LT. 1))GOTO 23005
      REPS = 1
      GOTO 23006
23005 CONTINUE
      IF (.NOT.(N .GT. 30000))GOTO 23007
      REPS = 30000
      GOTO 23008
23007 CONTINUE
      REPS = N
23008 CONTINUE
23006 CONTINUE
      GOTO 23004
23003 CONTINUE
      IF (.NOT.(ARG(1) .EQ. 45 .AND. CLOWER(ARG(2)) .EQ. 116))GOTO 23009
      J = 3
      SECS = CTOI(ARG, J)
      GOTO 23010
23009 CONTINUE
      FOUND = 1
      CALL SCOPY(ARG, 1, ARGS, ASTART)
23010 CONTINUE
23004 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF (.NOT.(FOUND .EQ. 0))GOTO 23011
      CALL ERROR(USESTR)
23011 CONTINUE
      CALL IMPATH(ARG)
      IF (.NOT.(LOCCOM(SH, ARG, SUFFIX, PROCES) .NE. 60))GOTO 23013
      CALL ERROR(32HError locating shell image file.)
23013 CONTINUE
      I=1
23015 IF (.NOT.(I .LE. REPS))GOTO 23017
      CALL SLEEP(SECS)
      IF (.NOT.(SSPAWN(PROCES, ARGS, DESCR, 119) .EQ. -3))GOTO 23018
      CALL ERROR(25HError in spawning command)
23018 CONTINUE
23016 I=I+1
      GOTO 23015
23017 CONTINUE
      RETURN
      END
