Subversion Repositories Kolibri OS

Rev

Rev 2174 | Rev 3247 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1665 Nasarus 1
 
2
3
 
4
{
5
for (;CMD_POS;CMD_POS--)
6
	printf("%c %c", 8, 8);
7
CMD[0]='\0';
8
}
9
10
 
11
12
 
13
{
14
15
 
16
	(0 != strcmp( CMD_HISTORY[1], CMD)) &&
17
	(0 != strcmp( CMD_HISTORY[2], CMD)) &&
18
	(0 != strcmp( CMD_HISTORY[3], CMD)) &&
19
	(0 != strcmp( CMD_HISTORY[4], CMD)) )
20
21
 
22
	strcpy(CMD_HISTORY[4], CMD_HISTORY[3]);
23
	strcpy(CMD_HISTORY[3], CMD_HISTORY[2]);
24
	strcpy(CMD_HISTORY[2], CMD_HISTORY[1]);
25
	strcpy(CMD_HISTORY[1], CMD_HISTORY[0]);
26
27
 
28
2735 Albom 29
 
30
		CMD_HISTORY_NUM_REAL++;
31
32
 
1665 Nasarus 33
34
 
35
36
 
37
38
 
39
{
40
unsigned key;
41
//unsigned pos = 0;
42
int hist;
43
44
 
45
CMD_NUM = 0;
46
47
 
48
	{
49
	key = getch();
50
	if ( 0 != (key & 0xff) )
51
		{
52
		key &= 0xff;
53
		switch (key)
54
			{
55
			case 27: // ESC
56
				command_clear();
57
				break;
58
59
 
60
				CMD[CMD_POS] = '\0';
61
				printf("\n\r");
62
63
 
64
				return;
65
66
 
67
				if (CMD_POS > 0)
68
					{
69
					printf ("%c %c", 8, 8);
70
					CMD_POS--;
71
					}
72
				break;
73
74
 
75
				break;
76
77
 
78
				if (CMD_POS < 255)
79
					{
80
2174 Albom 81
 
82
						if ( (kol_key_control() & 1) || (kol_key_control() & 2)) // если нажаты шифты
83
							key = tolower(key);
84
						else
85
							key = toupper(key);
86
87
 
1665 Nasarus 88
					CMD_POS++;
89
					printf("%c", key);
90
					}
91
					break;
92
			};
93
		}
94
	else	// обработка расширенных клавиш
95
		{
96
		key = (key>>8)&0xff;
97
//		printf ("%d\n\r", key);
98
99
 
100
			{
101
102
 
103
				for (hist = 0; hist < CMD_HISTORY_NUM; hist++)
104
					{
105
					command_clear();
106
107
 
108
						CMD_NUM++;
109
					else
110
						CMD_NUM = 0;
111
112
 
113
					strcpy(CMD, CMD_HISTORY[CMD_NUM]);
114
					if ((CMD_POS = strlen(CMD)) != 0)
115
						break;
116
					}
117
118
 
119
120
 
121
				for (hist = 0; hist < CMD_HISTORY_NUM; hist++)
122
					{
123
					command_clear();
124
125
 
126
						CMD_NUM--;
127
					else
128
						CMD_NUM = CMD_HISTORY_NUM-1;
129
130
 
131
					strcpy(CMD, CMD_HISTORY[CMD_NUM]);
132
					if ((CMD_POS = strlen(CMD)) != 0)
133
						break;
134
					}
135
				break;
136
137
 
138
				cmd_exit(NULL);
139
140
 
141
		}
142
143
 
144
}
145
146
 
147
 
148
 
149
150
 
151
{
152
unsigned i;
153
for (i=0;;i++)
154
	{
155
	cmd[i] = CMD[i];
156
	if (0 == cmd[i])
157
		{
158
		i = -2;
159
		break;
160
		}
161
	if ( iswhite(cmd[i]) )
162
		{
163
		cmd[i] = '\0';
164
		break;
165
		}
166
	}
167
return i+1;
168
}
169
170
 
171
172
 
173
174
 
175
176
 
177
{
178
char cmd[256];
179
char args[256];
180
unsigned arg;
181
int i;
182
183
 
184
arg = command_get_cmd(cmd);
185
186
 
187
	return;
188
189
 
190
trim(args);
191
192
 
193
	{
194
	if (!strcmp(cmd, COMMANDS[i].name))
195
		{
196
		((handler1_t)COMMANDS[i].handler)(args);
197
		return;
198
		}
199
	}
200
201
 
202
 
203
	{
204
	strcpy(CMD, ALIASES+64*1024+256*alias_search(CMD));
205
	command_execute();
206
	return;
207
	}
208
209
 
210
211
 
212
213
 
214