Added __wine_get_main_args to retrieve command-line arguments for the

application.
This commit is contained in:
Alexandre Julliard 2000-11-09 20:29:42 +00:00
parent 3e38431ef5
commit b1e70285b4
2 changed files with 23 additions and 8 deletions

View file

@ -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_header_trace(ptr str) __wine_dbg_header_trace
@ cdecl wine_dbg_vprintf(str ptr) wine_dbg_vprintf @ cdecl wine_dbg_vprintf(str ptr) wine_dbg_vprintf
@ varargs wine_dbg_printf(str) wine_dbg_printf @ varargs wine_dbg_printf(str) wine_dbg_printf
# Command-line
@ cdecl __wine_get_main_args(ptr) __wine_get_main_args

View file

@ -25,11 +25,6 @@ struct option
const char *usage; const char *usage;
}; };
/* Most Windows C/C++ compilers use something like this to */
/* access argc and argv globally: */
int _ARGC;
char **_ARGV;
/* default options */ /* default options */
struct options 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 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) WINE_NORETURN;
static void out_of_memory(void) static void out_of_memory(void)
{ {
@ -342,7 +340,21 @@ void OPTIONS_ParseOptions( char *argv[] )
} }
/* count the resulting arguments */ /* count the resulting arguments */
_ARGV = argv; app_argv = argv;
_ARGC = 0; app_argc = 0;
while (argv[_ARGC]) _ARGC++; 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;
}