mirror of
https://github.com/reactos/reactos.git
synced 2026-07-02 15:34:39 +08:00
- Improve performance of TYPE command by reading more than 1 byte at a time. (Bug 4057)
- Also allow it to be interrupted by ^C. svn path=/trunk/; revision=39628
This commit is contained in:
@@ -35,7 +35,7 @@ INT cmd_type (LPTSTR param)
|
||||
{
|
||||
TCHAR buff[256];
|
||||
HANDLE hFile, hConsoleOut;
|
||||
BOOL bRet;
|
||||
DWORD dwRet;
|
||||
INT argc,i;
|
||||
LPTSTR *argv;
|
||||
LPTSTR errmsg;
|
||||
@@ -99,28 +99,34 @@ INT cmd_type (LPTSTR param)
|
||||
continue;
|
||||
}
|
||||
|
||||
do
|
||||
if (bPaging)
|
||||
{
|
||||
bRet = FileGetString (hFile, buff, sizeof(buff) / sizeof(TCHAR));
|
||||
if(bPaging)
|
||||
while (FileGetString (hFile, buff, sizeof(buff) / sizeof(TCHAR)))
|
||||
{
|
||||
if(bRet)
|
||||
if (ConOutPrintfPaging(bFirstTime, _T("%s"), buff) == 1)
|
||||
{
|
||||
if (ConOutPrintfPaging(bFirstTime, _T("%s"), buff) == 1)
|
||||
{
|
||||
bCtrlBreak = FALSE;
|
||||
return 0;
|
||||
}
|
||||
bCtrlBreak = FALSE;
|
||||
CloseHandle(hFile);
|
||||
freep(argv);
|
||||
return 0;
|
||||
}
|
||||
bFirstTime = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (ReadFile(hFile, buff, sizeof(buff), &dwRet, NULL) && dwRet > 0)
|
||||
{
|
||||
WriteFile(hConsoleOut, buff, dwRet, &dwRet, NULL);
|
||||
if (bCtrlBreak)
|
||||
{
|
||||
bCtrlBreak = FALSE;
|
||||
CloseHandle(hFile);
|
||||
freep(argv);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bRet)
|
||||
ConOutPrintf(_T("%s"), buff);
|
||||
}
|
||||
bFirstTime = FALSE;
|
||||
|
||||
} while(bRet);
|
||||
}
|
||||
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user