define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / compiler / clib / execve.c
blob890aea5fd0d8e555e83b3b207c377cd0f2d7632e
1 /*
2 Copyright © 2008-2009, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function execve().
6 */
8 #define DEBUG 0
10 #include <exec/types.h>
11 #include <exec/lists.h>
12 #include <proto/exec.h>
13 #include <proto/dos.h>
14 #include <aros/debug.h>
15 #include <dos/filesystem.h>
17 #include <assert.h>
18 #include <ctype.h>
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <sys/stat.h>
22 #include <unistd.h>
24 #include <__errno.h>
25 #include "__exec.h"
26 #include "__upath.h"
27 #include "__open.h"
28 #include "__arosc_privdata.h"
29 #include "__vfork.h"
31 /*****************************************************************************
33 NAME */
34 #include <unistd.h>
36 int execve(
38 /* SYNOPSIS */
39 const char *filename,
40 char *const argv[],
41 char *const envp[])
43 /* FUNCTION
44 Executes a file with given name.
46 INPUTS
47 filename - Name of the file to execute.
48 argv - Array of arguments provided to main() function of the executed
49 file.
50 envp - Array of environment variables passed as environment to the
51 executed program.
53 RESULT
54 Returns -1 and sets errno appropriately in case of error, otherwise
55 doesn't return.
57 NOTES
59 EXAMPLE
61 BUGS
63 SEE ALSO
65 INTERNALS
67 ******************************************************************************/
69 APTR id = __exec_prepare(filename, 0, argv, envp);
70 if(!id)
71 return -1;
73 __exec_do(id);
75 assert(0); /* Should not be reached */
76 return -1;
77 } /* execve() */