Crtl-C gives a new line when reading input
[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 nErrorLevel = 0;
32
33 //get row
34 while(_istspace(*param))
35 param++;
36
37 if(!(*param))
38 {
39 error_req_param_missing ();
40 return 1;
41 }
42
43 y = _ttoi(param);
44 if (y<0 || y>(maxy-1))
45 {
46 ConOutResPuts(STRING_SCREEN_ROW);
47
48 return 1;
49 }
50
51 //get col
52 if(!(param = _tcschr(param,_T(' '))))
53 {
54 error_req_param_missing ();
55 return 1;
56 }
57
58 while(_istspace(*param))
59 param++;
60
61 if(!(*param))
62 {
63 error_req_param_missing ();
64 return 1;
65 }
66
67 x = _ttoi(param);
68 if (x<0 || x>(maxx-1))
69 {
70 ConErrResPuts(STRING_SCREEN_COL);
71 return 1;
72 }
73
74 //get text
75 if(!(param = _tcschr(param,_T(' '))))
76 {
77 bSkipText = TRUE;
78 }
79 else
80 {
81 while(_istspace(*param))
82 param++;
83
84 if(!(*param))
85 {
86 bSkipText = TRUE;
87 }
88 }
89
90 bIgnoreEcho = TRUE;
91
92 if(bSkipText)
93 x=0;
94
95
96 SetCursorXY(x,y);
97
98 if(!(bSkipText))
99 ConOutPuts(param);
100
101 return 0;
102 }
103
104 #endif /* INCLUDE_CMD_SCREEN */