[ros-diffs] [hpoussin] 33533: cmd: replace static traces by dynamic ones

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Thu May 15 22:02:06 CEST 2008


Author: hpoussin
Date: Thu May 15 15:02:05 2008
New Revision: 33533

URL: http://svn.reactos.org/svn/reactos?rev=33533&view=rev
Log:
cmd: replace static traces by dynamic ones

Modified:
    trunk/reactos/base/shell/cmd/batch.c
    trunk/reactos/base/shell/cmd/call.c
    trunk/reactos/base/shell/cmd/choice.c
    trunk/reactos/base/shell/cmd/cmd.c
    trunk/reactos/base/shell/cmd/cmd.h
    trunk/reactos/base/shell/cmd/cmd.rbuild
    trunk/reactos/base/shell/cmd/console.c
    trunk/reactos/base/shell/cmd/copy.c
    trunk/reactos/base/shell/cmd/date.c
    trunk/reactos/base/shell/cmd/echo.c
    trunk/reactos/base/shell/cmd/for.c
    trunk/reactos/base/shell/cmd/goto.c
    trunk/reactos/base/shell/cmd/history.c
    trunk/reactos/base/shell/cmd/if.c
    trunk/reactos/base/shell/cmd/move.c
    trunk/reactos/base/shell/cmd/msgbox.c
    trunk/reactos/base/shell/cmd/pause.c
    trunk/reactos/base/shell/cmd/precomp.h
    trunk/reactos/base/shell/cmd/shift.c
    trunk/reactos/base/shell/cmd/start.c
    trunk/reactos/base/shell/cmd/time.c
    trunk/reactos/base/shell/cmd/timer.c
    trunk/reactos/base/shell/cmd/where.c

Modified: trunk/reactos/base/shell/cmd/batch.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/batch.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/batch.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/batch.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -85,9 +85,7 @@
 {
 	LPTSTR pp;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("FindArg: (%d)\n"), n);
-#endif
+	TRACE ("FindArg: (%d)\n", n);
 
 	if (bc == NULL)
 		return NULL;
@@ -172,9 +170,7 @@
 
 VOID ExitBatch (LPTSTR msg)
 {
-#ifdef _DEBUG
-	DebugPrintf (_T("ExitBatch: (\'%s\')\n"), msg);
-#endif
+	TRACE ("ExitBatch: (\'%s\')\n", msg);
 
 	if (bc != NULL)
 	{
@@ -226,10 +222,8 @@
 			    OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
 				 FILE_FLAG_SEQUENTIAL_SCAN, NULL);
 
-#ifdef _DEBUG
-	DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\')  hFile = %x\n"),
+	TRACE ("Batch: (\'%s\', \'%s\', \'%s\')  hFile = %x\n",
 				 fullname, firstword, param, hFile);
-#endif
 
 	if (hFile == INVALID_HANDLE_VALUE)
 	{
@@ -298,9 +292,7 @@
         return FALSE;
     }
 
-#ifdef _DEBUG
-	DebugPrintf (_T("Batch: returns TRUE\n"));
-#endif
+	TRACE ("Batch: returns TRUE\n");
 
 	return TRUE;
 }
@@ -339,9 +331,7 @@
 	if (bc == NULL)
 		return NULL;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("ReadBatchLine ()\n"));
