- Made pciuhci.device and pciehci.device compile again: completed
[AROS.git] / compiler / clib / execl.c
blobd25bf0e93b57b48b88ccab6fdc101706b140b735
1 /*
2 Copyright © 1995-2009, 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 <assert.h>
11 #include <stdlib.h>
13 #include "__arosc_privdata.h"
14 #include "__exec.h"
16 /*****************************************************************************
18 NAME */
19 #include <unistd.h>
21 int execl(
23 /* SYNOPSIS */
24 const char *path,
25 const char *arg, ...)
27 /* FUNCTION
28 Executes a file located in given path with specified arguments.
30 INPUTS
31 path - Pathname of the file to execute.
32 arg - First argument passed to the executed file.
33 ... - Other arguments passed to the executed file.
35 RESULT
36 Returns -1 and sets errno appropriately in case of error, otherwise
37 doesn't return.
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 execve(), execlp(), execv(), execvp()
48 INTERNALS
50 ******************************************************************************/
52 struct aroscbase *aroscbase = __aros_getbase_aroscbase();
54 va_list args;
55 char *const *argv;
56 char **environ = (aroscbase->acb_environptr) ? *aroscbase->acb_environptr : NULL;
58 va_start(args, arg);
60 if(!(argv = __exec_valist2array(arg, args)))
62 errno = ENOMEM;
63 return -1;
66 va_end(args);
68 APTR id = __exec_prepare(path, 0, argv, environ);
69 __exec_cleanup_array();
70 if (!id)
71 return -1;
73 __exec_do(id);
75 assert(0); /* Should not be reached */
76 return -1;
77 } /* execl() */