SEARCHPATH(3)SEARCHPATH(3)

NAME
search – search for named executable

SYNOPSIS
#include <u.h>
#include <libc.h>
char* searchpath(char *name)

DESCRIPTION
Searchpath searches for the executable name in the same way that sh(1) and rc(1) do.
The environment variable $PATH is treated as a colon-separated list of directories in which to look for name. An empty string in the list is treated as the current directory. If an executable named name is found in one of the directories, searchpath returns a pointer to a malloced string containing a path (dir/name, or simply name) suitable for use in open(3) or exec(3).
If name begins with ./ , ../ , or / , then the search path is ignored. If name exists and is an executable, then searchpath returns a malloced string containing name.
The returned buffer should be freed when no longer needed. If name is not found, searchpath returns nil.

SOURCE
/usr/local/plan9/src/lib9/searchpath.c

Space Glenda