-#endif
+	TRACE ("ReadBatchLine ()\n");
 
 	while (1)
 	{
@@ -435,9 +425,7 @@
 
 		if (!FileGetString (bc->hBatchFile, textline, sizeof (textline) / sizeof (textline[0])))
 		{
-#ifdef _DEBUG
-			DebugPrintf (_T("ReadBatchLine(): Reached EOF!\n"));
-#endif
+			TRACE ("ReadBatchLine(): Reached EOF!\n");
 			/* End of file.... */
 			ExitBatch (NULL);
 
@@ -446,9 +434,7 @@
 
 			continue;
 		}
-#ifdef _DEBUG
-		DebugPrintf (_T("ReadBatchLine(): textline: \'%s\'\n"), textline);
-#endif
+		TRACE ("ReadBatchLine(): textline: \'%s\'\n", textline);
 
 		/* Strip leading spaces and trailing space/control chars */
 		for (first = textline; _istspace (*first); first++)

Modified: trunk/reactos/base/shell/cmd/call.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/call.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/call.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/call.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -44,9 +44,7 @@
 {
 	LPBATCH_CONTEXT n = NULL;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
-#endif
+	TRACE ("cmd_call: (\'%s\',\'%s\')\n", cmd, param);
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{
 		ConOutResPaging(TRUE,STRING_CALL_HELP);

Modified: trunk/reactos/base/shell/cmd/choice.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/choice.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/choice.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/choice.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -260,9 +260,7 @@
 		}
 
 		freep (arg);
-#ifdef _DEBUG
-		DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
-#endif /* _DEBUG */
+		TRACE ("ErrorLevel: %d\n", nErrorLevel);
 		return 0;
 	}
 
@@ -275,25 +273,19 @@
 	switch (GCret)
 	{
 		case GC_TIMEOUT:
-#ifdef _DEBUG
-			DebugPrintf (_T("GC_TIMEOUT\n"));
-			DebugPrintf (_T("elapsed %d msecs\n"), GetTickCount () - clk);
-#endif /* _DEBUG */
+			TRACE ("GC_TIMEOUT\n");
+			TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
 			break;
 
 		case GC_NOKEY:
-#ifdef _DEBUG
-			DebugPrintf(_T("GC_NOKEY\n"));
-			DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
-#endif /* _DEBUG */
+			TRACE ("GC_NOKEY\n");
+			TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
 			goto loop;
 
 		case GC_KEYREAD:
-#ifdef _DEBUG
-			DebugPrintf(_T("GC_KEYREAD\n"));
-			DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
-			DebugPrintf(_T("read %c"), Ch);
-#endif /* _DEBUG */
+			TRACE ("GC_KEYREAD\n");
+			TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
+			TRACE ("read %c", Ch);
 			if ((val=IsKeyInString(lpOptions,Ch,bCaseSensitive))==-1)
 			{
 				Beep (440, 50);
@@ -303,10 +295,8 @@
 			break;
 	}
 
-#ifdef _DEBUG
-	DebugPrintf(_T("exiting wait loop after %d msecs\n"),
+	TRACE ("exiting wait loop after %d msecs\n",
 	            GetTickCount () - clk);
-#endif /* _DEBUG */
 
 	val = IsKeyInString (lpOptions, cDefault, bCaseSensitive);
 	ConOutPrintf (_T("%c\n"), lpOptions[val]);
@@ -315,9 +305,7 @@
 
 	freep (arg);
 
-#ifdef _DEBUG
-	DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
-#endif /* _DEBUG */
+	TRACE ("ErrorLevel: %d\n", nErrorLevel);
 
 	return 0;
 }

Modified: trunk/reactos/base/shell/cmd/cmd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -243,9 +243,7 @@
 		&Info, sizeof(PROCESS_BASIC_INFORMATION), NULL);
 	if (! NT_SUCCESS(Status))
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("NtQueryInformationProcess failed with status %08x\n"), Status);
-#endif
+		WARN ("NtQueryInformationProcess failed with status %08x\n", Status);
 		return TRUE;
 	}
 	Status = NtReadVirtualMemoryPtr (
@@ -253,9 +251,7 @@
 		sizeof(PEB), &BytesRead);
 	if (! NT_SUCCESS(Status) || sizeof(PEB) != BytesRead)
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("Couldn't read virt mem status %08x bytes read %lu\n"), Status, BytesRead);
-#endif
+		WARN ("Couldn't read virt mem status %08x bytes read %lu\n", Status, BytesRead);
 		return TRUE;
 	}
 
@@ -287,37 +283,27 @@
 	MYEX        hShExt;
 	HINSTANCE   ret;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("RunFile(%s)\n"), filename);
-#endif
+	TRACE ("RunFile(%s)\n", filename);
 	hShell32 = LoadLibrary(_T("SHELL32.DLL"));
 	if (!hShell32)
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("RunFile: couldn't load SHELL32.DLL!\n"));
-#endif
+		WARN ("RunFile: couldn't load SHELL32.DLL!\n");
 		return FALSE;
 	}
 
 	hShExt = (MYEX)(FARPROC)GetProcAddress(hShell32, SHELLEXECUTETEXT);
 	if (!hShExt)
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("RunFile: couldn't find ShellExecuteA/W in SHELL32.DLL!\n"));
-#endif
+		WARN ("RunFile: couldn't find ShellExecuteA/W in SHELL32.DLL!\n");
 		FreeLibrary(hShell32);
 		return FALSE;
 	}
 
-#ifdef _DEBUG
-	DebugPrintf (_T("RunFile: ShellExecuteA/W is at %x\n"), hShExt);
-#endif
+	TRACE ("RunFile: ShellExecuteA/W is at %x\n", hShExt);
 
 	ret = (hShExt)(NULL, _T("open"), filename, NULL, NULL, SW_SHOWNORMAL);
 
