Subversion Repositories Kolibri OS

Rev

Rev 1665 | Rev 2615 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. int cmd_more(char file[])
  3. {
  4.  
  5. kol_struct70    k70;
  6. kol_struct_BDVK bdvk;
  7. unsigned        result, filesize, pos, i;
  8. char            buf[81]; //¡ãä¥à
  9. char            temp[256];
  10. unsigned        flags;
  11.  
  12. if (NULL == file)
  13.         {
  14.         #if LANG_ENG
  15.                 printf ("  more <filename>\n\r");
  16.         #elif LANG_RUS
  17.                 printf ("  more <¨¬ï ä ©« >\n\r");
  18.         #endif
  19.         return FALSE;
  20.                 }
  21.  
  22. if ( '/' == file[0])
  23.         {
  24.         strcpy(temp, file);
  25.  
  26.         if ( !file_check(temp) )
  27.                 {
  28.                 return FALSE;
  29.                 }
  30.         }
  31. else
  32.         {
  33.         strcpy(temp, cur_dir);
  34.         strcat(temp, file);
  35.        
  36.         if ( !file_check(temp) )
  37.                 {
  38.                 return FALSE;
  39.                 }
  40.         }
  41.  
  42. k70.p00 = 5;
  43. k70.p04 = k70.p08 = k70.p12 = 0;
  44. k70.p16 = &bdvk;
  45. k70.p20 = 0;
  46. k70.p21 = temp;
  47.  
  48. result = kol_file_70(&k70); // ¯®«ãç ¥¬ ¨­ä®à¬ æ¨î ® ä ©«¥
  49. if ( 0 != result )
  50.         return FALSE;
  51.  
  52. filesize = bdvk.p32[0]; // ¯®«ãç ¥¬ à §¬¥à ä ©« 
  53.  
  54. buf[80]=0;
  55. flags = con_get_flags();
  56.  
  57. for (pos=0;pos<filesize;pos+=80)
  58.         {
  59.  
  60.         memset(buf, 0, 80);
  61.  
  62.         k70.p00 = 0;
  63.         k70.p04 = pos;
  64.         k70.p08 = 0;
  65.         k70.p12 = 80;
  66.         k70.p16 = buf;
  67.         k70.p20 = 0;
  68.         k70.p21 = temp;
  69.  
  70.         result = kol_file_70(&k70); // ç⥭¨¥ 80 ᨬ¢®«®¢
  71.         for (i=0; i<80; i++)
  72.                 {
  73.  
  74.                 if (27 == buf[i])
  75.                         con_set_flags(flags|0x100);
  76.                 else con_set_flags(flags);
  77.  
  78.                 printf ("%c", buf[i]);
  79.                 }
  80.         if ( 0 != result )
  81.                 {
  82.                 con_set_flags(flags);
  83.                 printf ("\n\r");
  84.                 return TRUE;   
  85.                 }
  86.  
  87.         }
  88. con_set_flags(flags);
  89. printf ("\n\r");
  90. return TRUE;
  91. }
  92.