Commit 8a37297f authored by Alexandre Julliard's avatar Alexandre Julliard

Get rid of the WINEOPTIONS variable and instead use WINEDEBUG to

inherit debug options. Start deprecating the --debugmsg option.
parent c11d8b00
......@@ -104,9 +104,9 @@ inline static int contains_path( LPCWSTR name )
*/
inline static int is_special_env_var( const char *var )
{
return (!memcmp( var, "PATH=", sizeof("PATH=")-1 ) ||
!memcmp( var, "TEMP=", sizeof("TEMP=")-1 ) ||
!memcmp( var, "TMP=", sizeof("TMP=")-1 ));
return (!strncmp( var, "PATH=", sizeof("PATH=")-1 ) ||
!strncmp( var, "TEMP=", sizeof("TEMP=")-1 ) ||
!strncmp( var, "TMP=", sizeof("TMP=")-1 ));
}
......@@ -386,7 +386,7 @@ static BOOL build_initial_environment( char **environ )
char *str = *e;
/* skip Unix special variables and use the Wine variants instead */
if (!memcmp( str, "WINE", 4 ))
if (!strncmp( str, "WINE", 4 ))
{
if (is_special_env_var( str + 4 )) str += 4;
}
......@@ -731,7 +731,7 @@ static BOOL process_init( char *argv[], char **environ )
if (!build_initial_environment( environ )) return FALSE;
/* Parse command line arguments */
OPTIONS_ParseOptions( !info_size ? argv : NULL );
if (!info_size) OPTIONS_ParseOptions( argv );
/* initialise DOS drives */
if (!DRIVE_Init()) return FALSE;
......@@ -1100,8 +1100,8 @@ static char **build_envp( const WCHAR *envW, const WCHAR *extra_envW )
continue; /* skipped */
if (is_special_env_var( p )) /* prefix it with "WINE" */
*envptr++ = alloc_env_string( "WINE", p );
else if (memcmp( p, "HOME=", 5 ) &&
memcmp( p, "WINEPREFIX=", 11 )) *envptr++ = p;
else if (strncmp( p, "HOME=", 5 ) &&
strncmp( p, "WINEPREFIX=", 11 )) *envptr++ = p;
}
*envptr = 0;
}
......
......@@ -44,46 +44,10 @@ source.
.SH OPTIONS
.TP
.I --debugmsg [xxx]#name[,[xxx1]#name1]
Turn debugging messages on or off.
.RS +7
.PP
xxx is optional and can be one of the following:
.I err,
.I warn,
.I fixme,
or
.I trace.
If xxx is not specified, all debugging messages for the specified
channel are turned on. Each channel will print messages about a particular
component of
.B wine.
# can be either + or - to switch the specified channel on or off
respectively. If there is no
.I xxx
part before it, a leading + can be omitted. Note that spaces are not
allowed anywhere in the string.
.PP
For instance:
.PP
.I --debugmsg warn+all
will turn on all warning messages (recommended for debugging)
.br
.I --debugmsg warn+dll,+heap
will turn on DLL warning messages and all heap messages.
.br
.I --debugmsg fixme-all,warn+cursor,+relay
will turn off all FIXME messages, turn on cursor warning messages, and turn
on all relay messages (API calls).
.br
.I --debugmsg +relay
will turn on all relay messages. For more control on including or excluding
functions and dlls from the relay trace look into the [Debug] section
of the wine configuration file.
.PP
For more information on debugging messages, see the
.I Running Wine
chapter of the Wine User Guide.
.RE
Turn debugging messages on or off. This option is deprecated, you
should use the
.I WINEDEBUG
environment variable instead (see below).
.PD 1
.SH PROGRAM/ARGUMENTS
The program name may be specified in DOS format (
......@@ -186,7 +150,51 @@ the path and in a few other likely locations.
.TP
.I WINEDEBUG
Turns debugging messages on or off. The syntax of the variable is
identical to the syntax of the arguments for the --debugmsg option.
of the form
.RI [ class ][+/-] channel [,[ class2 ][+/-] channel2 ].
.RS +7
.PP
.I class
is optional and can be one of the following:
.B err, warn, fixme,
or
.B trace.
If
.I class
is not specified, all debugging messages for the specified
channel are turned on. Each channel will print messages about a particular
component of
.B wine.
The following character can be either + or - to switch the specified
channel on or off respectively. If there is no
.I class
part before it, a leading + can be omitted. Note that spaces are not
allowed anywhere in the string.
.PP
Examples:
.TP
WINEDEBUG=warn+all
will turn on all warning messages (recommended for debugging).
.br
.TP
WINEDEBUG=warn+dll,+heap
will turn on DLL warning messages and all heap messages.
.br
.TP
WINEDEBUG=fixme-all,warn+cursor,+relay
will turn off all FIXME messages, turn on cursor warning messages, and turn
on all relay messages (API calls).
.br
.TP
WINEDEBUG=relay
will turn on all relay messages. For more control on including or excluding
functions and dlls from the relay trace look into the [Debug] section
of the wine configuration file.
.PP
For more information on debugging messages, see the
.I Running Wine
chapter of the Wine User Guide.
.RE
.TP
.I WINEDLLPATH
Specifies the path(s) in which to search for builtin dlls and Winelib
......@@ -209,23 +217,23 @@ internal dlls (
). The type may be abbreviated with the first letter of the type (
.I n, b
). Each sequence of orders must be separated by commas.
.br
.RS
.PP
Each dll may have its own specific load order. The load order
determines which version of the dll is attempted to be loaded into the
address space. If the first fails, then the next is tried and so
on. Multiple libraries with the same load order can be separated with
commas. It is also possible to use specify different loadorders for
different libraries by separating the entries by ";".
.br
.PP
The load order for a 16-bit dll is always defined by the load order of
the 32-bit dll that contains it (which can be identified by looking at
the symbolic link of the 16-bit .dll.so file). For instance if
ole32.dll is configured as builtin, storage.dll will be loaded as
builtin too, since the 32-bit ole32.dll contains the 16-bit
storage.dll.
.br
.PP
Examples:
.RS
.TP
WINEDLLOVERRIDES="comdlg32,shell32=n,b"
.br
......@@ -289,12 +297,8 @@ Problems and suggestions with this manpage please also report to
.SH AVAILABILITY
The most recent public version of
.B wine
can be obtained via FTP from ibiblio.org in the
/pub/Linux/ALPHA/Wine/development directory. The releases are in the
format 'Wine-yyyymmdd.tar.gz', or 'Wine-yyyymmdd.diff.gz' for the
diff's from the previous release. The same directory holds the
pre-built contents of the documentation in various formats
(wine-doc.xxx.gz).
can be downloaded from
.I http://www.winehq.org/download
.PP
The latest snapshot of the code may be obtained via CVS. For information
on how to do this, please see
......
......@@ -37,36 +37,23 @@ struct option_descr
const char *longname;
char shortname;
int has_arg;
int inherit;
void (*func)( const char *arg );
const char *usage;
};
static char *inherit_str; /* options to pass to child processes */
static void DECLSPEC_NORETURN out_of_memory(void);
static void out_of_memory(void)
{
MESSAGE( "Virtual memory exhausted\n" );
ExitProcess(1);
}
static void do_debugmsg( const char *arg );
static void do_dll( const char *arg );
static void do_help( const char *arg );
static void do_version( const char *arg );
static const struct option_descr option_table[] =
{
{ "debugmsg", 0, 1, 1, do_debugmsg,
{ "debugmsg", 0, 1, do_debugmsg,
"--debugmsg name Turn debugging-messages on or off" },
{ "dll", 0, 1, 1, do_dll,
"--dll name This option is no longer supported" },
{ "help", 'h', 0, 0, do_help,
{ "help", 'h', 0, do_help,
"--help,-h Show this help message" },
{ "version", 'v', 0, 0, do_version,
{ "version", 'v', 0, do_version,
"--version,-v Display the Wine version" },
{ NULL, 0, 0, 0, NULL, NULL } /* terminator */
{ NULL, 0, 0, NULL, NULL } /* terminator */
};
......@@ -83,6 +70,8 @@ static void do_version( const char *arg )
static void do_debugmsg( const char *arg )
{
char buffer[1024];
if (wine_dbg_parse_options( arg ))
{
MESSAGE("wine: Syntax: --debugmsg [class]+xxx,... or -debugmsg [class]-xxx,...\n");
......@@ -91,40 +80,23 @@ static void do_debugmsg( const char *arg )
MESSAGE("Available message classes: err, warn, fixme, trace\n\n");
ExitProcess(1);
}
}
MESSAGE("Warning: the --debugmsg option is deprecated. You should use\n");
MESSAGE("the WINEDEBUG environment variable instead, like this:\n\n");
MESSAGE(" WINEDEBUG=%s wine ...\n\n", arg );
static void do_dll( const char *arg )
{
MESSAGE("The --dll option has been removed, you should use\n"
"the WINEDLLOVERRIDES environment variable instead.\n"
"To see a help message, run:\n"
" WINEDLLOVERRIDES=help wine <program.exe>\n");
ExitProcess(1);
/* append the argument to WINEDEBUG so that it gets inherited */
if (GetEnvironmentVariableA( "WINEDEBUG", buffer, sizeof(buffer)-1 ) && buffer[0])
{
char *p = buffer + strlen(buffer);
*p++ = ',';
lstrcpynA( p, arg, buffer + sizeof(buffer) - p );
SetEnvironmentVariableA( "WINEDEBUG", buffer );
}
else SetEnvironmentVariableA( "WINEDEBUG", arg );
}
static void remove_options( char *argv[], int pos, int count, int inherit )
static inline void remove_options( char *argv[], int pos, int count )
{
if (inherit)
{
int i, len = 0;
for (i = 0; i < count; i++) len += strlen(argv[pos+i]) + 1;
if (inherit_str)
{
if (!(inherit_str = realloc( inherit_str, strlen(inherit_str) + 1 + len )))
out_of_memory();
strcat( inherit_str, " " );
}
else
{
if (!(inherit_str = malloc( len ))) out_of_memory();
inherit_str[0] = 0;
}
for (i = 0; i < count; i++)
{
strcat( inherit_str, argv[pos+i] );
if (i < count-1) strcat( inherit_str, " " );
}
}
while ((argv[pos] = argv[pos+count])) pos++;
}
......@@ -168,43 +140,22 @@ static void parse_options( char *argv[] )
if (equalarg)
{
opt->func( equalarg );
remove_options( argv, i, 1, opt->inherit );
remove_options( argv, i, 1 );
}
else if (opt->has_arg && argv[i+1])
{
opt->func( argv[i+1] );
remove_options( argv, i, 2, opt->inherit );
remove_options( argv, i, 2 );
}
else
{
opt->func( "" );
remove_options( argv, i, 1, opt->inherit );
remove_options( argv, i, 1 );
}
i--;
}
}
/* inherit options from WINEOPTIONS variable */
static void inherit_options( char *buffer )
{
char *argv[256];
unsigned int n;
char *p = strtok( buffer, " \t" );
for (n = 0; n < sizeof(argv)/sizeof(argv[0])-1 && p; n++)
{
argv[n] = p;
p = strtok( NULL, " \t" );
}
argv[n] = NULL;
parse_options( argv );
if (argv[0]) /* an option remains */
{
MESSAGE( "Unknown option '%s' in WINEOPTIONS variable\n\n", argv[0] );
OPTIONS_Usage();
}
}
/***********************************************************************
* OPTIONS_Usage
*/
......@@ -224,23 +175,16 @@ void OPTIONS_Usage(void)
*/
void OPTIONS_ParseOptions( char *argv[] )
{
char buffer[1024];
int i;
if (GetEnvironmentVariableA( "WINEOPTIONS", buffer, sizeof(buffer) ) && buffer[0])
inherit_options( buffer );
if (!argv) return;
parse_options( argv + 1 );
SetEnvironmentVariableA( "WINEOPTIONS", inherit_str );
/* check if any option remains */
for (i = 1; argv[i]; i++)
{
if (!strcmp( argv[i], "--" ))
{
remove_options( argv, i, 1, 0 );
remove_options( argv, i, 1 );
break;
}
if (argv[i][0] == '-')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment