2005-02-02 07:36:16 +03:00
|
|
|
/*
|
2007-06-20 05:06:48 +04:00
|
|
|
* Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
2005-02-02 07:36:16 +03:00
|
|
|
* 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>
|
|
|
|
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
extern int main(int argc, char **argv, char **env);
|
2007-06-20 05:06:48 +04:00
|
|
|
extern void _init_c_library_(int argc, char **argv, char **env);
|
2006-01-06 06:48:11 +03:00
|
|
|
extern void _call_init_routines_(void);
|
2003-01-13 14:18:01 +03:00
|
|
|
|
2006-01-06 06:48:11 +03:00
|
|
|
int _start(int argc, char **argv, char **env);
|
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;
|
|
|
|
|
2006-10-06 16:19:20 +04:00
|
|
|
bool __gHaikuStartupCode = true;
|
|
|
|
|
2003-01-13 14:18:01 +03:00
|
|
|
|
|
|
|
int
|
2006-01-06 06:48:11 +03:00
|
|
|
_start(int argc, char **argv, char **environment)
|
2003-01-13 14:18:01 +03:00
|
|
|
{
|
2005-02-02 07:36:16 +03:00
|
|
|
int returnCode;
|
2003-01-13 14:18:01 +03:00
|
|
|
|
2006-01-06 06:48:11 +03:00
|
|
|
argv_save = argv;
|
2004-07-05 22:50:20 +04:00
|
|
|
__main_thread_id = find_thread(NULL);
|
2003-01-13 14:18:01 +03:00
|
|
|
|
2006-01-06 06:48:11 +03:00
|
|
|
// These two are called to make our glue code usable under BeOS R5
|
|
|
|
// - in Haiku, they are both empty.
|
2007-06-20 05:06:48 +04:00
|
|
|
_init_c_library_(argc, argv, environment);
|
2006-01-06 06:48:11 +03:00
|
|
|
_call_init_routines_();
|
|
|
|
|
|
|
|
returnCode = main(argc, argv, environment);
|
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;
|
|
|
|
}
|
|
|
|
|