1/*
2 * Copyright 2003-2007, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Copyright 2001, Travis Geiselbrecht. All rights reserved.
6 * Distributed under the terms of the NewOS License.
7 */
8
9
10#include <user_runtime.h>
11
12#include <string.h>
13#include <stdlib.h>
14
15
16extern int main(int argc, char **argv, char **env);
17extern void _init_c_library_(int argc, char **argv, char **env);
18extern void _call_init_routines_(void);
19
20int _start(int argc, char **argv, char **env);
21
22// these are part of libroot.so, and initialized here
23extern char **argv_save;
24extern thread_id __main_thread_id;
25extern char **environ;
26
27bool __gHaikuStartupCode = true;
28
29
30int
31_start(int argc, char **argv, char **environment)
32{
33	int returnCode;
34
35	argv_save = argv;
36	__main_thread_id = find_thread(NULL);
37
38#ifdef _BEOS_R5_COMPATIBLE_
39	// These two are called to make our glue code usable under BeOS R5
40	// - in Haiku, they are both empty.
41	_init_c_library_(argc, argv, environment);
42	_call_init_routines_();
43#endif
44
45	returnCode = main(argc, argv, environment);
46
47	exit(returnCode);
48	return 0;
49}
50
51