-#ifdef _DEBUG
-	DebugPrintf (_T("RunFile: ShellExecuteA/W returned %d\n"), (DWORD)ret);
-#endif
+	TRACE ("RunFile: ShellExecuteA/W returned %d\n", (DWORD)ret);
 
 	FreeLibrary(hShell32);
 	return (((DWORD)ret) > 32);
@@ -344,9 +330,7 @@
 	TCHAR szWindowTitle[MAX_PATH];
 	DWORD dwExitCode = 0;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("Execute: \'%s\' \'%s\'\n"), first, rest);
-#endif
+	TRACE ("Execute: \'%s\' \'%s\'\n", first, rest);
 
 	/* we need biger buffer that First, Rest, Full are already
 	   need rewrite some code to use cmd_realloc when it need instead
@@ -481,9 +465,7 @@
 	dot = _tcsrchr (szFullName, _T('.'));
 	if (dot && (!_tcsicmp (dot, _T(".bat")) || !_tcsicmp (dot, _T(".cmd"))))
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
-#endif
+		TRACE ("[BATCH: %s %s]\n", szFullName, rest);
 		Batch (szFullName, first, rest);
 	}
 	else
@@ -492,9 +474,7 @@
 		PROCESS_INFORMATION prci;
 		STARTUPINFO stui;
 
-#ifdef _DEBUG
-		DebugPrintf (_T("[EXEC: %s %s]\n"), full, rest);
-#endif
+		TRACE ("[EXEC: %s %s]\n", full, rest);
 		/* build command line for CreateProcess() */
 
 		/* fill startup info */
@@ -542,15 +522,11 @@
 		}
 		else
 		{
-#ifdef _DEBUG
-			DebugPrintf (_T("[ShellExecute: %s]\n"), full);
-#endif
+			TRACE ("[ShellExecute: %s]\n", full);
 			// See if we can run this with ShellExecute() ie myfile.xls
 			if (!RunFile(full))
 			{
-#ifdef _DEBUG
-				DebugPrintf (_T("[ShellExecute failed!: %s]\n"), full);
-#endif
+				TRACE ("[ShellExecute failed!: %s]\n", full);
 				error_bad_command ();
                                 nErrorLevel = 1;
 			}
@@ -596,9 +572,7 @@
 	INT cl;
 	LPCOMMAND cmdptr;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("DoCommand: (\'%s\')\n"), line);
-#endif /* DEBUG */
+	TRACE ("DoCommand: (\'%s\')\n", line);
 
 	com = cmd_alloc( (_tcslen(line) +512)*sizeof(TCHAR) );
 	if (com == NULL)
@@ -733,9 +707,7 @@
 	_tcscpy (cmdline, cmd);
 	s = &cmdline[0];
 
-#ifdef _DEBUG
-	DebugPrintf (_T("ParseCommandLine: (\'%s\')\n"), s);
-#endif /* DEBUG */
+	TRACE ("ParseCommandLine: (\'%s\')\n", s);
 
 #ifdef FEATURE_ALIASES
 	/* expand all aliases */
@@ -821,9 +793,7 @@
 			ConErrPrintf(szMsg, in);
 			return;
 		}
-#ifdef _DEBUG
-		DebugPrintf (_T("Input redirected from: %s\n"), in);
-#endif
+		TRACE ("Input redirected from: %s\n", in);
 	}
 
 	/* Now do all but the last pipe command */
@@ -943,9 +913,7 @@
 			if (GetFileType (hFile) == FILE_TYPE_DISK)
 				SetFilePointer (hFile, 0, &lHighPos, FILE_END);
 		}
-#ifdef _DEBUG
-		DebugPrintf (_T("Output redirected to: %s\n"), out);
-#endif
+		TRACE ("Output redirected to: %s\n", out);
 	}
 	else if (hOldConOut != INVALID_HANDLE_VALUE)
 	{
@@ -966,9 +934,7 @@
 
 		if (!_tcscmp (err, out))
 		{
-#ifdef _DEBUG
-			DebugPrintf (_T("Stdout and stderr will use the same file!!\n"));
-#endif
+			TRACE ("Stdout and stderr will use the same file!!\n");
 			DuplicateHandle (GetCurrentProcess (),
 			                 GetStdHandle (STD_OUTPUT_HANDLE),
 			                 GetCurrentProcess (),
@@ -1005,9 +971,7 @@
 			if (GetFileType (hFile) == FILE_TYPE_DISK)
 				SetFilePointer (hFile, 0, &lHighPos, FILE_END);
 		}
-#ifdef _DEBUG
-		DebugPrintf (_T("Error redirected to: %s\n"), err);
-#endif
+		TRACE ("Error redirected to: %s\n", err);
 	}
 	else if (hOldConErr != INVALID_HANDLE_VALUE)
 	{
@@ -1053,9 +1017,7 @@
 	}
 	else
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("Can't restore STDIN! Is invalid!!\n"), out);
-#endif
+		WARN ("Can't restore STDIN! Is invalid!!\n", out);
 	}
 #endif  /* buggy implementation */
 
