crete an idle task to run when theres ... umm. .. nothing to do ..
[AROS.git] / compiler / clib / execvp.c
blob12479bcbd3885b64534f343f937a05c351c6a172
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX 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 "__arosc_privdata.h"
17 #include "__exec.h"
19 /*****************************************************************************
21 NAME */
22 #include <unistd.h>
24 int execvp(
26 /* SYNOPSIS */
27 const char *file,
28 char *const argv[])
30 /* FUNCTION
31 Executes a file with given name. The search paths for the executed
32 file are paths specified in the PATH environment variable.
34 INPUTS
35 file - Name of the file to execute.
36 argv - Array of arguments given to main() function of the executed
37 file.
39 RESULT
40 Returns -1 and sets errno appropriately in case of error, otherwise
41 doesn't return.
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
50 execve(), execl(), execlp(), execv()
52 INTERNALS
54 ******************************************************************************/
56 char ***environptr = __arosc_get_environptr();
57 char **environ = (environptr != NULL) ? *environptr : NULL;
58 APTR id = __exec_prepare(file, 1, argv, environ);
59 if(!id)
60 return -1;
62 __exec_do(id);
64 assert(0); /* not reached */
65 return -1;
66 } /* execvp() */