mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibC: Implement execle()
This commit is contained in:
parent
0e990a4be8
commit
7f4a1bc11e
Notes:
sideshowbarker
2024-07-18 16:55:18 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/7f4a1bc11e4 Pull-request: https://github.com/SerenityOS/serenity/pull/7757
2 changed files with 21 additions and 0 deletions
|
@ -160,6 +160,26 @@ int execl(const char* filename, const char* arg0, ...)
|
|||
return execve(filename, const_cast<char* const*>(args.data()), environ);
|
||||
}
|
||||
|
||||
int execle(char const* filename, char const* arg0, ...)
|
||||
{
|
||||
Vector<char const*> args;
|
||||
args.append(arg0);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, arg0);
|
||||
char const* arg;
|
||||
do {
|
||||
arg = va_arg(ap, char const*);
|
||||
args.append(arg);
|
||||
} while (arg);
|
||||
|
||||
auto argv = const_cast<char* const*>(args.data());
|
||||
auto envp = const_cast<char* const*>(va_arg(ap, char* const*));
|
||||
va_end(ap);
|
||||
|
||||
return execve(filename, argv, envp);
|
||||
}
|
||||
|
||||
int execlp(const char* filename, const char* arg0, ...)
|
||||
{
|
||||
Vector<const char*, 16> args;
|
||||
|
|
|
@ -49,6 +49,7 @@ int execve(const char* filename, char* const argv[], char* const envp[]);
|
|||
int execvpe(const char* filename, char* const argv[], char* const envp[]);
|
||||
int execvp(const char* filename, char* const argv[]);
|
||||
int execl(const char* filename, const char* arg, ...);
|
||||
int execle(const char* filename, const char* arg, ...);
|
||||
int execlp(const char* filename, const char* arg, ...);
|
||||
int chroot(const char* path);
|
||||
int chroot_with_mount_flags(const char* path, int mount_flags);
|
||||
|
|
Loading…
Reference in a new issue