@@ -1066,9 +1028,7 @@
 		SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
 		if (hIn == INVALID_HANDLE_VALUE)
 		{
-#ifdef _DEBUG
-			DebugPrintf (_T("Previous STDIN is invalid!!\n"));
-#endif
+			WARN ("Previous STDIN is invalid!!\n");
 		}
 		else
 		{
@@ -1083,9 +1043,7 @@
 				}
 				else
 				{
-#ifdef _DEBUG
-					DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
-#endif
+					WARN ("hFile[0] and hIn dont match!!!\n");
 				}
 			}
 		}
@@ -1725,14 +1683,12 @@
 	}
 
 
-#ifdef _DEBUG
-	DebugPrintf (_T("[command args:\n"));
+	TRACE ("[command args:\n");
 	for (i = 0; i < argc; i++)
 	{
-		DebugPrintf (_T("%d. %s\n"), i, argv[i]);
-	}
-	DebugPrintf (_T("]\n"));
-#endif
+		TRACE ("%d. %s\n", i, argv[i]);
+	}
+	TRACE ("]\n");
 
 	InitLocale ();
 

Modified: trunk/reactos/base/shell/cmd/cmd.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.h?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] Thu May 15 15:02:05 2008
@@ -133,12 +133,6 @@
 /* Prototypes for COLOR.C */
 VOID SetScreenColor(WORD wArgColor, BOOL bFill);
 INT CommandColor (LPTSTR, LPTSTR);
-
-
-/* Prototypes for CONSOLE.C */
-#ifdef _DEBUG
-VOID DebugPrintf (LPTSTR, ...);
-#endif /* _DEBUG */
 
 VOID ConInDummy (VOID);
 VOID ConInDisable (VOID);

Modified: trunk/reactos/base/shell/cmd/cmd.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.rbuild?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.rbuild [iso-8859-1] Thu May 15 15:02:05 2008
@@ -73,6 +73,7 @@
 		<define name="ANONYMOUSUNIONS" />
 		<define name="_WIN32_WINNT">0x0501</define>
 		<library>cmd_base</library>
+		<library>wine</library>
 		<library>kernel32</library>
 		<library>advapi32</library>
 		<library>shell32</library>

Modified: trunk/reactos/base/shell/cmd/console.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/console.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/console.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/console.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -55,10 +55,8 @@
 	INPUT_RECORD dummy;
 	DWORD  dwRead;
 
-#ifdef _DEBUG
 	if (hInput == INVALID_HANDLE_VALUE)
-		DebugPrintf (_T("Invalid input handle!!!\n"));
-#endif /* _DEBUG */
+		WARN ("Invalid input handle!!!\n");
 	ReadConsoleInput (hInput, &dummy, 1, &dwRead);
 }
 
@@ -73,10 +71,8 @@
 	HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
 	DWORD  dwRead;
 
-#ifdef _DEBUG
 	if (hInput == INVALID_HANDLE_VALUE)
-		DebugPrintf (_T("Invalid input handle!!!\n"));
-#endif /* _DEBUG */
+		WARN ("Invalid input handle!!!\n");
 
 	do
 	{
@@ -431,24 +427,6 @@
 	va_end (arg_ptr);
 }
 
