2008-11-01 05:03:42 +08:00
|
|
|
#ifndef _NO_EXECVE
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* execlp.c */
|
|
|
|
|
|
|
|
/* This and the other exec*.c files in this directory require
|
|
|
|
the target to provide the _execve syscall. */
|
|
|
|
|
|
|
|
#include <_ansi.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
int
|
2017-12-04 11:43:30 +08:00
|
|
|
execlp (const char *path,
|
2017-12-04 10:28:42 +08:00
|
|
|
const char *arg0, ...)
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
va_list args;
|
2017-12-04 10:25:16 +08:00
|
|
|
const char *argv[256];
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
va_start (args, arg0);
|
|
|
|
argv[0] = arg0;
|
|
|
|
i = 1;
|
|
|
|
do
|
2017-12-04 10:25:16 +08:00
|
|
|
argv[i] = va_arg (args, const char *);
|
2000-02-18 03:39:52 +08:00
|
|
|
while (argv[i++] != NULL);
|
|
|
|
va_end (args);
|
|
|
|
|
2017-12-04 10:25:16 +08:00
|
|
|
return execvp (path, (char * const *) argv);
|
2000-02-18 03:39:52 +08:00
|
|
|
}
|
2008-11-01 05:03:42 +08:00
|
|
|
|
|
|
|
#endif /* !_NO_EXECVE */
|