Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
959 leency 1
 
2
3
 
4
5
 
6
/// just checks, if dir[] is really a directory
6857 siemargl 7
{
959 leency 8
kol_struct70	k70;
9
int		result;
10
11
 
12
k70.p04 = 0;
13
//k70.p08 = 0;
6857 siemargl 14
k70.p12 = 2; // enough to read . & ..
15
k70.p16 = (unsigned)malloc(32+k70.p12*560);
16
k70.p20 = 0;
959 leency 17
k70.p21 = dir;
18
19
 
20
21
 
3245 Albom 22
959 leency 23
 
6857 siemargl 24
	return TRUE;
959 leency 25
else
26
	return FALSE;
27
28
 
29
30
 
31
32
 
33
{
34
int i;
35
i = strlen(dir)-1;
36
for (;;i--)
37
	if ('/' == dir[i])
38
		{
39
		dir[i+1] = 0;
40
		break;
41
		}
42
}
43
/// ===========================================================
7802 rgimad 44
959 leency 45
 
7802 rgimad 46
{
47
	char *res = strrchr(filepath, '/');
48
	if (res == 0)
49
	{
50
		dir_path = '\0';
51
		return;
52
	}
53
	size_t pos = res - filepath;
54
	strncpy(dir_path, filepath, pos);
55
	dir_path[pos] = '\0';
56
}
57
58
 
959 leency 59
60
 
61
{
62
kol_struct70	k70;
63
int		result;
64
65
 
66
k70.p04 = 0;
67
//k70.p08 = 0;
6857 siemargl 68
k70.p12 = 0;
959 leency 69
k70.p16 = 0;
70
k70.p20 = 0;
71
k70.p21 = file;
72
73
 
74
75
 
76
	return TRUE;
77
else
78
	return FALSE;
79
}
80
81
 
82
83
 
2617 Albom 84
{
85
#if LANG_ENG
86
	printf ("  File '%s' not found.\n\r", file);
87
#elif LANG_RUS
88
	printf ("  ” ©« '%s' ­¥ ­ ©¤¥­.\n\r", file);
89
#endif
90
}
91
92
 
93
94
 
959 leency 95
{
96
return ((' ' == c) || ('\t' == c) || (13 == c) || (10 == c));
97
}
98
99
 
100
101
 
102
{
103
int i, j;
104
105
 
106
	if ( !iswhite(string[i]) )
107
		break;
108
j = 0;
109
for (;;i++, j++)
110
	{
111
	string[j] = string[i];
112
	if ('\0' == string[i] )
113
		break;
114
	}
115
116
 
117
	if ('\0' == string[i])
118
		break;
119
i--;
120
for (;i>0;--i)
121
	if ( iswhite(string[i]) )
122
		string[i] = '\0';
123
	else
124
		break;
125
}
126
127
 
128
129
 
130
{
131
132
 
1647 Nasarus 133
134
 
959 leency 135
strcat(title, SHELL_VERSION);
136
CONSOLE_INIT(title);
137
138
 
6826 siemargl 139
{
140
	printf("Invalid struct align kol_struct70, need to fix compile options\n\r");
141
	kol_exit();
142
}
143
144
 
145
 
6862 siemargl 146
//dir_truncate(cur_dir);
147
getcwd(cur_dir, sizeof cur_dir);
148
//printf("curdir %s\n", cur_dir);
149
959 leency 150
 
151
152
 
1647 Nasarus 153
154
 
6862 siemargl 155
{
4109 leency 156
   strcpy(CMD, PATH);
6862 siemargl 157
   dir_truncate(CMD);
158
   strcat(CMD, ".shell");
4106 Albom 159
   if ( !file_check(CMD) )
160
       strcpy(CMD, "/sys/settings/.shell");
161
}
4109 leency 162
else
3988 leency 163
{
164
	if (PARAM[0] == '/')
165
	{
166
		strcpy(cur_dir, PARAM);
167
		*(strrchr(cur_dir, '/')+1)=0;
4109 leency 168
	}
3988 leency 169
	strcpy(CMD, PARAM);
959 leency 170
}
3988 leency 171
959 leency 172
 
173
174
 
175
	{
176
	//printf("\033[32;1m");
7802 rgimad 177
	printf ("# ");
959 leency 178
	//printf("\033[0m");
7802 rgimad 179
	command_get();
959 leency 180
	command_execute();
181
	}
182
183
 
184
kol_exit();
185
}
186
187
 
188