From b1e70285b47e03b5b72017f07655e76a922923a9 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 9 Nov 2000 20:29:42 +0000 Subject: [PATCH] Added __wine_get_main_args to retrieve command-line arguments for the application. --- dlls/ntdll/ntdll.spec | 3 +++ misc/options.c | 28 ++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 1c66a3cd4cf..c76c4a9176a 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1023,3 +1023,6 @@ debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem @ cdecl __wine_dbg_header_trace(ptr str) __wine_dbg_header_trace @ cdecl wine_dbg_vprintf(str ptr) wine_dbg_vprintf @ varargs wine_dbg_printf(str) wine_dbg_printf + +# Command-line +@ cdecl __wine_get_main_args(ptr) __wine_get_main_args diff --git a/misc/options.c b/misc/options.c index 3b4c0fc8bb5..a79b1479faa 100644 --- a/misc/options.c +++ b/misc/options.c @@ -25,11 +25,6 @@ struct option const char *usage; }; -/* Most Windows C/C++ compilers use something like this to */ -/* access argc and argv globally: */ -int _ARGC; -char **_ARGV; - /* default options */ struct options Options = { @@ -46,6 +41,9 @@ const char *full_argv0; /* the full path of argv[0] (if known) */ static char *inherit_str; /* options to pass to child processes */ +static int app_argc; /* argc/argv to pass to application */ +static char **app_argv; + static void out_of_memory(void) WINE_NORETURN; static void out_of_memory(void) { @@ -342,7 +340,21 @@ void OPTIONS_ParseOptions( char *argv[] ) } /* count the resulting arguments */ - _ARGV = argv; - _ARGC = 0; - while (argv[_ARGC]) _ARGC++; + app_argv = argv; + app_argc = 0; + while (argv[app_argc]) app_argc++; } + + +/*********************************************************************** + * __wine_get_main_args + * + * Return the argc/argv that the application should see. + * Used by the startup code generated in the .spec.c file. + */ +int __wine_get_main_args( char ***argv ) +{ + *argv = app_argv; + return app_argc; +} +