5 * Search $PATH for an executable with the given name.
6 * Like in rc, mid-name slashes do not disable search.
7 * Should probably handle escaped colons,
8 * but I don't know what the syntax is.
11 searchpath(char *name)
13 char *path, *p, *next;
19 if((name[0] == '.' && name[1] == '/')
20 || (name[0] == '.' && name[1] == '.' && name[2] == '/')
22 if(access(name, AEXEC) >= 0)
27 path = getenv("PATH");
28 for(p=path; p && *p; p=next){
29 if((next = strchr(p, ':')) != nil)
32 if(access(name, AEXEC) >= 0){
38 l = strlen(p)+1+strlen(name)+1;
52 if(access(s, AEXEC) >= 0){