update for HEAD-2003091401
[reactos.git] / subsys / system / 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 <ekohl@abo.rhein-zeitung.de>)
14  *        Changed to Win32 console app.
15  *
16  *    08-Dec-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
17  *        Added help text ("/?").
18  *
19  *    14-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
20  *        Unicode ready!
21  *
22  *    20-Jan-1998 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
23  *        Redirection ready!
24  */
25
26 #include "config.h"
27
28 #ifdef INCLUDE_CMD_CLS
29
30 #include <windows.h>
31 #include <tchar.h>
32 #include <string.h>
33
34 #include "cmd.h"
35
36
37 INT cmd_cls (LPTSTR cmd, LPTSTR param)
38 {
39         DWORD dwWritten;
40         CONSOLE_SCREEN_BUFFER_INFO csbi;
41         COORD coPos;
42
43         if (!_tcsncmp (param, _T("/?"), 2))
44         {
45                 ConOutPuts (_T("Clears the screen.\n\nCLS"));
46                 return 0;
47         }
48
49         GetConsoleScreenBufferInfo (hConsole, &csbi);
50
51         coPos.X = 0;
52         coPos.Y = 0;
53         FillConsoleOutputAttribute (hConsole, wColor,
54                                                                 (csbi.dwSize.X)*(csbi.dwSize.Y),
55                                                                 coPos, &dwWritten);
56         FillConsoleOutputCharacter (hConsole, _T(' '),
57                                                                 (csbi.dwSize.X)*(csbi.dwSize.Y),
58                                                                 coPos, &dwWritten);
59         SetConsoleCursorPosition (hConsole, coPos);
60
61         bIgnoreEcho = TRUE;
62
63         return 0;
64 }
65 #endif