BUILDPATH(3)                   Library Routines                   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 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.


RETURN VALUES

       On  success, the constructed string is returned.  On error, NULL is re‐
       turned 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 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.


SEE ALSO

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



GNO                             30 January 1997                   BUILDPATH(3)

Man(1) output converted with man2html