Now initializes some global variable defined in libroot_init.c.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8315 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-07-05 18:50:20 +00:00
parent bc8ea5f145
commit 590013dad4

View File

@ -1,4 +1,7 @@
/* /*
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
** Distributed under the terms of the Haiku License.
**
** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
*/ */
@ -14,8 +17,11 @@ extern int main(int argc, char **argv);
int _start(int argc, char **argv, char **, struct uspace_program_args *); int _start(int argc, char **argv, char **, struct uspace_program_args *);
//static char empty[1]; // these are part of libroot.so, and initialized here
//char *__progname = empty; extern int __libc_argc;
extern char **__libc_argv;
extern char **argv_save;
extern thread_id __main_thread_id;
extern char **environ; extern char **environ;
@ -29,9 +35,12 @@ _start(int argc, char **argv, char **_environ, struct uspace_program_args *args)
{ {
int retcode; int retcode;
__libc_argc = args->argc;
__libc_argv = argv_save = args->argv;
__main_thread_id = find_thread(NULL);
environ = args->envp; environ = args->envp;
retcode = main(args->argc, args->argv); retcode = main(__libc_argc, __libc_argv);
exit(retcode); exit(retcode);
return 0; return 0;