- Implement CMD /A and /U switches.

- CLS: Fill console with current color rather than original; if standard output is not a console, print a form-feed character.
- COLOR: If standard output is not a console, do nothing.

svn path=/trunk/; revision=40272
This commit is contained in:
Jeffrey Morlan 2009-03-28 19:36:22 +00:00
parent 23cb0510c4
commit 4e02761261
4 changed files with 62 additions and 82 deletions

View file

@ -32,6 +32,7 @@
INT cmd_cls (LPTSTR param)
{
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
DWORD dwWritten;
@ -42,17 +43,22 @@ INT cmd_cls (LPTSTR param)
return 0;
}
GetConsoleScreenBufferInfo(hConsole, &csbi);
coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute(hConsole, wColor,
csbi.dwSize.X * csbi.dwSize.Y,
coPos, &dwWritten);
FillConsoleOutputCharacter(hConsole, _T(' '),
csbi.dwSize.X * csbi.dwSize.Y,
coPos, &dwWritten);
SetConsoleCursorPosition(hConsole, coPos);
if (GetConsoleScreenBufferInfo(hOutput, &csbi))
{
coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute(hOutput, csbi.wAttributes,
csbi.dwSize.X * csbi.dwSize.Y,
coPos, &dwWritten);
FillConsoleOutputCharacter(hOutput, _T(' '),
csbi.dwSize.X * csbi.dwSize.Y,
coPos, &dwWritten);
SetConsoleCursorPosition(hOutput, coPos);
}
else
{
ConOutChar(_T('\f'));
}
return 0;
}