diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-15 09:38:53 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-15 09:39:34 -0500 |
commit | f95a4a932476be2ba99e2fd081e8d2bc6ea12813 (patch) | |
tree | 75f67192cb2d7b7b575c94edda318e475239b63c /newlib/libc/posix/execlp.c | |
parent | f60aca96985e68c7d8a52eb7bc955fb80e132f73 (diff) |
Import newlib and create makefile
Diffstat (limited to 'newlib/libc/posix/execlp.c')
-rw-r--r-- | newlib/libc/posix/execlp.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/newlib/libc/posix/execlp.c b/newlib/libc/posix/execlp.c new file mode 100644 index 0000000..dd04914 --- /dev/null +++ b/newlib/libc/posix/execlp.c @@ -0,0 +1,42 @@ +/* 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> + +#ifdef _HAVE_STDC + +#include <stdarg.h> + +int +execlp (_CONST char *path, _CONST char *arg0, ...) + +#else + +#include <varargs.h> + +int +execlp (path, arg0, va_alist) + _CONST char *path; + _CONST char *arg0; + va_dcl + +#endif + +{ + int i; + va_list args; + _CONST char *argv[256]; + + va_start (args, arg0); + argv[0] = arg0; + i = 1; + do + argv[i] = va_arg (args, _CONST char *); + while (argv[i++] != NULL); + va_end (args); + + return execvp (path, (char * _CONST *) argv); +} |