Index: precomp.h =================================================================== --- precomp.h (revision 50273) +++ precomp.h (working copy) @@ -39,6 +39,14 @@ #include WINE_DEFAULT_DEBUG_CHANNEL(cmd); + +#define CMD_TRACE_DYNAMIC +#ifdef CMD_TRACE_DYNAMIC +#undef TRACE +void cmd_trace(char *szFormat, ...); +#define TRACE cmd_trace +#endif + #ifdef UNICODE #define debugstr_aw debugstr_w #else Index: set.c =================================================================== --- set.c (revision 50273) +++ set.c (working copy) @@ -38,7 +38,29 @@ #ifdef INCLUDE_CMD_SET +#ifdef CMD_TRACE_DYNAMIC +/* + * State can be controlled by setting an environment variable: set CMDTRACE=on + */ +BOOL CMD_TRACE_STATE = FALSE; +/* + * Depending on state, output the trace messages to the console + * + */ +VOID cmd_trace(char *szFormat, ...) +{ + if (CMD_TRACE_STATE) { + va_list arg_ptr; + + va_start (arg_ptr, szFormat); + vprintf(szFormat, arg_ptr); + va_end (arg_ptr); + } +} +#endif + + /* initial size of environment variable buffer */ #define ENV_BUFFER_SIZE 1024 @@ -156,6 +178,13 @@ } *p++ = _T('\0'); +#ifdef CMD_TRACE_DYNAMIC + /* check for dynamic TRACE on off */ + if (_tcsicmp (param, _T("CMDTRACE")) == 0) + { + CMD_TRACE_STATE = ( _tcsicmp (p, _T("on")) == 0 ) ? TRUE : FALSE ; + } +#endif if (!SetEnvironmentVariable(param, *p ? p : NULL)) { nErrorLevel = 1;