C Library Functions  - lookfor (3)

NAME

lookfor(3f) - [M_io:SCANNAMES] look for a filename in a number of directories specified by an environment variable (LICENSE:PD)

CONTENTS

Syntax
Description
Options
Returns
Example
See Also
Author
License

SYNTAX

function lookfor(basename,env) result(pathname)

   character(len=:),intent(in)  :: basename
   character(len=:),intent(in)  :: env
   character(len=:),allocatable :: pathname

DESCRIPTION

Given a base filename find the first file with that name in the directories specified by the environment variable ENV

OPTIONS

BASENAME
  the file to search for
ENV environment variable name. Separator between directory names is assumed to be a colon on ULS (Unix-Like Systems) and semi-colon on MS-Windows machines.

RETURNS

PATHNAME
  the first pathname found in the current user path. Returns blank if the file is not found.

EXAMPLE

Sample program:

    program demo_lookfor
    use M_io, only : lookfor
    implicit none
    character(len=:),allocatable :: returned
       returned=lookfor(’ls’,’PATH’)
       write(*,*)’ls is ’,returned
       returned=lookfor(’dir.exe’,’PATH’)
       write(*,*)’dir is ’,returned
    end program demo_lookfor

SEE ALSO

M_system:system_dir(3f)

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 lookfor (3) July 22, 2023
Generated by manServer 1.08 from 7c3dddc2-eda3-4a51-8aec-e48f814406d8 using man macros.