Yet another fix for the MacOS X environ brain damage.

This commit is contained in:
Alexandre Julliard 2004-06-14 17:07:30 +00:00
parent 62a860988c
commit 9af2bd4803
3 changed files with 11 additions and 5 deletions

View File

@ -53,7 +53,7 @@ extern int __wine_main_argc;
extern char **__wine_main_argv; extern char **__wine_main_argv;
extern WCHAR **__wine_main_wargv; extern WCHAR **__wine_main_wargv;
extern char **__wine_main_environ; extern char **__wine_main_environ;
extern void wine_init( int argc, char *argv[], char *envp[], char *error, int error_size ); extern void wine_init( int argc, char *argv[], char *error, int error_size );
/* debugging */ /* debugging */

View File

@ -41,6 +41,13 @@
#include "winbase.h" #include "winbase.h"
#include "wine/library.h" #include "wine/library.h"
#ifdef __APPLE__
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
#else
extern char **environ;
#endif
/* argc/argv for the Windows application */ /* argc/argv for the Windows application */
int __wine_main_argc = 0; int __wine_main_argc = 0;
char **__wine_main_argv = NULL; char **__wine_main_argv = NULL;
@ -504,7 +511,7 @@ static void debug_usage(void)
* *
* Main Wine initialisation. * Main Wine initialisation.
*/ */
void wine_init( int argc, char *argv[], char *envp[], char *error, int error_size ) void wine_init( int argc, char *argv[], char *error, int error_size )
{ {
char *wine_debug; char *wine_debug;
int file_exists; int file_exists;
@ -515,7 +522,7 @@ void wine_init( int argc, char *argv[], char *envp[], char *error, int error_siz
wine_init_argv0_path( argv[0] ); wine_init_argv0_path( argv[0] );
__wine_main_argc = argc; __wine_main_argc = argc;
__wine_main_argv = argv; __wine_main_argv = argv;
__wine_main_environ = envp; __wine_main_environ = environ;
mmap_init(); mmap_init();
if ((wine_debug = getenv("WINEDEBUG"))) if ((wine_debug = getenv("WINEDEBUG")))

View File

@ -33,7 +33,6 @@ int main( int argc, char *argv[] )
{ {
char error[1024]; char error[1024];
int i; int i;
extern char **environ;
if (wine_main_preload_info) if (wine_main_preload_info)
{ {
@ -42,7 +41,7 @@ int main( int argc, char *argv[] )
wine_main_preload_info[i].size ); wine_main_preload_info[i].size );
} }
wine_init( argc, argv, environ, error, sizeof(error) ); wine_init( argc, argv, error, sizeof(error) );
fprintf( stderr, "wine: failed to initialize: %s\n", error ); fprintf( stderr, "wine: failed to initialize: %s\n", error );
exit(1); exit(1);
} }