arch/m68k-amiga: Define the gcc symbol 'start' instead of using .bss
[AROS.git] / compiler / clib / execl.c
blob37cc2d0eda8dabbcc714b5b5bdc58edbab1bca69
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 "__exec.h"
15 /*****************************************************************************
17 NAME */
18 #include <unistd.h>
20 int execl(
22 /* SYNOPSIS */
23 const char *path,
24 const char *arg, ...)
26 /* FUNCTION
27 Executes a file located in given path with specified arguments.
29 INPUTS
30 path - Pathname of the file to execute.
31 arg - First argument passed to the executed file.
32 ... - Other arguments passed to the executed file.
34 RESULT
35 Returns -1 and sets errno appropriately in case of error, otherwise
36 doesn't return.
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 execve(), execlp(), execv(), execvp()
47 INTERNALS
49 ******************************************************************************/
51 va_list args;
52 char *const *argv;
54 va_start(args, arg);
56 if(!(argv = __exec_valist2array(arg, args)))
58 errno = ENOMEM;
59 return -1;
62 va_end(args);
64 APTR id = __exec_prepare(path, 0, argv, environ);
65 __exec_cleanup_array();
66 if (!id)
67 return -1;
69 __exec_do(id);
71 assert(0); /* Should not be reached */
72 return -1;
73 } /* execl() */