source: trunk/libs/newlib/src/newlib/libc/posix/execl.c @ 543

Last change on this file since 543 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 768 bytes
Line 
1#ifndef _NO_EXECVE
2
3/* execl.c */
4
5/* This and the other exec*.c files in this directory require
6   the target to provide the _execve syscall.  */
7
8#include <_ansi.h>
9#include <unistd.h>
10
11/* Only deal with a pointer to environ, to work around subtle bugs with shared
12   libraries and/or small data systems where the user declares his own
13   'environ'.  */
14static char ***p_environ = &environ;
15
16
17#include <stdarg.h>
18
19int
20execl (const char *path,
21      const char *arg0, ...)
22
23
24{
25  int i;
26  va_list args;
27  const char *argv[256];
28
29  va_start (args, arg0);
30  argv[0] = arg0;
31  i = 1;
32  do
33      argv[i] = va_arg (args, const char *);
34  while (argv[i++] != NULL);
35  va_end (args);
36
37  return _execve (path, (char * const  *) argv, *p_environ);
38}
39#endif /* !_NO_EXECVE  */
Note: See TracBrowser for help on using the repository browser.