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
Examples
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.

EXAMPLES

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) February 23, 2025
Generated by manServer 1.08 from 5c6fea1c-e15d-4c81-bc05-f6adddcb3318 using man macros.