-#ifdef _DEBUG
-VOID DebugPrintf (LPTSTR szFormat, ...)
-{
-	va_list arg_ptr;
-
-	va_start (arg_ptr, szFormat);
-	ConPrintf(szFormat, arg_ptr, STD_ERROR_HANDLE);
-	va_end (arg_ptr);
-#if 0
-	TCHAR szOut[OUTPUT_BUFFER_SIZE];
-	va_start (arg_ptr, szFormat);
-	_vstprintf (szOut, szFormat, arg_ptr);
-	OutputDebugString (szOut);
-	va_end (arg_ptr);
-#endif
-}
-#endif /* _DEBUG */
-
 VOID SetCursorXY (SHORT x, SHORT y)
 {
 	COORD coPos;

Modified: trunk/reactos/base/shell/cmd/copy.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/copy.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/copy.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/copy.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -72,9 +72,7 @@
     if(CheckCtrlBreak(BREAK_INPUT))
         return 0;
 
-#ifdef _DEBUG
-    DebugPrintf (_T("checking mode\n"));
-#endif
+    TRACE ("checking mode\n");
 
     if(bTouch)
     {
@@ -116,16 +114,12 @@
         return 0;
     }
 
-#ifdef _DEBUG
-    DebugPrintf (_T("getting time\n"));
-#endif
+    TRACE ("getting time\n");
 
     GetFileTime (hFileSrc, &srctime, NULL, NULL);
 
-#ifdef _DEBUG
-    DebugPrintf (_T("copy: flags has %s\n"),
+    TRACE ("copy: flags has %s\n",
         lpdwFlags & COPY_ASCII ? "ASCII" : "BINARY");
-#endif
 
     /* Check to see if /D or /Z are true, if so we need a middle
        man to copy the file too to allow us to use CopyFileEx later */
@@ -165,22 +159,16 @@
 
     if (!IsExistingFile (dest))
     {
-#ifdef _DEBUG
-        DebugPrintf (_T("opening/creating\n"));
-#endif
+        TRACE ("opening/creating\n");
         hFileDest =
             CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
     }
     else if (!append)
     {
-#ifdef _DEBUG
-        DebugPrintf (_T("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n"), dest);
-#endif
+        TRACE ("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n", dest);
         SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
 
-#ifdef _DEBUG
-        DebugPrintf (_T("DeleteFile (%s);\n"), dest);
-#endif
+        TRACE ("DeleteFile (%s);\n", dest);
         DeleteFile (dest);
 
         hFileDest =	CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
@@ -195,9 +183,7 @@
             return 0;
         }
 
-#ifdef _DEBUG
-        DebugPrintf (_T("opening/appending\n"));
-#endif
+        TRACE ("opening/appending\n");
         SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
 
         hFileDest =
@@ -258,18 +244,14 @@
     }
     while (!bEof);
 
-#ifdef _DEBUG
-    DebugPrintf (_T("setting time\n"));
-#endif
+    TRACE ("setting time\n");
     SetFileTime (hFileDest, &srctime, NULL, NULL);
 
     if ((lpdwFlags & COPY_ASCII) && !bEof)
     {
         /* we're dealing with ASCII files! */
         buffer[0] = 0x1A;
-#ifdef _DEBUG
-        DebugPrintf (_T("appending ^Z\n"));
-#endif
+        TRACE ("appending ^Z\n");
         WriteFile (hFileDest, buffer, sizeof(CHAR), &dwWritten, NULL);
     }
 
@@ -277,9 +259,7 @@
     CloseHandle (hFileDest);
     CloseHandle (hFileSrc);
 
-#ifdef _DEBUG
-    DebugPrintf (_T("setting mode\n"));
-#endif
+    TRACE ("setting mode\n");
     SetFileAttributes (dest, dwAttrib);
 
     /* Now finish off the copy if needed with CopyFileEx */

Modified: trunk/reactos/base/shell/cmd/date.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/date.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/date.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/date.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -226,9 +226,7 @@
 
 			PrintDateString ();
 			ConInString (s, 40);
-#ifdef _DEBUG
-			DebugPrintf (_T("\'%s\'\n"), s);
-#endif
+			TRACE ("\'%s\'\n", s);
 			while (*s && s[_tcslen (s) - 1] < _T(' '))
 				s[_tcslen (s) - 1] = _T('\0');
 			if (ParseDate (s))

Modified: trunk/reactos/base/shell/cmd/echo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/echo.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/echo.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/echo.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -34,9 +34,7 @@
 	TCHAR szMsg[RC_STRING_MAX_SIZE];
         LPTSTR p1, p2;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
-#endif
+	TRACE ("CommandEcho '%s' : '%s'\n", cmd, param);
 
         if (_tcsicmp (cmd, _T("echo.")) == 0)
 	{
@@ -112,9 +110,7 @@
 INT CommandEchos (LPTSTR cmd, LPTSTR param)
 {
 
-#ifdef _DEBUG
-	DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param);
-#endif
+	TRACE ("CommandEchos '%s' : '%s'\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{
@@ -132,9 +128,7 @@
 INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
 {
 
-#ifdef _DEBUG
-	DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param);
-#endif
+	TRACE ("CommandEchoerr '%s' : '%s'\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{
@@ -161,9 +155,7 @@
 INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
 {
 
-#ifdef _DEBUG
-	DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
-#endif
+	TRACE ("CommandEchoserr '%s' : '%s'\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{

Modified: trunk/reactos/base/shell/cmd/for.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/for.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/for.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/for.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -54,9 +54,7 @@
 	TCHAR  var;
 	TCHAR szMsg[RC_STRING_MAX_SIZE];
 
-#ifdef _DEBUG
-	DebugPrintf (_T("cmd_for (\'%s\', \'%s\'\n"), cmd, param);
-#endif
+	TRACE ("cmd_for (\'%s\', \'%s\'\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{

Modified: trunk/reactos/base/shell/cmd/goto.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/goto.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/goto.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/goto.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -42,9 +42,7 @@
 	LPTSTR tmp, tmp2;
 	LONG   lNewPosHigh = 0;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
-#endif
+	TRACE ("cmd_goto (\'%s\', \'%s\'\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{

Modified: trunk/reactos/base/shell/cmd/history.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/history.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/history.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/history.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -192,11 +192,9 @@
 {
 	if (item==NULL || item==Top || item==Bottom)
 	{
-#ifdef _DEBUG
-		DebugPrintf(_T("del in ") _T(__FILE__)  _T(": retrning\n")
-			    _T("item is 0x%08x (Bottom is0x%08x)\n"),
+		TRACE ("del in " __FILE__ ": returning\n"
+			    "item is 0x%08x (Bottom is0x%08x)\n",
 			    item, Bottom);
-#endif
 		return;
 	}
 

Modified: trunk/reactos/base/shell/cmd/if.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/if.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/if.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/if.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -41,9 +41,7 @@
 	INT x_flag = 0; /* when set cause 'then' clause to be executed */
 	LPTSTR pp;
 
-#ifdef _DEBUG
-	DebugPrintf (_T("cmd_if: (\'%s\', \'%s\')\n"), cmd, param);
-#endif
+	TRACE ("cmd_if: (\'%s\', \'%s\')\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{

Modified: trunk/reactos/base/shell/cmd/move.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/move.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/move.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/move.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -191,9 +191,7 @@
 	
 	/* get destination */
 	GetFullPathName (arg[argc - 1], MAX_PATH, szDestPath, NULL);
-#ifdef _DEBUG
-	DebugPrintf (_T("Destination: %s\n"), szDestPath);
-#endif
+	TRACE ("Destination: %s\n", szDestPath);
 	
 	/* get source folder */
 	GetDirectory(arg[argc - 2], szSrcDirPath, 1);
@@ -204,9 +202,7 @@
 	GetFullPathName(arg[argc - 2], MAX_PATH, szSrcPath, &pszFile);
 	if (_tcscmp(szSrcDirPath,szSrcPath) == 0)
 		szSrcDirPath[pszFile - szSrcPath] = _T('\0');
-#ifdef _DEBUG
-	DebugPrintf (_T("Source Folder: %s\n"), szSrcDirPath);
-#endif
+	TRACE ("Source Folder: %s\n", szSrcDirPath);
 	
 	hFile = FindFirstFile (arg[argc - 2], &findBuffer);
 	if (hFile == INVALID_HANDLE_VALUE)
@@ -239,9 +235,7 @@
 	if(szSrcPath[_tcslen(szSrcPath) -  1] != _T('\\'))
 		_tcscat (szSrcPath, _T("\\"));
 	_tcscat(szSrcPath,findBuffer.cFileName);
-#ifdef _DEBUG
-	DebugPrintf (_T("Source Path: %s\n"), szSrcPath);
-#endif
+	TRACE ("Source Path: %s\n", szSrcPath);
 	/* check if there can be found files as files have first priority */
 	if (IsExistingFile(szSrcPath)) dwMoveStatusFlags |= MOVE_SOURCE_IS_FILE;
 	else dwMoveStatusFlags |= MOVE_SOURCE_IS_DIR;
@@ -264,10 +258,8 @@
 	}
 	FindClose(hFile);
 
-#ifdef _DEBUG
-	DebugPrintf(_T("Do we have only one file: %s\n"), OnlyOneFile ? _T("TRUE") : _T("FALSE"));
-#endif
-	
+	TRACE ("Do we have only one file: %s\n", OnlyOneFile ? _T("TRUE") : _T("FALSE"));
+
 	/* we have to start again to be sure we don't miss any files or folders*/
 	hFile = FindFirstFile (arg[argc - 2], &findBuffer);
 	if (hFile == INVALID_HANDLE_VALUE)
@@ -301,9 +293,7 @@
 	/* move it */
 	do
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("Found file/directory: %s\n"), findBuffer.cFileName);
-#endif
+		TRACE ("Found file/directory: %s\n", findBuffer.cFileName);
 		nOverwrite = 1;
 		dwMoveFlags = 0;
 		dwMoveStatusFlags &= ~MOVE_DEST_IS_FILE &
@@ -325,9 +315,7 @@
 				dwMoveStatusFlags |= MOVE_SRC_CURRENT_IS_DIR; /* source is file but at the current round we found a directory */
 				continue;
 			}
-#ifdef _DEBUG
-			DebugPrintf (_T("Source is dir: %s\n"), szSrcPath);
-#endif
+			TRACE ("Source is dir: %s\n", szSrcPath);
 			dwMoveFlags = MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH | MOVEFILE_COPY_ALLOWED;
 		}
 		
@@ -336,9 +324,7 @@
 		if (IsExistingDirectory(szDestPath))
 		{
 			/* destination is existing directory */
-#ifdef _DEBUG
-			DebugPrintf (_T("Destination is directory: %s\n"), szDestPath);
-#endif
+			TRACE ("Destination is directory: %s\n", szDestPath);
 			
 			dwMoveStatusFlags |= MOVE_DEST_IS_DIR;
 			
@@ -358,9 +344,7 @@
 		if (IsExistingFile(szDestPath))
 		{
 			/* destination is a file */
-#ifdef _DEBUG
-			DebugPrintf (_T("Destination is file: %s\n"), szDestPath);
-#endif
+			TRACE ("Destination is file: %s\n", szDestPath);
 			
 			dwMoveStatusFlags |= MOVE_DEST_IS_FILE | MOVE_DEST_EXISTS;
 			_tcscpy (szFullDestPath, szDestPath);
@@ -369,9 +353,7 @@
 			
 		}
 		
-#ifdef _DEBUG
-		DebugPrintf(_T("Move Status Flags: 0x%X\n"),dwMoveStatusFlags);
-#endif
+		TRACE ("Move Status Flags: 0x%X\n",dwMoveStatusFlags);
 		
 		if (dwMoveStatusFlags & MOVE_SOURCE_IS_DIR &&
 			dwMoveStatusFlags & MOVE_DEST_IS_DIR &&

Modified: trunk/reactos/base/shell/cmd/msgbox.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/msgbox.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/msgbox.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/msgbox.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -130,8 +130,6 @@
 	prompt = param;
 
 	hWnd=GetConsoleWindow ();
-//	DebugPrintf("FindWindow hWnd = %d\n",hWnd);
-//	ConErrPrintf("FindWindow hWnd = %d\n",hWnd);
 
 	switch (MessageBox(hWnd, prompt, title, uType))
 	{

Modified: trunk/reactos/base/shell/cmd/pause.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/pause.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/pause.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/pause.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -37,9 +37,7 @@
 INT cmd_pause (LPTSTR cmd, LPTSTR param)
 {
 
-#ifdef _DEBUG
-	DebugPrintf (_T("cmd_pause: \'%s\' : \'%s\')\n"), cmd, param);
-#endif
+	TRACE ("cmd_pause: \'%s\' : \'%s\')\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{

Modified: trunk/reactos/base/shell/cmd/precomp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/precomp.h?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/precomp.h [iso-8859-1] Thu May 15 15:02:05 2008
@@ -36,4 +36,7 @@
 #include <reactos/buildno.h>
 #include <reactos/version.h>
 
+#include <wine/debug.h>
+WINE_DEFAULT_DEBUG_CHANNEL(cmd);
+
 #endif /* __CMD_PRECOMP_H */

Modified: trunk/reactos/base/shell/cmd/shift.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/shift.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/shift.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/shift.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -39,9 +39,7 @@
 INT cmd_shift (LPTSTR cmd, LPTSTR param)
 {
 
-#ifdef _DEBUG
-	DebugPrintf (_T("cmd_shift: (\'%s\', \'%s\')\n"), cmd, param);
-#endif
+	TRACE ("cmd_shift: (\'%s\', \'%s\')\n", cmd, param);
 
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{

Modified: trunk/reactos/base/shell/cmd/start.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/start.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/start.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/start.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -253,14 +253,10 @@
         szFullCmdLine[_tcslen(szFullCmdLine)] = _T('\"');
 	}
 
-#ifdef _DEBUG
-		DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
-#endif
-
-
-#ifdef _DEBUG
-		DebugPrintf (_T("[EXEC: %s %s]\n"), szFullName, rest);
-#endif
+		TRACE ("[BATCH: %s %s]\n", szFullName, rest);
+
+
+		TRACE ("[EXEC: %s %s]\n", szFullName, rest);
 		/* build command line for CreateProcess() */
 		if (bBat == FALSE)
 		{

Modified: trunk/reactos/base/shell/cmd/time.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/time.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/time.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/time.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -177,9 +177,7 @@
 
 			ConInString (s, 40);
 
-#ifdef _DEBUG
-			DebugPrintf (_T("\'%s\'\n"), s);
-#endif
+			TRACE ("\'%s\'\n", s);
 
 			while (*s && s[_tcslen (s) - 1] < _T(' '))
 				s[_tcslen(s) - 1] = _T('\0');

Modified: trunk/reactos/base/shell/cmd/timer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/timer.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/timer.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/timer.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -37,9 +37,7 @@
 	TCHAR szMsg[RC_STRING_MAX_SIZE];
 	DWORD h,m,s,ms;
 
-#ifdef _DEBUG
-	DebugPrintf(_T("PrintTime(%d,%d)"),time,format);
-#endif
+	TRACE ("PrintElapsedTime(%d,%d)",time,format);
 
 	switch (format)
 	{

Modified: trunk/reactos/base/shell/cmd/where.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/where.c?rev=33533&r1=33532&r2=33533&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/where.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/where.c [iso-8859-1] Thu May 15 15:02:05 2008
@@ -92,17 +92,13 @@
 	/* initialize full name buffer */
 	*pFullName = _T('\0');
 
-#ifdef _DEBUG
-	DebugPrintf (_T("SearchForExecutableSingle: \'%s\' with ext: \'%s\'\n"), pFileName, pExtension);
-#endif
+	TRACE ("SearchForExecutableSingle: \'%s\' with ext: \'%s\'\n", pFileName, pExtension);
 
 	/* Check if valid directly on specified path */
 	if (_tcschr (pFileName, _T('\\')) != NULL)
 	{
 		LPTSTR pFilePart;
-#ifdef _DEBUG
-		DebugPrintf (_T("Absolute or relative path is given.\n"));
-#endif
+		TRACE ("Absolute or relative path is given.\n");
 
 		if (GetFullPathName (pFileName,
 			             CMDLINE_LENGTH,
@@ -118,9 +114,7 @@
 
 		if (IsExistingFile (szPathBuffer))
 		{
-#ifdef _DEBUG
-			DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
-#endif
+			TRACE ("Found: \'%s\'\n", szPathBuffer);
 			_tcscpy (pFullName, szPathBuffer);
 			return TRUE;
 		}
@@ -141,9 +135,7 @@
 
 	if (IsExistingFile (szPathBuffer))
 	{
-#ifdef _DEBUG
-		DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
-#endif
+		TRACE ("Found: \'%s\'\n", szPathBuffer);
 		_tcscpy (pFullName, szPathBuffer);
 		return TRUE;
 	}
@@ -191,9 +183,7 @@
 
 		if (IsExistingFile (szPathBuffer))
 		{
-#ifdef _DEBUG
-			DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
-#endif
+			TRACE ("Found: \'%s\'\n", szPathBuffer);
 			cmd_free (pszBuffer);
 			_tcscpy (pFullName, szPathBuffer);
 			return TRUE;
@@ -212,9 +202,7 @@
 	LPTSTR pCh;
 	LPTSTR pExt;
 	DWORD  dwBuffer;
-#ifdef _DEBUG
-	DebugPrintf (_T("SearchForExecutable: \'%s\'\n"), pFileName);
-#endif
+	TRACE ("SearchForExecutable: \'%s\'\n", pFileName);
 	/* load environment varable PATHEXT */
 	pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
 	dwBuffer = GetEnvironmentVariable (_T("PATHEXT"), pszBuffer, ENV_BUFFER_SIZE);
@@ -228,9 +216,7 @@
 		_tcscpy(pszBuffer, pszDefaultPathExt);
 	}
 
-#ifdef _DEBUG
-	DebugPrintf (_T("SearchForExecutable(): Loaded PATHEXT: %s\n"), pszBuffer);
-#endif
+	TRACE ("SearchForExecutable(): Loaded PATHEXT: %s\n", pszBuffer);
 
 	pExt = _tcsrchr(pFileName, _T('.'));
 	if (pExt != NULL)



More information about the Ros-diffs mailing list