mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
std_output does handle the : as ms does at pipe and we have also extend it to handle >test.txt: that is not vaild on ms but it should need more code to handle the : as ms does. we can call it reactos extend at cmd
svn path=/trunk/; revision=16564
This commit is contained in:
parent
a292f28ef5
commit
98d6ba9ebf
1 changed files with 37 additions and 10 deletions
|
@ -641,6 +641,10 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
HANDLE hFile;
|
||||
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
||||
|
||||
/* we need make sure the LastError msg is zero before calling CreateFile */
|
||||
SetLastError(0);
|
||||
|
||||
/* Set up pipe for the standard input handler */
|
||||
hFile = CreateFile (in, GENERIC_READ, FILE_SHARE_READ, &sa, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
|
@ -669,8 +673,6 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
{
|
||||
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
||||
|
||||
|
||||
|
||||
/* Create unique temporary file name */
|
||||
GetTempFileName (szTempPath, _T("CMD"), 0, szFileName[1]);
|
||||
|
||||
|
@ -715,6 +717,9 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
_tcscpy (szFileName[0], szFileName[1]);
|
||||
*szFileName[1] = _T('\0');
|
||||
|
||||
/* we need make sure the LastError msg is zero before calling CreateFile */
|
||||
SetLastError(0);
|
||||
|
||||
/* open new stdin file */
|
||||
hFile[0] = CreateFile (szFileName[0], GENERIC_READ, 0, &sa,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL);
|
||||
|
@ -731,14 +736,36 @@ VOID ParseCommandLine (LPTSTR cmd)
|
|||
HANDLE hFile;
|
||||
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
||||
|
||||
hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_READ, &sa,
|
||||
/* we need make sure the LastError msg is zero before calling CreateFile */
|
||||
SetLastError(0);
|
||||
|
||||
hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_READ, &sa,
|
||||
(nRedirFlags & OUTPUT_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, out);
|
||||
return;
|
||||
INT size = _tcslen(out)-1;
|
||||
|
||||
if (out[size] != _T(':'))
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, out);
|
||||
return;
|
||||
}
|
||||
|
||||
out[size]=_T('\0');
|
||||
hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_READ, &sa,
|
||||
(nRedirFlags & OUTPUT_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
|
||||
ConErrPrintf(szMsg, out);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!SetStdHandle (STD_OUTPUT_HANDLE, hFile))
|
||||
|
|
Loading…
Reference in a new issue