- Sync with trunk r58248 to bring the latest changes from Amine (headers) and others...
[reactos.git] / base / shell / cmd / cls.c
1 /*
2 * CLS.C - clear screen internal command.
3 *
4 *
5 * History:
6 *
7 * 07/27/1998 (John P. Price)
8 * started.
9 *
10 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
11 * added config.h include
12 *
13 * 04-Dec-1998 (Eric Kohl)
14 * Changed to Win32 console app.
15 *
16 * 08-Dec-1998 (Eric Kohl)
17 * Added help text ("/?").
18 *
19 * 14-Jan-1998 (Eric Kohl)
20 * Unicode ready!
21 *
22 * 20-Jan-1998 (Eric Kohl)
23 * Redirection ready!
24 *
25 * 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
26 * Remove all hardcode string to En.rc
27 */
28
29 #include "precomp.h"
30
31 #ifdef INCLUDE_CMD_CLS
32
33 INT cmd_cls (LPTSTR param)
34 {
35 HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
36 CONSOLE_SCREEN_BUFFER_INFO csbi;
37 COORD coPos;
38 DWORD dwWritten;
39
40 if (!_tcsncmp (param, _T("/?"), 2))
41 {
42 ConOutResPaging(TRUE,STRING_CLS_HELP);
43 return 0;
44 }
45
46 if (GetConsoleScreenBufferInfo(hOutput, &csbi))
47 {
48 coPos.X = 0;
49 coPos.Y = 0;
50 FillConsoleOutputAttribute(hOutput, csbi.wAttributes,
51 csbi.dwSize.X * csbi.dwSize.Y,
52 coPos, &dwWritten);
53 FillConsoleOutputCharacter(hOutput, _T(' '),
54 csbi.dwSize.X * csbi.dwSize.Y,
55 coPos, &dwWritten);
56 SetConsoleCursorPosition(hOutput, coPos);
57 }
58 else
59 {
60 ConOutChar(_T('\f'));
61 }
62
63 return 0;
64 }
65 #endif