This is equivalent and relies solely on standard library functionality. This
effectively inlines and simplifies the call to pathexists that previously
existed. The caching pathexists does is no longer relevant. An improved version
of this is provided by a modern operating system’s buffer cache.
goto normal;
while (*--s != '/');
strcpy(s + 1, "bin");
- if (pathexists(path, PATH_EXECUTE)) {
+ if (access(path, X_OK) == 0) {
if ((s = pathaccess(path, path, p, a, PATH_REGULAR)))
return path == buf ? strdup(s) : s;
goto normal;