5 /* This and the other exec*.c files in this directory require
6 the target to provide the _execve syscall. */
16 #define PATH_DELIM ':'
19 * Copy string, until c or <nul> is encountered.
20 * NUL-terminate the destination string (s1).
30 while (*s2
&& *s2
!= c
)
38 execvp (const char *file
,
41 char *path
= getenv ("PATH");
44 /* If $PATH doesn't exist, just pass FILE on unchanged. */
46 return execv (file
, argv
);
48 /* If FILE contains a directory, don't search $PATH. */
49 if (strchr (file
, '/')
51 return execv (file
, argv
);
55 strccpy (buf
, path
, PATH_DELIM
);
56 /* An empty entry means the current directory. */
57 if (*buf
!= 0 && buf
[strlen(buf
) - 1] != '/')
60 if (execv (buf
, argv
) == -1 && errno
!= ENOENT
)
62 while (*path
&& *path
!= PATH_DELIM
)
64 if (*path
== PATH_DELIM
)
65 path
++; /* skip over delim */
71 #endif /* !_NO_EXECVE */