      character*(*) function find_arg(str)
C
C Description:
C
C This function finds the argument of a specified switch. It does
C no error checking. If a switch is not found, the function returns
C an empty string.
C
C Programming interface:
c
C Name      In/out  Type           Structure  Meaning
C
C str       in      character*(*)  scalar     The string containing the switch 
C                                             to be examined
C find_arg  out     character*(*)  scalar     The argument associated with the
C                                             switch in 'str'
C
C Errors:
C
C No errors are trapped. If there is no argument following the selected switch
C then things could get ugly. A syntax checker should be run before this
c routine to make sure that every selectable switch has some argument.
C
C Subroutines accessed:
C
C nargs
C getarg
C
C Portability issues:
C
C The preceeding two subroutines are provided in the FORTRAN library of
C Sun's FORTRAN. If you are not using Sun's FORTRAN or you do not have
C access to these routines, you will need to find a way to replace them
C with a functionally equivalent routine or revise the user interface
C for this program. These routines are the FORTRAN equivalent of the 
C iargc and getarg found in all C libraries. (You may be able
C to trick FORTRAN into using the C versions on UNIX machines. On
C DOS machines, you are on your own. 
C
      implicit none
      include 'std_io.for'
      include 'include_.for'
      integer i,count,nargs
      integer*2 n,status
      logical done
      character*(*) str
      character*64 arg
      count=nargs()
      count=count-1
      i=1
      done=.false.
      find_arg=' '
      do while ((.not. done) .and. (i .le. count))
         n=i
         call getarg(n,arg,status)
         if (arg .eq. str) then
            done=.true.
            n=i+1
            call getarg(n,arg,status)
            find_arg=arg
         end if
         i=i+1
      end do
      return
      end
