2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
int cmd_ls(char dir[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
kol_struct70 k70;
|
|
|
|
|
unsigned *n;
|
|
|
|
|
unsigned num_of_file;
|
|
|
|
|
unsigned *t;
|
|
|
|
|
unsigned type_of_file;
|
2012-04-16 12:40:07 +02:00
|
|
|
|
int i, result;
|
|
|
|
|
|
2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
k70.p00 = 1;
|
|
|
|
|
k70.p04 = 0;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
//k70.p08 = 0;
|
|
|
|
|
k70.p12 = 2; // just for test exist & read number of entries
|
2013-02-16 12:25:37 +01:00
|
|
|
|
k70.p16 = (unsigned) malloc(32+k70.p12*560);
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p20 = 0;
|
|
|
|
|
|
|
|
|
|
/// !!!
|
2013-10-13 12:47:59 +02:00
|
|
|
|
// <20> ls <20><><EFBFBD><EFBFBD>᪠<EFBFBD><E1AAA0><EFBFBD><EFBFBD> <20><><EFBFBD> <20><>ࠬ<EFBFBD><E0A0AC>, <20><><EFBFBD>ᬠ<EFBFBD>ਢ<EFBFBD><E0A8A2><EFBFBD> ⥪<>騩 <20><>⠫<EFBFBD><E2A0AB>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
if ( !strlen(dir) )
|
|
|
|
|
k70.p21 = cur_dir;
|
|
|
|
|
else
|
|
|
|
|
k70.p21 = dir;
|
2012-04-16 12:40:07 +02:00
|
|
|
|
|
|
|
|
|
result = kol_file_70(&k70);
|
2013-10-13 12:47:59 +02:00
|
|
|
|
if ( !((result==0) || (result==6)) ) // <20><EFBFBD><E0AEA2>塞 <20><><EFBFBD><EFBFBD><EFBFBD>⢮<EFBFBD><E2A2AE><EFBFBD><EFBFBD><EFBFBD> <20><>⠫<EFBFBD><E2A0AB><EFBFBD>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
{
|
2013-02-16 12:25:37 +01:00
|
|
|
|
free( (void*) k70.p16);
|
2010-10-17 21:50:55 +02:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-16 12:25:37 +01:00
|
|
|
|
n = (unsigned*) (k70.p16+8);
|
2013-10-13 12:47:59 +02:00
|
|
|
|
num_of_file = *n; // <20><> 䠩<><E4A0A9><EFBFBD> <20> <20><>⠫<EFBFBD><E2A0AB><EFBFBD>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
|
2017-02-06 13:35:58 +01:00
|
|
|
|
// now read full directory
|
|
|
|
|
k70.p12 = num_of_file;
|
|
|
|
|
free( (void*) k70.p16);
|
|
|
|
|
k70.p16 = (unsigned) malloc(32+k70.p12*560);
|
|
|
|
|
if ( !k70.p16 )
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
result = kol_file_70(&k70);
|
|
|
|
|
if ( !((result==0) || (result==6)) )
|
|
|
|
|
{
|
|
|
|
|
free( (void*) k70.p16);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-17 21:50:55 +02:00
|
|
|
|
for (i = 0; i < num_of_file; i++)
|
|
|
|
|
{
|
|
|
|
|
printf (" %s", k70.p16+32+40+(264+40)*i);
|
2013-02-16 12:25:37 +01:00
|
|
|
|
t = (unsigned*) (k70.p16+32+(264+40)*i);
|
2010-10-17 21:50:55 +02:00
|
|
|
|
type_of_file = *t;
|
|
|
|
|
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) )
|
|
|
|
|
printf ("/");
|
|
|
|
|
printf ("\n\r");
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-16 12:25:37 +01:00
|
|
|
|
free((void*)k70.p16);
|
2010-10-17 21:50:55 +02:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2013-02-17 16:22:51 +01:00
|
|
|
|
|