mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:53:37 +00:00
cmd: replace static traces by dynamic ones
svn path=/trunk/; revision=33533
This commit is contained in:
parent
bc59a11cc8
commit
2f9c333ded
23 changed files with 91 additions and 271 deletions
|
@ -85,9 +85,7 @@ LPTSTR FindArg (INT n)
|
||||||
{
|
{
|
||||||
LPTSTR pp;
|
LPTSTR pp;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("FindArg: (%d)\n", n);
|
||||||
DebugPrintf (_T("FindArg: (%d)\n"), n);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (bc == NULL)
|
if (bc == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -172,9 +170,7 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2)
|
||||||
|
|
||||||
VOID ExitBatch (LPTSTR msg)
|
VOID ExitBatch (LPTSTR msg)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("ExitBatch: (\'%s\')\n", msg);
|
||||||
DebugPrintf (_T("ExitBatch: (\'%s\')\n"), msg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (bc != NULL)
|
if (bc != NULL)
|
||||||
{
|
{
|
||||||
|
@ -226,10 +222,8 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
|
||||||
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n",
|
||||||
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),
|
|
||||||
fullname, firstword, param, hFile);
|
fullname, firstword, param, hFile);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -298,9 +292,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("Batch: returns TRUE\n");
|
||||||
DebugPrintf (_T("Batch: returns TRUE\n"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -339,9 +331,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
|
||||||
if (bc == NULL)
|
if (bc == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("ReadBatchLine ()\n");
|
||||||
DebugPrintf (_T("ReadBatchLine ()\n"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -435,9 +425,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
|
||||||
|
|
||||||
if (!FileGetString (bc->hBatchFile, textline, sizeof (textline) / sizeof (textline[0])))
|
if (!FileGetString (bc->hBatchFile, textline, sizeof (textline) / sizeof (textline[0])))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("ReadBatchLine(): Reached EOF!\n");
|
||||||
DebugPrintf (_T("ReadBatchLine(): Reached EOF!\n"));
|
|
||||||
#endif
|
|
||||||
/* End of file.... */
|
/* End of file.... */
|
||||||
ExitBatch (NULL);
|
ExitBatch (NULL);
|
||||||
|
|
||||||
|
@ -446,9 +434,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
TRACE ("ReadBatchLine(): textline: \'%s\'\n", textline);
|
||||||
DebugPrintf (_T("ReadBatchLine(): textline: \'%s\'\n"), textline);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Strip leading spaces and trailing space/control chars */
|
/* Strip leading spaces and trailing space/control chars */
|
||||||
for (first = textline; _istspace (*first); first++)
|
for (first = textline; _istspace (*first); first++)
|
||||||
|
|
|
@ -44,9 +44,7 @@ INT cmd_call (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
LPBATCH_CONTEXT n = NULL;
|
LPBATCH_CONTEXT n = NULL;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("cmd_call: (\'%s\',\'%s\')\n", cmd, param);
|
||||||
DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutResPaging(TRUE,STRING_CALL_HELP);
|
ConOutResPaging(TRUE,STRING_CALL_HELP);
|
||||||
|
|
|
@ -260,9 +260,7 @@ CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||||
}
|
}
|
||||||
|
|
||||||
freep (arg);
|
freep (arg);
|
||||||
#ifdef _DEBUG
|
TRACE ("ErrorLevel: %d\n", nErrorLevel);
|
||||||
DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
|
|
||||||
#endif /* _DEBUG */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,25 +273,19 @@ loop:
|
||||||
switch (GCret)
|
switch (GCret)
|
||||||
{
|
{
|
||||||
case GC_TIMEOUT:
|
case GC_TIMEOUT:
|
||||||
#ifdef _DEBUG
|
TRACE ("GC_TIMEOUT\n");
|
||||||
DebugPrintf (_T("GC_TIMEOUT\n"));
|
TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
|
||||||
DebugPrintf (_T("elapsed %d msecs\n"), GetTickCount () - clk);
|
|
||||||
#endif /* _DEBUG */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GC_NOKEY:
|
case GC_NOKEY:
|
||||||
#ifdef _DEBUG
|
TRACE ("GC_NOKEY\n");
|
||||||
DebugPrintf(_T("GC_NOKEY\n"));
|
TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
|
||||||
DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
|
|
||||||
#endif /* _DEBUG */
|
|
||||||
goto loop;
|
goto loop;
|
||||||
|
|
||||||
case GC_KEYREAD:
|
case GC_KEYREAD:
|
||||||
#ifdef _DEBUG
|
TRACE ("GC_KEYREAD\n");
|
||||||
DebugPrintf(_T("GC_KEYREAD\n"));
|
TRACE ("elapsed %d msecs\n", GetTickCount () - clk);
|
||||||
DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
|
TRACE ("read %c", Ch);
|
||||||
DebugPrintf(_T("read %c"), Ch);
|
|
||||||
#endif /* _DEBUG */
|
|
||||||
if ((val=IsKeyInString(lpOptions,Ch,bCaseSensitive))==-1)
|
if ((val=IsKeyInString(lpOptions,Ch,bCaseSensitive))==-1)
|
||||||
{
|
{
|
||||||
Beep (440, 50);
|
Beep (440, 50);
|
||||||
|
@ -303,10 +295,8 @@ loop:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("exiting wait loop after %d msecs\n",
|
||||||
DebugPrintf(_T("exiting wait loop after %d msecs\n"),
|
|
||||||
GetTickCount () - clk);
|
GetTickCount () - clk);
|
||||||
#endif /* _DEBUG */
|
|
||||||
|
|
||||||
val = IsKeyInString (lpOptions, cDefault, bCaseSensitive);
|
val = IsKeyInString (lpOptions, cDefault, bCaseSensitive);
|
||||||
ConOutPrintf (_T("%c\n"), lpOptions[val]);
|
ConOutPrintf (_T("%c\n"), lpOptions[val]);
|
||||||
|
@ -315,9 +305,7 @@ loop:
|
||||||
|
|
||||||
freep (arg);
|
freep (arg);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("ErrorLevel: %d\n", nErrorLevel);
|
||||||
DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
|
|
||||||
#endif /* _DEBUG */
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,9 +243,7 @@ static BOOL IsConsoleProcess(HANDLE Process)
|
||||||
&Info, sizeof(PROCESS_BASIC_INFORMATION), NULL);
|
&Info, sizeof(PROCESS_BASIC_INFORMATION), NULL);
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
WARN ("NtQueryInformationProcess failed with status %08x\n", Status);
|
||||||
DebugPrintf (_T("NtQueryInformationProcess failed with status %08x\n"), Status);
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
Status = NtReadVirtualMemoryPtr (
|
Status = NtReadVirtualMemoryPtr (
|
||||||
|
@ -253,9 +251,7 @@ static BOOL IsConsoleProcess(HANDLE Process)
|
||||||
sizeof(PEB), &BytesRead);
|
sizeof(PEB), &BytesRead);
|
||||||
if (! NT_SUCCESS(Status) || sizeof(PEB) != BytesRead)
|
if (! NT_SUCCESS(Status) || sizeof(PEB) != BytesRead)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
WARN ("Couldn't read virt mem status %08x bytes read %lu\n", Status, BytesRead);
|
||||||
DebugPrintf (_T("Couldn't read virt mem status %08x bytes read %lu\n"), Status, BytesRead);
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,37 +283,27 @@ static BOOL RunFile(LPTSTR filename)
|
||||||
MYEX hShExt;
|
MYEX hShExt;
|
||||||
HINSTANCE ret;
|
HINSTANCE ret;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("RunFile(%s)\n", filename);
|
||||||
DebugPrintf (_T("RunFile(%s)\n"), filename);
|
|
||||||
#endif
|
|
||||||
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
|
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
|
||||||
if (!hShell32)
|
if (!hShell32)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
WARN ("RunFile: couldn't load SHELL32.DLL!\n");
|
||||||
DebugPrintf (_T("RunFile: couldn't load SHELL32.DLL!\n"));
|
|
||||||
#endif
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hShExt = (MYEX)(FARPROC)GetProcAddress(hShell32, SHELLEXECUTETEXT);
|
hShExt = (MYEX)(FARPROC)GetProcAddress(hShell32, SHELLEXECUTETEXT);
|
||||||
if (!hShExt)
|
if (!hShExt)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
WARN ("RunFile: couldn't find ShellExecuteA/W in SHELL32.DLL!\n");
|
||||||
DebugPrintf (_T("RunFile: couldn't find ShellExecuteA/W in SHELL32.DLL!\n"));
|
|
||||||
#endif
|
|
||||||
FreeLibrary(hShell32);
|
FreeLibrary(hShell32);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("RunFile: ShellExecuteA/W is at %x\n", hShExt);
|
||||||
DebugPrintf (_T("RunFile: ShellExecuteA/W is at %x\n"), hShExt);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ret = (hShExt)(NULL, _T("open"), filename, NULL, NULL, SW_SHOWNORMAL);
|
ret = (hShExt)(NULL, _T("open"), filename, NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("RunFile: ShellExecuteA/W returned %d\n", (DWORD)ret);
|
||||||
DebugPrintf (_T("RunFile: ShellExecuteA/W returned %d\n"), (DWORD)ret);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FreeLibrary(hShell32);
|
FreeLibrary(hShell32);
|
||||||
return (((DWORD)ret) > 32);
|
return (((DWORD)ret) > 32);
|
||||||
|
@ -344,9 +330,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
||||||
TCHAR szWindowTitle[MAX_PATH];
|
TCHAR szWindowTitle[MAX_PATH];
|
||||||
DWORD dwExitCode = 0;
|
DWORD dwExitCode = 0;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("Execute: \'%s\' \'%s\'\n", first, rest);
|
||||||
DebugPrintf (_T("Execute: \'%s\' \'%s\'\n"), first, rest);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we need biger buffer that First, Rest, Full are already
|
/* we need biger buffer that First, Rest, Full are already
|
||||||
need rewrite some code to use cmd_realloc when it need instead
|
need rewrite some code to use cmd_realloc when it need instead
|
||||||
|
@ -481,9 +465,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
||||||
dot = _tcsrchr (szFullName, _T('.'));
|
dot = _tcsrchr (szFullName, _T('.'));
|
||||||
if (dot && (!_tcsicmp (dot, _T(".bat")) || !_tcsicmp (dot, _T(".cmd"))))
|
if (dot && (!_tcsicmp (dot, _T(".bat")) || !_tcsicmp (dot, _T(".cmd"))))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("[BATCH: %s %s]\n", szFullName, rest);
|
||||||
DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
|
|
||||||
#endif
|
|
||||||
Batch (szFullName, first, rest);
|
Batch (szFullName, first, rest);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -492,9 +474,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
||||||
PROCESS_INFORMATION prci;
|
PROCESS_INFORMATION prci;
|
||||||
STARTUPINFO stui;
|
STARTUPINFO stui;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("[EXEC: %s %s]\n", full, rest);
|
||||||
DebugPrintf (_T("[EXEC: %s %s]\n"), full, rest);
|
|
||||||
#endif
|
|
||||||
/* build command line for CreateProcess() */
|
/* build command line for CreateProcess() */
|
||||||
|
|
||||||
/* fill startup info */
|
/* fill startup info */
|
||||||
|
@ -542,15 +522,11 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("[ShellExecute: %s]\n", full);
|
||||||
DebugPrintf (_T("[ShellExecute: %s]\n"), full);
|
|
||||||
#endif
|
|
||||||
// See if we can run this with ShellExecute() ie myfile.xls
|
// See if we can run this with ShellExecute() ie myfile.xls
|
||||||
if (!RunFile(full))
|
if (!RunFile(full))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("[ShellExecute failed!: %s]\n", full);
|
||||||
DebugPrintf (_T("[ShellExecute failed!: %s]\n"), full);
|
|
||||||
#endif
|
|
||||||
error_bad_command ();
|
error_bad_command ();
|
||||||
nErrorLevel = 1;
|
nErrorLevel = 1;
|
||||||
}
|
}
|
||||||
|
@ -596,9 +572,7 @@ DoCommand (LPTSTR line)
|
||||||
INT cl;
|
INT cl;
|
||||||
LPCOMMAND cmdptr;
|
LPCOMMAND cmdptr;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("DoCommand: (\'%s\')\n", line);
|
||||||
DebugPrintf (_T("DoCommand: (\'%s\')\n"), line);
|
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
com = cmd_alloc( (_tcslen(line) +512)*sizeof(TCHAR) );
|
com = cmd_alloc( (_tcslen(line) +512)*sizeof(TCHAR) );
|
||||||
if (com == NULL)
|
if (com == NULL)
|
||||||
|
@ -733,9 +707,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
_tcscpy (cmdline, cmd);
|
_tcscpy (cmdline, cmd);
|
||||||
s = &cmdline[0];
|
s = &cmdline[0];
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("ParseCommandLine: (\'%s\')\n", s);
|
||||||
DebugPrintf (_T("ParseCommandLine: (\'%s\')\n"), s);
|
|
||||||
#endif /* DEBUG */
|
|
||||||
|
|
||||||
#ifdef FEATURE_ALIASES
|
#ifdef FEATURE_ALIASES
|
||||||
/* expand all aliases */
|
/* expand all aliases */
|
||||||
|
@ -821,9 +793,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
ConErrPrintf(szMsg, in);
|
ConErrPrintf(szMsg, in);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
TRACE ("Input redirected from: %s\n", in);
|
||||||
DebugPrintf (_T("Input redirected from: %s\n"), in);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now do all but the last pipe command */
|
/* Now do all but the last pipe command */
|
||||||
|
@ -943,9 +913,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
if (GetFileType (hFile) == FILE_TYPE_DISK)
|
if (GetFileType (hFile) == FILE_TYPE_DISK)
|
||||||
SetFilePointer (hFile, 0, &lHighPos, FILE_END);
|
SetFilePointer (hFile, 0, &lHighPos, FILE_END);
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
TRACE ("Output redirected to: %s\n", out);
|
||||||
DebugPrintf (_T("Output redirected to: %s\n"), out);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (hOldConOut != INVALID_HANDLE_VALUE)
|
else if (hOldConOut != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -966,9 +934,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
|
|
||||||
if (!_tcscmp (err, out))
|
if (!_tcscmp (err, out))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("Stdout and stderr will use the same file!!\n");
|
||||||
DebugPrintf (_T("Stdout and stderr will use the same file!!\n"));
|
|
||||||
#endif
|
|
||||||
DuplicateHandle (GetCurrentProcess (),
|
DuplicateHandle (GetCurrentProcess (),
|
||||||
GetStdHandle (STD_OUTPUT_HANDLE),
|
GetStdHandle (STD_OUTPUT_HANDLE),
|
||||||
GetCurrentProcess (),
|
GetCurrentProcess (),
|
||||||
|
@ -1005,9 +971,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
if (GetFileType (hFile) == FILE_TYPE_DISK)
|
if (GetFileType (hFile) == FILE_TYPE_DISK)
|
||||||
SetFilePointer (hFile, 0, &lHighPos, FILE_END);
|
SetFilePointer (hFile, 0, &lHighPos, FILE_END);
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
TRACE ("Error redirected to: %s\n", err);
|
||||||
DebugPrintf (_T("Error redirected to: %s\n"), err);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (hOldConErr != INVALID_HANDLE_VALUE)
|
else if (hOldConErr != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -1053,9 +1017,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
WARN ("Can't restore STDIN! Is invalid!!\n", out);
|
||||||
DebugPrintf (_T("Can't restore STDIN! Is invalid!!\n"), out);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif /* buggy implementation */
|
#endif /* buggy implementation */
|
||||||
|
|
||||||
|
@ -1066,9 +1028,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
|
SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
|
||||||
if (hIn == INVALID_HANDLE_VALUE)
|
if (hIn == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
WARN ("Previous STDIN is invalid!!\n");
|
||||||
DebugPrintf (_T("Previous STDIN is invalid!!\n"));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1083,9 +1043,7 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
WARN ("hFile[0] and hIn dont match!!!\n");
|
||||||
DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1725,14 +1683,12 @@ Initialize (int argc, const TCHAR* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("[command args:\n");
|
||||||
DebugPrintf (_T("[command args:\n"));
|
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
DebugPrintf (_T("%d. %s\n"), i, argv[i]);
|
TRACE ("%d. %s\n", i, argv[i]);
|
||||||
}
|
}
|
||||||
DebugPrintf (_T("]\n"));
|
TRACE ("]\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
InitLocale ();
|
InitLocale ();
|
||||||
|
|
||||||
|
|
|
@ -134,12 +134,6 @@ LPCTSTR GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA );
|
||||||
VOID SetScreenColor(WORD wArgColor, BOOL bFill);
|
VOID SetScreenColor(WORD wArgColor, BOOL bFill);
|
||||||
INT CommandColor (LPTSTR, LPTSTR);
|
INT CommandColor (LPTSTR, LPTSTR);
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes for CONSOLE.C */
|
|
||||||
#ifdef _DEBUG
|
|
||||||
VOID DebugPrintf (LPTSTR, ...);
|
|
||||||
#endif /* _DEBUG */
|
|
||||||
|
|
||||||
VOID ConInDummy (VOID);
|
VOID ConInDummy (VOID);
|
||||||
VOID ConInDisable (VOID);
|
VOID ConInDisable (VOID);
|
||||||
VOID ConInEnable (VOID);
|
VOID ConInEnable (VOID);
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
<define name="ANONYMOUSUNIONS" />
|
<define name="ANONYMOUSUNIONS" />
|
||||||
<define name="_WIN32_WINNT">0x0501</define>
|
<define name="_WIN32_WINNT">0x0501</define>
|
||||||
<library>cmd_base</library>
|
<library>cmd_base</library>
|
||||||
|
<library>wine</library>
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>shell32</library>
|
<library>shell32</library>
|
||||||
|
|
|
@ -55,10 +55,8 @@ VOID ConInDummy (VOID)
|
||||||
INPUT_RECORD dummy;
|
INPUT_RECORD dummy;
|
||||||
DWORD dwRead;
|
DWORD dwRead;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
if (hInput == INVALID_HANDLE_VALUE)
|
if (hInput == INVALID_HANDLE_VALUE)
|
||||||
DebugPrintf (_T("Invalid input handle!!!\n"));
|
WARN ("Invalid input handle!!!\n");
|
||||||
#endif /* _DEBUG */
|
|
||||||
ReadConsoleInput (hInput, &dummy, 1, &dwRead);
|
ReadConsoleInput (hInput, &dummy, 1, &dwRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,10 +71,8 @@ VOID ConInKey (PINPUT_RECORD lpBuffer)
|
||||||
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
|
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
|
||||||
DWORD dwRead;
|
DWORD dwRead;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
if (hInput == INVALID_HANDLE_VALUE)
|
if (hInput == INVALID_HANDLE_VALUE)
|
||||||
DebugPrintf (_T("Invalid input handle!!!\n"));
|
WARN ("Invalid input handle!!!\n");
|
||||||
#endif /* _DEBUG */
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -431,24 +427,6 @@ VOID ConErrPrintf (LPTSTR szFormat, ...)
|
||||||
va_end (arg_ptr);
|
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)
|
VOID SetCursorXY (SHORT x, SHORT y)
|
||||||
{
|
{
|
||||||
COORD coPos;
|
COORD coPos;
|
||||||
|
|
|
@ -72,9 +72,7 @@ copy (TCHAR source[MAX_PATH],
|
||||||
if(CheckCtrlBreak(BREAK_INPUT))
|
if(CheckCtrlBreak(BREAK_INPUT))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("checking mode\n");
|
||||||
DebugPrintf (_T("checking mode\n"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(bTouch)
|
if(bTouch)
|
||||||
{
|
{
|
||||||
|
@ -116,16 +114,12 @@ copy (TCHAR source[MAX_PATH],
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("getting time\n");
|
||||||
DebugPrintf (_T("getting time\n"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GetFileTime (hFileSrc, &srctime, NULL, NULL);
|
GetFileTime (hFileSrc, &srctime, NULL, NULL);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("copy: flags has %s\n",
|
||||||
DebugPrintf (_T("copy: flags has %s\n"),
|
|
||||||
lpdwFlags & COPY_ASCII ? "ASCII" : "BINARY");
|
lpdwFlags & COPY_ASCII ? "ASCII" : "BINARY");
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check to see if /D or /Z are true, if so we need a middle
|
/* 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 */
|
man to copy the file too to allow us to use CopyFileEx later */
|
||||||
|
@ -165,22 +159,16 @@ copy (TCHAR source[MAX_PATH],
|
||||||
|
|
||||||
if (!IsExistingFile (dest))
|
if (!IsExistingFile (dest))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("opening/creating\n");
|
||||||
DebugPrintf (_T("opening/creating\n"));
|
|
||||||
#endif
|
|
||||||
hFileDest =
|
hFileDest =
|
||||||
CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
}
|
}
|
||||||
else if (!append)
|
else if (!append)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n", dest);
|
||||||
DebugPrintf (_T("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n"), dest);
|
|
||||||
#endif
|
|
||||||
SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
|
SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("DeleteFile (%s);\n", dest);
|
||||||
DebugPrintf (_T("DeleteFile (%s);\n"), dest);
|
|
||||||
#endif
|
|
||||||
DeleteFile (dest);
|
DeleteFile (dest);
|
||||||
|
|
||||||
hFileDest = CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
hFileDest = CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
|
@ -195,9 +183,7 @@ copy (TCHAR source[MAX_PATH],
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("opening/appending\n");
|
||||||
DebugPrintf (_T("opening/appending\n"));
|
|
||||||
#endif
|
|
||||||
SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
|
SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
|
||||||
|
|
||||||
hFileDest =
|
hFileDest =
|
||||||
|
@ -258,18 +244,14 @@ copy (TCHAR source[MAX_PATH],
|
||||||
}
|
}
|
||||||
while (!bEof);
|
while (!bEof);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("setting time\n");
|
||||||
DebugPrintf (_T("setting time\n"));
|
|
||||||
#endif
|
|
||||||
SetFileTime (hFileDest, &srctime, NULL, NULL);
|
SetFileTime (hFileDest, &srctime, NULL, NULL);
|
||||||
|
|
||||||
if ((lpdwFlags & COPY_ASCII) && !bEof)
|
if ((lpdwFlags & COPY_ASCII) && !bEof)
|
||||||
{
|
{
|
||||||
/* we're dealing with ASCII files! */
|
/* we're dealing with ASCII files! */
|
||||||
buffer[0] = 0x1A;
|
buffer[0] = 0x1A;
|
||||||
#ifdef _DEBUG
|
TRACE ("appending ^Z\n");
|
||||||
DebugPrintf (_T("appending ^Z\n"));
|
|
||||||
#endif
|
|
||||||
WriteFile (hFileDest, buffer, sizeof(CHAR), &dwWritten, NULL);
|
WriteFile (hFileDest, buffer, sizeof(CHAR), &dwWritten, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,9 +259,7 @@ copy (TCHAR source[MAX_PATH],
|
||||||
CloseHandle (hFileDest);
|
CloseHandle (hFileDest);
|
||||||
CloseHandle (hFileSrc);
|
CloseHandle (hFileSrc);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("setting mode\n");
|
||||||
DebugPrintf (_T("setting mode\n"));
|
|
||||||
#endif
|
|
||||||
SetFileAttributes (dest, dwAttrib);
|
SetFileAttributes (dest, dwAttrib);
|
||||||
|
|
||||||
/* Now finish off the copy if needed with CopyFileEx */
|
/* Now finish off the copy if needed with CopyFileEx */
|
||||||
|
|
|
@ -226,9 +226,7 @@ INT cmd_date (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
PrintDateString ();
|
PrintDateString ();
|
||||||
ConInString (s, 40);
|
ConInString (s, 40);
|
||||||
#ifdef _DEBUG
|
TRACE ("\'%s\'\n", s);
|
||||||
DebugPrintf (_T("\'%s\'\n"), s);
|
|
||||||
#endif
|
|
||||||
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
||||||
s[_tcslen (s) - 1] = _T('\0');
|
s[_tcslen (s) - 1] = _T('\0');
|
||||||
if (ParseDate (s))
|
if (ParseDate (s))
|
||||||
|
|
|
@ -34,9 +34,7 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
||||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
LPTSTR p1, p2;
|
LPTSTR p1, p2;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("CommandEcho '%s' : '%s'\n", cmd, param);
|
||||||
DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_tcsicmp (cmd, _T("echo.")) == 0)
|
if (_tcsicmp (cmd, _T("echo.")) == 0)
|
||||||
{
|
{
|
||||||
|
@ -112,9 +110,7 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
||||||
INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("CommandEchos '%s' : '%s'\n", cmd, param);
|
||||||
DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
@ -132,9 +128,7 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
||||||
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("CommandEchoerr '%s' : '%s'\n", cmd, param);
|
||||||
DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
@ -161,9 +155,7 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
||||||
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("CommandEchoserr '%s' : '%s'\n", cmd, param);
|
||||||
DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,9 +54,7 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
|
||||||
TCHAR var;
|
TCHAR var;
|
||||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("cmd_for (\'%s\', \'%s\'\n", cmd, param);
|
||||||
DebugPrintf (_T("cmd_for (\'%s\', \'%s\'\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,9 +42,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
|
||||||
LPTSTR tmp, tmp2;
|
LPTSTR tmp, tmp2;
|
||||||
LONG lNewPosHigh = 0;
|
LONG lNewPosHigh = 0;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("cmd_goto (\'%s\', \'%s\'\n", cmd, param);
|
||||||
DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -192,11 +192,9 @@ VOID del(LPHIST_ENTRY item)
|
||||||
{
|
{
|
||||||
if (item==NULL || item==Top || item==Bottom)
|
if (item==NULL || item==Top || item==Bottom)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("del in " __FILE__ ": returning\n"
|
||||||
DebugPrintf(_T("del in ") _T(__FILE__) _T(": retrning\n")
|
"item is 0x%08x (Bottom is0x%08x)\n",
|
||||||
_T("item is 0x%08x (Bottom is0x%08x)\n"),
|
|
||||||
item, Bottom);
|
item, Bottom);
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,7 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
|
||||||
INT x_flag = 0; /* when set cause 'then' clause to be executed */
|
INT x_flag = 0; /* when set cause 'then' clause to be executed */
|
||||||
LPTSTR pp;
|
LPTSTR pp;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("cmd_if: (\'%s\', \'%s\')\n", cmd, param);
|
||||||
DebugPrintf (_T("cmd_if: (\'%s\', \'%s\')\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,9 +191,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
/* get destination */
|
/* get destination */
|
||||||
GetFullPathName (arg[argc - 1], MAX_PATH, szDestPath, NULL);
|
GetFullPathName (arg[argc - 1], MAX_PATH, szDestPath, NULL);
|
||||||
#ifdef _DEBUG
|
TRACE ("Destination: %s\n", szDestPath);
|
||||||
DebugPrintf (_T("Destination: %s\n"), szDestPath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* get source folder */
|
/* get source folder */
|
||||||
GetDirectory(arg[argc - 2], szSrcDirPath, 1);
|
GetDirectory(arg[argc - 2], szSrcDirPath, 1);
|
||||||
|
@ -204,9 +202,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
GetFullPathName(arg[argc - 2], MAX_PATH, szSrcPath, &pszFile);
|
GetFullPathName(arg[argc - 2], MAX_PATH, szSrcPath, &pszFile);
|
||||||
if (_tcscmp(szSrcDirPath,szSrcPath) == 0)
|
if (_tcscmp(szSrcDirPath,szSrcPath) == 0)
|
||||||
szSrcDirPath[pszFile - szSrcPath] = _T('\0');
|
szSrcDirPath[pszFile - szSrcPath] = _T('\0');
|
||||||
#ifdef _DEBUG
|
TRACE ("Source Folder: %s\n", szSrcDirPath);
|
||||||
DebugPrintf (_T("Source Folder: %s\n"), szSrcDirPath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hFile = FindFirstFile (arg[argc - 2], &findBuffer);
|
hFile = FindFirstFile (arg[argc - 2], &findBuffer);
|
||||||
if (hFile == INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
|
@ -239,9 +235,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
if(szSrcPath[_tcslen(szSrcPath) - 1] != _T('\\'))
|
if(szSrcPath[_tcslen(szSrcPath) - 1] != _T('\\'))
|
||||||
_tcscat (szSrcPath, _T("\\"));
|
_tcscat (szSrcPath, _T("\\"));
|
||||||
_tcscat(szSrcPath,findBuffer.cFileName);
|
_tcscat(szSrcPath,findBuffer.cFileName);
|
||||||
#ifdef _DEBUG
|
TRACE ("Source Path: %s\n", szSrcPath);
|
||||||
DebugPrintf (_T("Source Path: %s\n"), szSrcPath);
|
|
||||||
#endif
|
|
||||||
/* check if there can be found files as files have first priority */
|
/* check if there can be found files as files have first priority */
|
||||||
if (IsExistingFile(szSrcPath)) dwMoveStatusFlags |= MOVE_SOURCE_IS_FILE;
|
if (IsExistingFile(szSrcPath)) dwMoveStatusFlags |= MOVE_SOURCE_IS_FILE;
|
||||||
else dwMoveStatusFlags |= MOVE_SOURCE_IS_DIR;
|
else dwMoveStatusFlags |= MOVE_SOURCE_IS_DIR;
|
||||||
|
@ -264,9 +258,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
}
|
}
|
||||||
FindClose(hFile);
|
FindClose(hFile);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("Do we have only one file: %s\n", OnlyOneFile ? _T("TRUE") : _T("FALSE"));
|
||||||
DebugPrintf(_T("Do we have only one file: %s\n"), OnlyOneFile ? _T("TRUE") : _T("FALSE"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we have to start again to be sure we don't miss any files or folders*/
|
/* we have to start again to be sure we don't miss any files or folders*/
|
||||||
hFile = FindFirstFile (arg[argc - 2], &findBuffer);
|
hFile = FindFirstFile (arg[argc - 2], &findBuffer);
|
||||||
|
@ -301,9 +293,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
/* move it */
|
/* move it */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("Found file/directory: %s\n", findBuffer.cFileName);
|
||||||
DebugPrintf (_T("Found file/directory: %s\n"), findBuffer.cFileName);
|
|
||||||
#endif
|
|
||||||
nOverwrite = 1;
|
nOverwrite = 1;
|
||||||
dwMoveFlags = 0;
|
dwMoveFlags = 0;
|
||||||
dwMoveStatusFlags &= ~MOVE_DEST_IS_FILE &
|
dwMoveStatusFlags &= ~MOVE_DEST_IS_FILE &
|
||||||
|
@ -325,9 +315,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
dwMoveStatusFlags |= MOVE_SRC_CURRENT_IS_DIR; /* source is file but at the current round we found a directory */
|
dwMoveStatusFlags |= MOVE_SRC_CURRENT_IS_DIR; /* source is file but at the current round we found a directory */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
TRACE ("Source is dir: %s\n", szSrcPath);
|
||||||
DebugPrintf (_T("Source is dir: %s\n"), szSrcPath);
|
|
||||||
#endif
|
|
||||||
dwMoveFlags = MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH | MOVEFILE_COPY_ALLOWED;
|
dwMoveFlags = MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH | MOVEFILE_COPY_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,9 +324,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
if (IsExistingDirectory(szDestPath))
|
if (IsExistingDirectory(szDestPath))
|
||||||
{
|
{
|
||||||
/* destination is existing directory */
|
/* destination is existing directory */
|
||||||
#ifdef _DEBUG
|
TRACE ("Destination is directory: %s\n", szDestPath);
|
||||||
DebugPrintf (_T("Destination is directory: %s\n"), szDestPath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dwMoveStatusFlags |= MOVE_DEST_IS_DIR;
|
dwMoveStatusFlags |= MOVE_DEST_IS_DIR;
|
||||||
|
|
||||||
|
@ -358,9 +344,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
if (IsExistingFile(szDestPath))
|
if (IsExistingFile(szDestPath))
|
||||||
{
|
{
|
||||||
/* destination is a file */
|
/* destination is a file */
|
||||||
#ifdef _DEBUG
|
TRACE ("Destination is file: %s\n", szDestPath);
|
||||||
DebugPrintf (_T("Destination is file: %s\n"), szDestPath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dwMoveStatusFlags |= MOVE_DEST_IS_FILE | MOVE_DEST_EXISTS;
|
dwMoveStatusFlags |= MOVE_DEST_IS_FILE | MOVE_DEST_EXISTS;
|
||||||
_tcscpy (szFullDestPath, szDestPath);
|
_tcscpy (szFullDestPath, szDestPath);
|
||||||
|
@ -369,9 +353,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("Move Status Flags: 0x%X\n",dwMoveStatusFlags);
|
||||||
DebugPrintf(_T("Move Status Flags: 0x%X\n"),dwMoveStatusFlags);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (dwMoveStatusFlags & MOVE_SOURCE_IS_DIR &&
|
if (dwMoveStatusFlags & MOVE_SOURCE_IS_DIR &&
|
||||||
dwMoveStatusFlags & MOVE_DEST_IS_DIR &&
|
dwMoveStatusFlags & MOVE_DEST_IS_DIR &&
|
||||||
|
|
|
@ -130,8 +130,6 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param)
|
||||||
prompt = param;
|
prompt = param;
|
||||||
|
|
||||||
hWnd=GetConsoleWindow ();
|
hWnd=GetConsoleWindow ();
|
||||||
// DebugPrintf("FindWindow hWnd = %d\n",hWnd);
|
|
||||||
// ConErrPrintf("FindWindow hWnd = %d\n",hWnd);
|
|
||||||
|
|
||||||
switch (MessageBox(hWnd, prompt, title, uType))
|
switch (MessageBox(hWnd, prompt, title, uType))
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,9 +37,7 @@
|
||||||
INT cmd_pause (LPTSTR cmd, LPTSTR param)
|
INT cmd_pause (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("cmd_pause: \'%s\' : \'%s\')\n", cmd, param);
|
||||||
DebugPrintf (_T("cmd_pause: \'%s\' : \'%s\')\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,4 +36,7 @@
|
||||||
#include <reactos/buildno.h>
|
#include <reactos/buildno.h>
|
||||||
#include <reactos/version.h>
|
#include <reactos/version.h>
|
||||||
|
|
||||||
|
#include <wine/debug.h>
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(cmd);
|
||||||
|
|
||||||
#endif /* __CMD_PRECOMP_H */
|
#endif /* __CMD_PRECOMP_H */
|
||||||
|
|
|
@ -39,9 +39,7 @@
|
||||||
INT cmd_shift (LPTSTR cmd, LPTSTR param)
|
INT cmd_shift (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("cmd_shift: (\'%s\', \'%s\')\n", cmd, param);
|
||||||
DebugPrintf (_T("cmd_shift: (\'%s\', \'%s\')\n"), cmd, param);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -253,14 +253,10 @@ INT cmd_start (LPTSTR First, LPTSTR Rest)
|
||||||
szFullCmdLine[_tcslen(szFullCmdLine)] = _T('\"');
|
szFullCmdLine[_tcslen(szFullCmdLine)] = _T('\"');
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("[BATCH: %s %s]\n", szFullName, rest);
|
||||||
DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("[EXEC: %s %s]\n", szFullName, rest);
|
||||||
DebugPrintf (_T("[EXEC: %s %s]\n"), szFullName, rest);
|
|
||||||
#endif
|
|
||||||
/* build command line for CreateProcess() */
|
/* build command line for CreateProcess() */
|
||||||
if (bBat == FALSE)
|
if (bBat == FALSE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,9 +177,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
ConInString (s, 40);
|
ConInString (s, 40);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("\'%s\'\n", s);
|
||||||
DebugPrintf (_T("\'%s\'\n"), s);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
||||||
s[_tcslen(s) - 1] = _T('\0');
|
s[_tcslen(s) - 1] = _T('\0');
|
||||||
|
|
|
@ -37,9 +37,7 @@ PrintElapsedTime (DWORD time,INT format)
|
||||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||||
DWORD h,m,s,ms;
|
DWORD h,m,s,ms;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("PrintElapsedTime(%d,%d)",time,format);
|
||||||
DebugPrintf(_T("PrintTime(%d,%d)"),time,format);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,17 +92,13 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
||||||
/* initialize full name buffer */
|
/* initialize full name buffer */
|
||||||
*pFullName = _T('\0');
|
*pFullName = _T('\0');
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("SearchForExecutableSingle: \'%s\' with ext: \'%s\'\n", pFileName, pExtension);
|
||||||
DebugPrintf (_T("SearchForExecutableSingle: \'%s\' with ext: \'%s\'\n"), pFileName, pExtension);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Check if valid directly on specified path */
|
/* Check if valid directly on specified path */
|
||||||
if (_tcschr (pFileName, _T('\\')) != NULL)
|
if (_tcschr (pFileName, _T('\\')) != NULL)
|
||||||
{
|
{
|
||||||
LPTSTR pFilePart;
|
LPTSTR pFilePart;
|
||||||
#ifdef _DEBUG
|
TRACE ("Absolute or relative path is given.\n");
|
||||||
DebugPrintf (_T("Absolute or relative path is given.\n"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (GetFullPathName (pFileName,
|
if (GetFullPathName (pFileName,
|
||||||
CMDLINE_LENGTH,
|
CMDLINE_LENGTH,
|
||||||
|
@ -118,9 +114,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
||||||
|
|
||||||
if (IsExistingFile (szPathBuffer))
|
if (IsExistingFile (szPathBuffer))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("Found: \'%s\'\n", szPathBuffer);
|
||||||
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
|
|
||||||
#endif
|
|
||||||
_tcscpy (pFullName, szPathBuffer);
|
_tcscpy (pFullName, szPathBuffer);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -141,9 +135,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
||||||
|
|
||||||
if (IsExistingFile (szPathBuffer))
|
if (IsExistingFile (szPathBuffer))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("Found: \'%s\'\n", szPathBuffer);
|
||||||
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
|
|
||||||
#endif
|
|
||||||
_tcscpy (pFullName, szPathBuffer);
|
_tcscpy (pFullName, szPathBuffer);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -191,9 +183,7 @@ SearchForExecutableSingle (LPCTSTR pFileName, LPTSTR pFullName, LPTSTR pExtensio
|
||||||
|
|
||||||
if (IsExistingFile (szPathBuffer))
|
if (IsExistingFile (szPathBuffer))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
TRACE ("Found: \'%s\'\n", szPathBuffer);
|
||||||
DebugPrintf (_T("Found: \'%s\'\n"), szPathBuffer);
|
|
||||||
#endif
|
|
||||||
cmd_free (pszBuffer);
|
cmd_free (pszBuffer);
|
||||||
_tcscpy (pFullName, szPathBuffer);
|
_tcscpy (pFullName, szPathBuffer);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -212,9 +202,7 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
||||||
LPTSTR pCh;
|
LPTSTR pCh;
|
||||||
LPTSTR pExt;
|
LPTSTR pExt;
|
||||||
DWORD dwBuffer;
|
DWORD dwBuffer;
|
||||||
#ifdef _DEBUG
|
TRACE ("SearchForExecutable: \'%s\'\n", pFileName);
|
||||||
DebugPrintf (_T("SearchForExecutable: \'%s\'\n"), pFileName);
|
|
||||||
#endif
|
|
||||||
/* load environment varable PATHEXT */
|
/* load environment varable PATHEXT */
|
||||||
pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
|
pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
|
||||||
dwBuffer = GetEnvironmentVariable (_T("PATHEXT"), pszBuffer, ENV_BUFFER_SIZE);
|
dwBuffer = GetEnvironmentVariable (_T("PATHEXT"), pszBuffer, ENV_BUFFER_SIZE);
|
||||||
|
@ -228,9 +216,7 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
|
||||||
_tcscpy(pszBuffer, pszDefaultPathExt);
|
_tcscpy(pszBuffer, pszDefaultPathExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
TRACE ("SearchForExecutable(): Loaded PATHEXT: %s\n", pszBuffer);
|
||||||
DebugPrintf (_T("SearchForExecutable(): Loaded PATHEXT: %s\n"), pszBuffer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pExt = _tcsrchr(pFileName, _T('.'));
|
pExt = _tcsrchr(pFileName, _T('.'));
|
||||||
if (pExt != NULL)
|
if (pExt != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue