SUBROUTINE PARSE ( string, istart, iend, + switch, locswt, swtend, + argue, locarg, endarg, ier ) C CHARACTER*80 string, switch, argue C INTEGER*2 istart, iend INTEGER*2 locswt, swtend, locarg, endarg, ier INTEGER*2 maxint INTEGER*2 loccol, locspc, locsls, loceql C C External functions from the file FUNCTNS.FTN: C INTEGER*2 SPACE, COLON, EQUALS, SLASH EXTERNAL SPACE, COLON, EQUALS, SLASH C DATA maxint/81/ ! Longer than string. C C Executable begins here. C locswt = SLASH ( string, istart, iend ) ! Find next slash. IF ( locswt .GT. 0 ) THEN ! Found switch. loceql = EQUALS ( string, locswt, iend ) ! Find next =. locspc = SPACE ( string, locswt, iend ) ! Find next blank. loccol = COLON ( string, locswt, iend ) ! Find next colon. IF ( loceql .LE. 0 ) loceql = maxint ! Force all zeros off IF ( locspc .LE. 0 ) locspc = maxint ! the line. IF ( loccol .LE. 0 ) loccol = maxint ! locend = MIN ( loceql, locspc, loccol, ! Find smallest. + iend + 1 ) ! locswt = locswt + 1 ! Past /. swtend = locend - 1 ! Ignore end. switch(1:swtend-locswt+1) = ! Switch only, no + string(locswt:swtend) ! special characters. IF ( locend .EQ. loccol ) THEN ! Expect arguement. locarg = locend + 1 ! First char. after :. locspc = SPACE ( string, locarg, ! Find next space. + iend ) ! loceql = EQUALS ( string, locarg, ! Find next colon. + iend ) ! locsls = SLASH ( string, locarg, ! Slash too. + iend ) ! IF ( locsls .LE. 0 ) locsls = maxint ! IF ( locspc .LE. 0 ) locspc = maxint ! IF ( loceql .LE. 0 ) loceql = maxint ! endarg = MIN ( loceql, locspc, locsls, ! Find first ending + iend + 1 ) - 1 ! character. IF ( endarg .LE. 0 ) THEN ! Error. ier = -3 ! Flag it. ELSE ! Success. argue(1:endarg-locarg+1) = ! + string(locarg:endarg) ! Save arguement. ier = 1 ! Flag it. END IF ! ELSE ! No arguements. ier = 0 ! Flag it. END IF ! ELSE ! ier = -1 ! No switch. END IF ! RETURN END