BUILDPATH(3) Library Routines BUILDPATH(3)
buildPath - search PATH and return the full path name of an executable
char *buildPath (const char *file);
buildPath searches the directories listed in the PATH environment vari-
able for file.
If file resides within PATH, then buildPath constructs a string with
malloc(3) which contains the full pathname of the file. If file itself
specifies a fully qualified pathname, then the constructed string will
be a copy of file, and no test for existence will be done.
If PATH is not set or is the empty string, then buildPath will default
to searching bin then /usr/bin.
On success, the constructed string is returned. On error, NULL is
returned and errno is set.
The current version of gsh parse the PATH variable backwards, so for
compatibility buildPath will currently also search PATH backwards.
This routine was originally called build_path and was part of the lenv-
iron library written by Devin Reade for GNO v2.0.3 in April 1994. It
was incorporated into the GNO libc as of v2.0.6.
buildCmd(3), buildEnv(3), isRootPath(3), environ(7).
GNO 30 January 1997 BUILDPATH(3)
Man(1) output converted with