summaryrefslogtreecommitdiff
path: root/src/unistd/execl.c
blob: 4bfcdd9b1322aee85793d011e01ea1b185e1fada (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "stddef.h"
#include "sys/types.h"
#include <unistd.h>
#include "limits.h"
#include "stdarg.h"

int execl(const char *path, const char *arg0, ...  /*, (char *)0 */)
{
	char *argv[_POSIX_ARG_MAX], *arg = (char*)arg0;
	int argc = 0;

	va_list ap;
	va_start(ap, arg0);
	do {
		argv[argc++] = arg;
	} while ((arg = va_arg(ap, char *)) != NULL);
	va_end(ap);

	argv[argc] = NULL;
	return execv(path, argv);
}
/*
POSIX(1)
*/