BUILDPATH(3)

NAME
buildPath - search PATH and return the full path name of an executable file

SYNOPSIS
#include <gno/gno.h>

char *buildPath (const char *file);

DESCRIPTION
buildPath searches the directories listed in the PATH environment variable 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.

RETURN VALUES
On success, the constructed string is returned. On error, NULL is returned and errno is set.

CAVEATS
The current version of gsh parse the PATH variable backwards, so for compatibility buildPath will currently also search PATH backwards.

HISTORY
This routine was originally called build_path and was part of the lenviron 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.

SEE ALSO
buildCmd(3), buildEnv(3), isRootPath(3), environ(7).