fixed pipe working again from cmd

more investigate are need it to figout who to really solv bat and pipe and gui apps issue
so none regress and working fine in all case. rember gui apps can resive pipe from cmd or send to cmd 
 

svn path=/trunk/; revision=33014
This commit is contained in:
Magnus Olsen 2008-04-18 00:56:01 +00:00
parent 36b92644a0
commit 21a34d3ba5

View file

@ -810,18 +810,9 @@ VOID ParseCommandLine (LPTSTR cmd)
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
if (bc)
{
/* will fail for windows gui apps */
num = 0;
bc->hBatchFile = INVALID_HANDLE_VALUE;
}
else
{
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
ConErrPrintf(szMsg, in);
return;
}
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
ConErrPrintf(szMsg, in);
return;
}
if (!SetStdHandle (STD_INPUT_HANDLE, hFile))
@ -900,7 +891,7 @@ VOID ParseCommandLine (LPTSTR cmd)
/* Now set up the end conditions... */
/* redirect STDOUT */
if ((bc) && (bc->hBatchFile != INVALID_HANDLE_VALUE) && (out[0]))
if (out[0])
{
/* Final output to here */
HANDLE hFile;
@ -967,7 +958,7 @@ VOID ParseCommandLine (LPTSTR cmd)
}
/* redirect STDERR */
if ((bc) && (bc->hBatchFile != INVALID_HANDLE_VALUE) && (err[0]))
if (err[0])
{
/* Final output to here */
HANDLE hFile;
@ -1173,23 +1164,15 @@ GetEnvVarOrSpecial ( LPCTSTR varName )
if (position)
{
position += 2;
if (_tcschr(position, _T(',')) != NULL)
Token = _tcstok(position, _T(","));
while ((Token != NULL) && (i < 2))
{
Token = _tcstok(position, _T(","));
while ((Token != NULL) && (i < 2))
{
StringPart[i] = _ttoi(Token);
i++;
Token = _tcstok (NULL, _T(","));
}
if (i > 0)
{
if (StringPart[1] < 0)
StringPart[1] = _tcslen(ret + StringPart[0]) + StringPart[1];
_tcsncpy(ReturnValue, ret + StringPart[0], StringPart[1]);
_tcscpy(ret, ReturnValue);
}
StringPart[i] = _ttoi(Token);
i++;
Token = _tcstok (NULL, _T(","));
}
_tcsncpy(ReturnValue, ret + StringPart[0], StringPart[1]);
_tcscpy(ret, ReturnValue);
return ret;
}
else