Line | |
---|
1 | /* execle() - execute with a custom environment Author: Kees J. Bot
|
---|
2 | * 21 Jan 1994
|
---|
3 | */
|
---|
4 | #define nil 0
|
---|
5 | #define execle _execle
|
---|
6 | #define execve _execve
|
---|
7 | #include <unistd.h>
|
---|
8 | #include <stdarg.h>
|
---|
9 |
|
---|
10 | int execle(const char *path, const char *arg1, ...)
|
---|
11 | /* execle("/bin/sh", "sh", "-c", "example", (char *) 0, my_env_array); */
|
---|
12 | {
|
---|
13 | char * const * envp;
|
---|
14 | va_list ap;
|
---|
15 |
|
---|
16 | va_start(ap, arg1);
|
---|
17 |
|
---|
18 | /* Find the end of the argument array. */
|
---|
19 | if (arg1 != nil) while (va_arg(ap, const char *) != nil) {}
|
---|
20 |
|
---|
21 | envp = va_arg(ap, char * const *);
|
---|
22 | va_end(ap);
|
---|
23 |
|
---|
24 | return execve(path, (char * const *) &arg1, envp);
|
---|
25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.