diff --git a/src/kernel/glue/start_dyn.c b/src/kernel/glue/start_dyn.c index c790b91d8d..21b4ada9d9 100644 --- a/src/kernel/glue/start_dyn.c +++ b/src/kernel/glue/start_dyn.c @@ -1,13 +1,13 @@ -/* -** 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. -** Distributed under the terms of the NewOS License. -*/ +/* + * 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. + */ + #include -#include #include #include @@ -15,14 +15,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 **env, struct uspace_program_args *args); // these are part of libroot.so, and initialized here -extern int __libc_argc; -extern char **__libc_argv; extern char **argv_save; extern thread_id __main_thread_id; - extern char **environ; @@ -33,16 +30,15 @@ extern char **environ; int _start(int argc, char **argv, char **_environ, struct uspace_program_args *args) { - int retcode; + int returnCode; - __libc_argc = args->argc; - __libc_argv = argv_save = args->argv; + argv_save = args->argv; __main_thread_id = find_thread(NULL); environ = args->envp; - retcode = main(__libc_argc, __libc_argv); + returnCode = main(__libc_argc, __libc_argv); - exit(retcode); + exit(returnCode); return 0; } diff --git a/src/kernel/libroot/libroot_init.c b/src/kernel/libroot/libroot_init.c index 77b625d030..be72bdab31 100644 --- a/src/kernel/libroot/libroot_init.c +++ b/src/kernel/libroot/libroot_init.c @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -14,12 +14,12 @@ void initialize_before(image_id imageID, struct uspace_program_args const *args); char *__progname = NULL; +int __libc_argc; +char **__libc_argv; char _single_threaded = true; // determines if I/O locking needed; needed for BeOS compatibility -int __libc_argc; -char **__libc_argv; thread_id __main_thread_id; char **argv_save; // needed for BeOS compatibility - they are set in the startup code @@ -37,6 +37,9 @@ initialize_before(image_id imageID, struct uspace_program_args const *args) __progname++; } + __libc_argc = args->argc; + __libc_argv = args->argv; + __init_time(); __init_image(args); __init_dlfcn(args);