*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE
*-----------------------------------------------------------------------
      SUBROUTINE RPNOPT
      CHARACTER CPFIX*(*), CP*(*), CPARA*(*)
      INTEGER   IPARA, IFROMC, LENC
      LOGICAL   LPARA, LFROMC, LCHREQ
      REAL      RPARA, RFROMC
      CHARACTER CARG*80, CPX*80

      EXTERNAL  LCHREQ, LENC, IFROMC, LFROMC, RFROMC
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (INTEGER)
*-----------------------------------------------------------------------
      ENTRY RTIOPT(CPFIX, CP, IPARA)

      CPX = '-'//CPFIX(1:LENC(CPFIX))//CP

      CALL OSQARN(MAX)
      DO 10 N=1, MAX
        CALL OSGARG(N, CARG)
        NP = INDEX(CARG, '=')
        IF (NP.NE.0) THEN
          IF (LCHREQ(CARG(1:NP-1), CPX)) THEN
             IPARA = IFROMC(CARG(NP+1:LENC(CARG)))
             RETURN
          ENDIF
       ENDIF
 10   CONTINUE

      RETURN
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (LOGICAL)
*-----------------------------------------------------------------------
      ENTRY RTLOPT(CPFIX, CP, LPARA)

      CPX = '-'//CPFIX(1:LENC(CPFIX))//CP

      CALL OSQARN(MAX)

      DO 20 N = 1, MAX
        CALL OSGARG(N, CARG)
        NP = INDEX(CARG, '=')
        IF (NP .NE .0) THEN
           IF (LCHREQ(CARG(1:NP-1), CPX)) THEN
              LPARA = LFROMC(CARG(NP+1:LENC(CARG)))
              RETURN
          ENDIF
       ENDIF
 20   CONTINUE

      RETURN
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (REAL)
*-----------------------------------------------------------------------
      ENTRY RTROPT(CPFIX, CP, RPARA)

      CPX = '-'//CPFIX(1:LENC(CPFIX))//CP

      CALL OSQARN(MAX)
      DO 30 N = 1, MAX
         CALL OSGARG(N, CARG)
         NP = INDEX(CARG, '=')
         IF (NP .NE .0) THEN
            IF (LCHREQ(CARG(1:NP-1), CPX)) THEN
               RPARA = RFROMC(CARG(NP+1:LENC(CARG)))
               RETURN
            ENDIF
         ENDIF
 30   CONTINUE

      RETURN
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (CHARACTER)
*-----------------------------------------------------------------------
      ENTRY RTCOPT(CPFIX, CP, CPARA)

      CPX = '-'//CPFIX(1:LENC(CPFIX))//CP

      CALL OSQARN(MAX)
      DO 40 N = 1, MAX
        CALL OSGARG(N, CARG)
        NP = INDEX(CARG, '=')
        IF (NP .NE. 0) THEN
           IF (LCHREQ(CARG(1:NP-1), CPX)) THEN
              CPARA = CARG(NP+1:LENC(CARG))
              RETURN
           ENDIF
        ENDIF
 40   CONTINUE

      RETURN
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (INTEGER)
*-----------------------------------------------------------------------
      ENTRY RLIOPT(CP, IPARA)

      CPX = '-'//CP
      NPARA = INDEX(CPX, ' ') - 1

      CALL OSQARN(MAX)
      DO 50 N = 1, MAX
         CALL OSGARG(N, CARG)
         NP = INDEX(CARG, '=')
         IF (NP.NE.0) THEN
            IF (LCHREQ(CARG(1:NP-1), CPX(1:NPARA))) THEN
               IPARA = IFROMC(CARG(NP+1:LENC(CARG)))
               RETURN
            ENDIF
         ENDIF
 50   CONTINUE

      RETURN
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (LOGICAL)
*-----------------------------------------------------------------------
      ENTRY RLLOPT(CP, LPARA)

      CPX = '-'//CP
      NPARA = INDEX(CPX, ' ') - 1

      CALL OSQARN(MAX)
      DO 60 N = 1, MAX
         CALL OSGARG(N, CARG)
         NP = INDEX(CARG, '=')
         IF (NP.NE.0) THEN
            IF (LCHREQ(CARG(1:NP-1), CPX(1:NPARA))) THEN
               LPARA = LFROMC(CARG(NP+1:LENC(CARG)))
               RETURN
            ENDIF
         ENDIF
 60   CONTINUE
      RETURN
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (REAL)
*-----------------------------------------------------------------------
      ENTRY RLROPT(CP, RPARA)

      CPX = '-'//CP
      NPARA = INDEX(CPX, ' ') - 1

      CALL OSQARN(MAX)
      DO 70 N = 1, MAX
         CALL OSGARG(N, CARG)
         NP = INDEX(CARG, '=')
         IF (NP.NE.0) THEN
            IF (LCHREQ(CARG(1:NP-1), CPX(1:NPARA))) THEN
               RPARA = RFROMC(CARG(NP+1:LENC(CARG)))
               RETURN
            ENDIF
         ENDIF
 70   CONTINUE

      RETURN
*-----------------------------------------------------------------------
*     GET EXTERNAL PARAMETER FROM COMMAND LINE (CHARACTER)
*-----------------------------------------------------------------------
      ENTRY RLCOPT(CP, CPARA)

      CPX = '-'//CP
      NPARA = INDEX(CPX, ' ') - 1

      CALL OSQARN(MAX)
      DO 80 N = 1, MAX
         CALL OSGARG(N, CARG)
         NP = INDEX(CARG, '=')
         IF (NP .NE. 0) THEN
            IF (LCHREQ(CARG(1:NP-1), CPX)) THEN
               CPARA = CARG(NP+1:LENC(CARG))
               RETURN
            ENDIF
         ENDIF
 80   CONTINUE

      RETURN
      END
