3 /* This and the other exec*.c files in this directory require
4 the target to provide the _execve syscall. */
14 #define PATH_DELIM ':'
17 * Copy string, until c or <nul> is encountered.
18 * NUL-terminate the destination string (s1).
22 _DEFUN (strccpy
, (s1
, s2
, c
),
29 while (*s2
&& *s2
!= c
)
37 _DEFUN (execvp
, (file
, argv
),
38 _CONST
char *file _AND
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 */