2005-02-02 07:36:16 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
|
|
|
|
2003-01-13 14:18:01 +03:00
|
|
|
|
|
|
|
#include <user_runtime.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
extern int main(int argc, char **argv);
|
|
|
|
|
2005-02-02 07:36:16 +03:00
|
|
|
int _start(int argc, char **argv, char **env, struct uspace_program_args *args);
|
2003-01-13 14:18:01 +03:00
|
|
|
|
2004-07-05 22:50:20 +04:00
|
|
|
// these are part of libroot.so, and initialized here
|
|
|
|
extern char **argv_save;
|
|
|
|
extern thread_id __main_thread_id;
|
2003-01-13 14:18:01 +03:00
|
|
|
extern char **environ;
|
|
|
|
|
2005-02-02 08:50:15 +03:00
|
|
|
extern char **__libc_argv;
|
|
|
|
extern int __libc_argc;
|
|
|
|
|
2003-01-13 14:18:01 +03:00
|
|
|
|
|
|
|
/* The argument list is redundant, but that is for keeping BeOS compatibility.
|
|
|
|
* BeOS doesn't have the last pointer, though.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
|
|
|
_start(int argc, char **argv, char **_environ, struct uspace_program_args *args)
|
|
|
|
{
|
2005-02-02 07:36:16 +03:00
|
|
|
int returnCode;
|
2003-01-13 14:18:01 +03:00
|
|
|
|
2005-02-02 07:36:16 +03:00
|
|
|
argv_save = args->argv;
|
2004-07-05 22:50:20 +04:00
|
|
|
__main_thread_id = find_thread(NULL);
|
2003-01-13 14:18:01 +03:00
|
|
|
environ = args->envp;
|
|
|
|
|
2005-02-02 07:36:16 +03:00
|
|
|
returnCode = main(__libc_argc, __libc_argv);
|
2003-01-13 14:18:01 +03:00
|
|
|
|
2005-02-02 07:36:16 +03:00
|
|
|
exit(returnCode);
|
2003-01-13 14:18:01 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|