guard the private header
[reactos.git] / reactos / lib / crtdll / old cruft / process / execle.c
1 #include <msvcrt/process.h>
2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/stdarg.h>
4
5
6 /*
7 * FIXME rewrite to pass the array variants to va_list variant
8 *
9 * @unimplemented
10 */
11 int _execle(const char *path, const char *szArgv0, ... /*, const char **envp */)
12 {
13 char *szArg[100];
14 const char *a;
15 char *ptr;
16 int i = 0;
17 va_list l = 0;
18 va_start(l,szArgv0);
19 do {
20 a = (const char *)va_arg(l,const char *);
21 szArg[i++] = (char *)a;
22 } while ( a != NULL && i < 100 );
23
24
25 // szArg0 is passed and not environment if there is only one parameter;
26
27 if ( i >=2 ) {
28 ptr = szArg[i-2];
29 szArg[i-2] = NULL;
30 }
31 else
32 ptr = NULL;
33
34
35 return _spawnve(P_OVERLAY, path, (char * const *)szArg, (char * const *)ptr);
36 }