b45d9da974b38a3618db8e89252a63845e22555e
[reactos.git] / reactos / base / shell / cmd / screen.c
1 /*
2 * SCREEN.C - screen internal command.
3 *
4 * clone from 4nt msgbox command
5 *
6 * 30 Aug 1999
7 * started - Paolo Pantaleo <paolopan@freemail.it>
8 *
9 * 30-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
10 * Remove all hardcoded strings in En.rc
11 *
12 */
13
14 #include "precomp.h"
15
16 #ifdef INCLUDE_CMD_SCREEN
17
18
19 INT CommandScreen (LPTSTR param)
20 {
21 SHORT x,y;
22 BOOL bSkipText = FALSE;
23
24 if (_tcsncmp (param, _T("/?"), 2) == 0)
25 {
26 ConOutResPaging(TRUE,STRING_SCREEN_HELP);
27 return 0;
28 }
29
30 nErrorLevel = 0;
31
32 //get row
33 while(_istspace(*param))
34 param++;
35
36 if (!(*param))
37 {
38 error_req_param_missing ();
39 return 1;
40 }
41
42 y = _ttoi(param);
43 if (y<0 || y>(maxy-1))
44 {
45 ConOutResPuts(STRING_SCREEN_ROW);
46
47 return 1;
48 }
49
50 //get col
51 if (!(param = _tcschr(param,_T(' '))))
52 {
53 error_req_param_missing ();
54 return 1;
55 }
56
57 while(_istspace(*param))
58 param++;
59
60 if (!(*param))
61 {
62 error_req_param_missing ();
63 return 1;
64 }
65
66 x = _ttoi(param);
67 if (x<0 || x>(maxx-1))
68 {
69 ConErrResPuts(STRING_SCREEN_COL);
70 return 1;
71 }
72
73 //get text
74 if (!(param = _tcschr(param,_T(' '))))
75 {
76 bSkipText = TRUE;
77 }
78 else
79 {
80 while(_istspace(*param))
81 param++;
82
83 if (!(*param))
84 {
85 bSkipText = TRUE;
86 }
87 }
88
89 bIgnoreEcho = TRUE;
90
91 if (bSkipText)
92 x=0;
93
94
95 SetCursorXY(x,y);
96
97 if (!(bSkipText))
98 ConOutPuts(param);
99
100 return 0;
101 }
102
103 #endif /* INCLUDE_CMD_SCREEN */