Use FileGetString instead of ReadFile, because ReadFile doesn't return a null termina...
[reactos.git] / reactos / subsys / system / 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 hardcode string to En.rc
11 *
12 */
13
14 #include <precomp.h>
15 #include "resource.h"
16
17 #ifdef INCLUDE_CMD_SCREEN
18
19
20 INT CommandScreen (LPTSTR cmd, LPTSTR param)
21 {
22 SHORT x,y;
23 BOOL bSkipText = FALSE;
24
25 if (_tcsncmp (param, _T("/?"), 2) == 0)
26 {
27 ConOutResPaging(TRUE,STRING_SCREEN_HELP);
28 return 0;
29 }
30
31 //get row
32 while(_istspace(*param))
33 param++;
34
35 if(!(*param))
36 {
37 error_req_param_missing ();
38 return 1;
39 }
40
41 y = _ttoi(param);
42 if (y<0 || y>(maxy-1))
43 {
44 ConOutResPuts(STRING_SCREEN_ROW);
45 return 1;
46 }
47
48 //get col
49 if(!(param = _tcschr(param,_T(' '))))
50 {
51 error_req_param_missing ();
52 return 1;
53 }
54
55 while(_istspace(*param))
56 param++;
57
58 if(!(*param))
59 {
60 error_req_param_missing ();
61 return 1;
62 }
63
64 x = _ttoi(param);
65 if (x<0 || x>(maxx-1))
66 {
67 ConErrResPuts(STRING_SCREEN_COL);
68 return 1;
69 }
70
71 //get text
72 if(!(param = _tcschr(param,_T(' '))))
73 {
74 bSkipText = TRUE;
75 }
76 else
77 {
78 while(_istspace(*param))
79 param++;
80
81 if(!(*param))
82 {
83 bSkipText = TRUE;
84 }
85 }
86
87 bIgnoreEcho = TRUE;
88
89 if(bSkipText)
90 x=0;
91
92
93 SetCursorXY(x,y);
94
95 if(!(bSkipText))
96 ConOutPuts(param);
97
98 return 0;
99 }
100
101 #endif /* INCLUDE_CMD_SCREEN */