Upgraded GRUB2 to 2.00 release.
[AROS.git] / compiler / clib / execv.c
blob5cfd2bcb49acc502ba13144ffcf22b33696ca9fe
1 /*
2 Copyright © 2008-2009, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function execv().
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 "__arosc_privdata.h"
17 #include "__exec.h"
19 /*****************************************************************************
21 NAME */
22 #include <unistd.h>
24 int execv(
26 /* SYNOPSIS */
27 const char *path,
28 char *const argv[])
30 /* FUNCTION
31 Executes a file located in given path with specified arguments.
33 INPUTS
34 path - Pathname 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(), execvp()
51 INTERNALS
53 ******************************************************************************/
55 struct aroscbase *aroscbase = __aros_getbase();
56 char **environ = (aroscbase->acb_environptr) ? *aroscbase->acb_environptr : NULL;
57 APTR id = __exec_prepare(path, 0, argv, environ);
58 if (!id)
59 return -1;
61 __exec_do(id);
63 assert(0); /* Should not be reached */
64 return -1;
65 } /* execv() */