2013-02-16 12:25:37 +01:00
|
|
|
|
|
|
|
|
|
int cmd_cp(char param[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
char* argv[100];
|
|
|
|
|
int i;
|
|
|
|
|
int argc;
|
|
|
|
|
char *filename_in;
|
|
|
|
|
char *filename_out;
|
|
|
|
|
char *buffer;
|
|
|
|
|
|
|
|
|
|
kol_struct70 k70_in;
|
|
|
|
|
kol_struct70 k70_out;
|
|
|
|
|
|
|
|
|
|
kol_struct_BDVK bdvk;
|
|
|
|
|
|
|
|
|
|
unsigned filesize, result;
|
|
|
|
|
unsigned n; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢮ ࠧ <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD> <20><> 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
argc = parameters_prepare(param, argv);
|
|
|
|
|
|
|
|
|
|
if (argc != 2)
|
|
|
|
|
{
|
|
|
|
|
#if LANG_ENG
|
|
|
|
|
printf(" cp <file_in> <file_out>\n\r");
|
|
|
|
|
#elif LANG_RUS
|
|
|
|
|
printf(" cp <<3C><><EFBFBD><EFBFBD>筨<EFBFBD>> <१<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
parameters_free(argc, argv);
|
|
|
|
|
|
2013-02-17 16:22:51 +01:00
|
|
|
|
return TRUE;
|
2013-02-16 12:25:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filename_in = (char*) malloc(4096);
|
|
|
|
|
filename_out = (char*) malloc(4096);
|
|
|
|
|
|
|
|
|
|
if (argv[0][0] != '/')
|
|
|
|
|
{
|
|
|
|
|
strcpy(filename_in, cur_dir);
|
|
|
|
|
if (filename_in[strlen(filename_in)-1] != '/')
|
|
|
|
|
strcat(filename_in, "/"); // add slash
|
|
|
|
|
strcat(filename_in, argv[0]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strcpy(filename_in, argv[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (argv[1][0] != '/')
|
|
|
|
|
{
|
|
|
|
|
strcpy(filename_out, cur_dir);
|
|
|
|
|
if (filename_out[strlen(filename_out)-1] != '/')
|
|
|
|
|
strcat(filename_out, "/"); // add slash
|
|
|
|
|
strcat(filename_out, argv[1]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strcpy(filename_out, argv[1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
k70_in.p00 = 5;
|
|
|
|
|
k70_in.p04 = k70_in.p08 = k70_in.p12 = 0;
|
|
|
|
|
k70_in.p16 = (unsigned) &bdvk;
|
|
|
|
|
k70_in.p20 = 0;
|
|
|
|
|
k70_in.p21 = filename_in;
|
|
|
|
|
|
|
|
|
|
result = kol_file_70(&k70_in); // <20><><EFBFBD><EFBFBD>砥<EFBFBD> <20><><EFBFBD><EFBFBD>ଠ<EFBFBD><E0ACA0><EFBFBD> <20> 䠩<><E4A0A9>
|
|
|
|
|
if ( 0 != result )
|
|
|
|
|
{
|
|
|
|
|
parameters_free(argc, argv);
|
|
|
|
|
free(filename_in);
|
|
|
|
|
free(filename_out);
|
2013-02-17 16:22:51 +01:00
|
|
|
|
return TRUE;
|
2013-02-16 12:25:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filesize = bdvk.p32[0]; // <20><><EFBFBD><EFBFBD>砥<EFBFBD> ࠧ<><E0A0A7><EFBFBD> 䠩<><E4A0A9> (<28><>࠭<EFBFBD>祭<EFBFBD><E7A5AD> - 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
n = filesize / 4096;
|
|
|
|
|
|
|
|
|
|
buffer = (char*) malloc(4096);
|
|
|
|
|
|
|
|
|
|
k70_in.p00 = 0;
|
|
|
|
|
k70_in.p08 = 0;
|
|
|
|
|
k70_in.p12 = 4096;
|
|
|
|
|
k70_in.p16 = (unsigned) buffer;
|
|
|
|
|
k70_in.p20 = 0;
|
|
|
|
|
k70_in.p21 = filename_in;
|
|
|
|
|
|
|
|
|
|
k70_out.p00 = 2;
|
|
|
|
|
k70_out.p08 = 0;
|
|
|
|
|
k70_out.p12 = 4096;
|
|
|
|
|
k70_out.p16 = (unsigned) buffer;
|
|
|
|
|
k70_out.p20 = 0;
|
|
|
|
|
k70_out.p21 = filename_out;
|
|
|
|
|
|
|
|
|
|
i = 0; // <20><><EFBFBD> ⮣<>, <20>⮡<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD> 䠩<><E4A0A9> <20> ࠧ<><E0A0A7> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4 <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for ( i = 0; i < n; i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
k70_in.p04 = i*4096;
|
|
|
|
|
result = kol_file_70(&k70_in); // <20>⥭<EFBFBD><E2A5AD>
|
|
|
|
|
if (result != 0)
|
|
|
|
|
{
|
|
|
|
|
parameters_free(argc, argv);
|
|
|
|
|
free(filename_in);
|
|
|
|
|
free(filename_out);
|
|
|
|
|
free(buffer);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
k70_out.p04 = i*4096;
|
|
|
|
|
result = kol_file_70(&k70_out); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (result != 0)
|
|
|
|
|
{
|
|
|
|
|
parameters_free(argc, argv);
|
|
|
|
|
free(filename_in);
|
|
|
|
|
free(filename_out);
|
|
|
|
|
free(buffer);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
|
k70_out.p00 = 3; // <20><><EFBFBD>塞 <20>㭪<EFBFBD><E3ADAA><EFBFBD> <20> ᮧ<><E1AEA7><EFBFBD><EFBFBD><EFBFBD> (2) <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (3)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( (filesize%4096) != 0 ) // <20> ࠧ<><E0A0A7><EFBFBD> 䠩<><E4A0A9> <20><> <20><><EFBFBD>⥭ 4 <20><><EFBFBD><EFBFBD>⠬
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
k70_in.p12 = filesize%4096;
|
|
|
|
|
k70_out.p12 = filesize%4096;
|
|
|
|
|
|
|
|
|
|
k70_in.p04 = i*4096; // <20> i <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ࠢ<EFBFBD><E0A0A2>쭮<EFBFBD> ᬥ饭<E1ACA5><E9A5AD>
|
|
|
|
|
result = kol_file_70(&k70_in); // <20>⥭<EFBFBD><E2A5AD>
|
|
|
|
|
if (result != 0)
|
|
|
|
|
{
|
|
|
|
|
parameters_free(argc, argv);
|
|
|
|
|
free(filename_in);
|
|
|
|
|
free(filename_out);
|
|
|
|
|
free(buffer);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
k70_out.p04 = i*4096;
|
|
|
|
|
result = kol_file_70(&k70_out); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (result != 0)
|
|
|
|
|
{
|
|
|
|
|
parameters_free(argc, argv);
|
|
|
|
|
free(filename_in);
|
|
|
|
|
free(filename_out);
|
|
|
|
|
free(buffer);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parameters_free(argc, argv);
|
|
|
|
|
free(filename_in);
|
|
|
|
|
free(filename_out);
|
|
|
|
|
free(buffer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|