envfindfile

[ XITE Reference Manual | XITE home ]

Name

envfindfile, envfindfilemulti - search for file in an environment path

Syntax

 #include <xite/utils.h>

 char *envfindfile( char* environment,
    char* file );

 char *envfindfilemulti(char *environment,
    char *file);

Description

Search for the file file in directories specified by the environment variable. If environment == NULL, dir path = "."

Return value

envfindfile and envfindfilemulti both return full file spec of the file or NULL. If the file was found in more than one directory, envfindfilemulti returns all the filenames separated by :.

The memory space needed for the returned value is allocated by these functions. It should be freed (with free(3)) when not needed any more.

Example

 char *filename, envfindfile();
 filename = endfindfile("PROG_PATH",".progrc");

Author

Otto Milvang and Svein Bøe

Id $Id

envfindfile.c,v 1.34 1996/12/12 19:40:08 svein Exp $