2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
int cmd_more(char file[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
kol_struct70 k70;
|
|
|
|
|
kol_struct_BDVK bdvk;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
unsigned result, i;
|
|
|
|
|
unsigned long long filesize, pos;
|
2010-10-21 01:58:36 +02:00
|
|
|
|
char buf[81]; //<2F><><EFBFBD><EFBFBD><EFBFBD>
|
2017-01-06 22:23:13 +01:00
|
|
|
|
char temp[FILENAME_MAX];
|
2010-10-17 21:50:55 +02:00
|
|
|
|
unsigned flags;
|
|
|
|
|
|
2012-04-16 12:40:07 +02:00
|
|
|
|
if (strlen(file)<1)
|
2010-10-17 21:50:55 +02:00
|
|
|
|
{
|
2010-10-21 01:58:36 +02:00
|
|
|
|
#if LANG_ENG
|
|
|
|
|
printf (" more <filename>\n\r");
|
|
|
|
|
#elif LANG_RUS
|
|
|
|
|
printf (" more <<3C><><EFBFBD> 䠩<><E4A0A9>>\n\r");
|
|
|
|
|
#endif
|
2013-02-17 16:22:51 +01:00
|
|
|
|
return TRUE;
|
2012-04-16 12:40:07 +02:00
|
|
|
|
}
|
2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
if ( '/' == file[0])
|
|
|
|
|
{
|
|
|
|
|
strcpy(temp, file);
|
|
|
|
|
|
|
|
|
|
if ( !file_check(temp) )
|
|
|
|
|
{
|
2012-04-16 12:40:07 +02:00
|
|
|
|
file_not_found(file);
|
2010-10-17 21:50:55 +02:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strcpy(temp, cur_dir);
|
2012-04-15 09:59:47 +02:00
|
|
|
|
if (temp[strlen(temp)-1] != '/')
|
|
|
|
|
strcat(temp, "/"); // add slash
|
2010-10-17 21:50:55 +02:00
|
|
|
|
strcat(temp, file);
|
|
|
|
|
|
|
|
|
|
if ( !file_check(temp) )
|
|
|
|
|
{
|
2012-04-16 12:40:07 +02:00
|
|
|
|
file_not_found(file);
|
2010-10-17 21:50:55 +02:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
k70.p00 = 5;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
k70.p04 = k70.p12 = 0;
|
|
|
|
|
//k70.p08 = 0;
|
2013-02-16 12:25:37 +01:00
|
|
|
|
k70.p16 = (unsigned) &bdvk;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p20 = 0;
|
|
|
|
|
k70.p21 = temp;
|
|
|
|
|
|
2010-10-21 01:58:36 +02:00
|
|
|
|
result = kol_file_70(&k70); // <20><><EFBFBD><EFBFBD>砥<EFBFBD> <20><><EFBFBD><EFBFBD>ଠ<EFBFBD><E0ACA0><EFBFBD> <20> 䠩<><E4A0A9>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
if ( 0 != result )
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-02-06 13:35:58 +01:00
|
|
|
|
filesize = bdvk.p32; // <20><><EFBFBD><EFBFBD>砥<EFBFBD> ࠧ<><E0A0A7><EFBFBD> 䠩<><E4A0A9>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
buf[80]=0;
|
|
|
|
|
flags = con_get_flags();
|
|
|
|
|
|
|
|
|
|
for (pos=0;pos<filesize;pos+=80)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
memset(buf, 0, 80);
|
|
|
|
|
|
|
|
|
|
k70.p00 = 0;
|
|
|
|
|
k70.p04 = pos;
|
2017-02-06 13:35:58 +01:00
|
|
|
|
// k70.p08 = 0; // bug for over 4Gb files, but "more" is unusable there
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p12 = 80;
|
2013-02-16 12:25:37 +01:00
|
|
|
|
k70.p16 = (unsigned) buf;
|
2010-10-17 21:50:55 +02:00
|
|
|
|
k70.p20 = 0;
|
|
|
|
|
k70.p21 = temp;
|
|
|
|
|
|
2010-10-21 01:58:36 +02:00
|
|
|
|
result = kol_file_70(&k70); // <20>⥭<EFBFBD><E2A5AD> 80 ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD>
|
2010-10-17 21:50:55 +02:00
|
|
|
|
for (i=0; i<80; i++)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (27 == buf[i])
|
|
|
|
|
con_set_flags(flags|0x100);
|
|
|
|
|
else con_set_flags(flags);
|
|
|
|
|
|
|
|
|
|
printf ("%c", buf[i]);
|
|
|
|
|
}
|
|
|
|
|
if ( 0 != result )
|
|
|
|
|
{
|
|
|
|
|
con_set_flags(flags);
|
|
|
|
|
printf ("\n\r");
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
con_set_flags(flags);
|
|
|
|
|
printf ("\n\r");
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2013-02-17 16:22:51 +01:00
|
|
|
|
|