1 /* 2 * Copyright 2003-2006, 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 16 extern int main(int argc, char **argv, char **env); 17 extern void _init_c_library_(void); 18 extern void _call_init_routines_(void); 19 20 int _start(int argc, char **argv, char **env); 21 22 // these are part of libroot.so, and initialized here 23 extern char **argv_save; 24 extern thread_id __main_thread_id; 25 extern char **environ; 26 27 28 int 29 _start(int argc, char **argv, char **environment) 30 { 31 int returnCode; 32 33 argv_save = argv; 34 __main_thread_id = find_thread(NULL); 35 36 // These two are called to make our glue code usable under BeOS R5 37 // - in Haiku, they are both empty. 38 _init_c_library_(); 39 _call_init_routines_(); 40 41 returnCode = main(argc, argv, environment); 42 43 exit(returnCode); 44 return 0; 45 } 46 47