muimaster.library: support Listview_List in List
[AROS.git] / compiler / posixc / execvp.c
blob05051a4180a5430ed5f3f05b8b408df2dac47106
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX.1-2008 function execvp().
6 */
8 #include <aros/debug.h>
10 #include <fcntl.h>
11 #include <unistd.h>
12 #include <errno.h>
13 #include <assert.h>
14 #include <stdlib.h>
16 #include "__exec.h"
18 /*****************************************************************************
20 NAME */
21 #include <unistd.h>
23 int execvp(
25 /* SYNOPSIS */
26 const char *file,
27 char *const argv[])
29 /* FUNCTION
30 Executes a file with given name. The search paths for the executed
31 file are paths specified in the PATH environment variable.
33 INPUTS
34 file - Name of the file to execute.
35 argv - Array of arguments given to main() function of the executed
36 file.
38 RESULT
39 Returns -1 and sets errno appropriately in case of error, otherwise
40 doesn't return.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 execve(), execl(), execlp(), execv()
51 INTERNALS
53 ******************************************************************************/
55 char ***environptr = __posixc_get_environptr();
56 char **environ = (environptr != NULL) ? *environptr : NULL;
57 APTR id = __exec_prepare(file, 1, argv, environ);
58 if(!id)
59 return -1;
61 __exec_do(id);
63 assert(0); /* not reached */
64 return -1;
65 } /* execvp() */