Autodoc corrections
[cake.git] / compiler / clib / execl.c
blob49902709779bd561aad2994f37ae483923b1272e
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function execl().
6 */
8 #include <aros/debug.h>
9 #include <errno.h>
10 #include <stdlib.h>
12 /*****************************************************************************
14 NAME */
15 #include <unistd.h>
17 int execl(
19 /* SYNOPSIS */
20 const char *path,
21 const char *arg, ...)
23 /* FUNCTION
25 INPUTS
27 RESULT
29 NOTES
30 Not implemented.
32 EXAMPLE
34 BUGS
36 SEE ALSO
38 INTERNALS
40 ******************************************************************************/
42 va_list args;
43 char default_argv[] = { NULL };
44 char **argv;
46 if(arg != NULL)
48 int argc = 1;
49 va_start(args,arg);
50 while(va_arg(args,const char *) != NULL)
51 argc++;
52 va_end(args);
54 argv = (char**) malloc(sizeof(char*) * (argc + 1));
55 if(!argv)
57 errno = ENOMEM;
58 return -1;
61 argv[0] = arg;
62 int argi;
63 va_start(args,arg);
64 for(argi = 1; argi < argc; argi++)
65 argv[argi] = va_arg(args,const char *);
66 va_end(args);
67 argv[argc] = NULL;
69 else
70 argv = default_argv;
72 return execve(path, argv, environ);
73 } /* execl() */