Subversion Repositories Kolibri OS

Rev

Rev 1665 | Rev 3247 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1665 Rev 1668
1
int cmd_touch(char file[])
1
int cmd_touch(char file[])
2
{
2
{
3
 
3
 
4
kol_struct70	k70;
4
kol_struct70	k70;
5
char		temp[256];
5
char		temp[256];
6
unsigned	result;
6
unsigned	result;
7
 
7
 
8
if (NULL == file)
8
if (NULL == file)
9
	{
9
	{
10
	printf("  touch filename\n\r");
10
	#if LANG_ENG
-
 
11
		printf("  touch \n\r");
11
	return FALSE;
12
	#elif LANG_RUS
-
 
13
		printf("  touch <¨¬ï ä ©« >\n\r");
-
 
14
	#endif
-
 
15
	return FALSE;
12
	}
16
	}
13
 
17
 
14
if (  ( 0 == strcmp(file, ".") ) || ( 0 == strcmp(file, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) 
18
if (  ( 0 == strcmp(file, ".") ) || ( 0 == strcmp(file, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) 
15
	{
19
	{
16
	return FALSE;
20
	return FALSE;
17
	}
21
	}
18
 
22
 
19
if ( '/' == file[0])
23
if ( '/' == file[0])
20
	{
24
	{
21
	strcpy(temp, file);
25
	strcpy(temp, file);
22
 
26
 
23
	if ( !file_check(temp) )
27
	if ( !file_check(temp) )
24
		k70.p00 = 2;
28
		k70.p00 = 2;
25
	else
29
	else
26
		k70.p00 = 3;
30
		k70.p00 = 3;
27
	}
31
	}
28
else 
32
else 
29
	{
33
	{
30
	strcpy(temp, cur_dir);
34
	strcpy(temp, cur_dir);
31
	strcat(temp, file);
35
	strcat(temp, file);
32
	
36
	
33
	if ( !file_check(temp) )
37
	if ( !file_check(temp) )
34
		k70.p00 = 2;
38
		k70.p00 = 2;
35
	else
39
	else
36
		k70.p00 = 3;
40
		k70.p00 = 3;
37
	}
41
	}
38
 
42
 
39
k70.p04 = 0;
43
k70.p04 = 0;
40
k70.p08 = 0;
44
k70.p08 = 0;
41
k70.p12 = 0;
45
k70.p12 = 0;
42
k70.p16 = 0;
46
k70.p16 = 0;
43
k70.p20 = 0;
47
k70.p20 = 0;
44
k70.p21 = temp;
48
k70.p21 = temp;
45
 
49
 
46
result = kol_file_70(&k70);
50
result = kol_file_70(&k70);
47
 
51
 
48
if (0 == result)
52
if (0 == result)
49
	return TRUE;
53
	return TRUE;
50
else 
54
else 
51
	return FALSE;
55
	return FALSE;
52
 
56
 
53
}
57
}