Subversion Repositories Kolibri OS

Rev

Rev 2615 | Rev 3247 | 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 (strlen(file)<1)
  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.                 file_not_found(file);
  29.                 return FALSE;
  30.                 }
  31.         }
  32. else
  33.         {
  34.         strcpy(temp, cur_dir);
  35.         if (temp[strlen(temp)-1] != '/')
  36.                 strcat(temp, "/"); // add slash
  37.         strcat(temp, file);
  38.        
  39.         if ( !file_check(temp) )
  40.                 {
  41.                 file_not_found(file);
  42.                 return FALSE;
  43.                 }
  44.         }
  45.  
  46. k70.p00 = 5;
  47. k70.p04 = k70.p08 = k70.p12 = 0;
  48. k70.p16 = &bdvk;
  49. k70.p20 = 0;
  50. k70.p21 = temp;
  51.  
  52. result = kol_file_70(&k70); // ¯®«ãç ¥¬ ¨­ä®à¬ æ¨î ® ä ©«¥
  53. if ( 0 != result )
  54.         return FALSE;
  55.  
  56. filesize = bdvk.p32[0]; // ¯®«ãç ¥¬ à §¬¥à ä ©« 
  57.  
  58. buf[80]=0;
  59. flags = con_get_flags();
  60.  
  61. for (pos=0;pos<filesize;pos+=80)
  62.         {
  63.  
  64.         memset(buf, 0, 80);
  65.  
  66.         k70.p00 = 0;
  67.         k70.p04 = pos;
  68.         k70.p08 = 0;
  69.         k70.p12 = 80;
  70.         k70.p16 = buf;
  71.         k70.p20 = 0;
  72.         k70.p21 = temp;
  73.  
  74.         result = kol_file_70(&k70); // ç⥭¨¥ 80 ᨬ¢®«®¢
  75.         for (i=0; i<80; i++)
  76.                 {
  77.  
  78.                 if (27 == buf[i])
  79.                         con_set_flags(flags|0x100);
  80.                 else con_set_flags(flags);
  81.  
  82.                 printf ("%c", buf[i]);
  83.                 }
  84.         if ( 0 != result )
  85.                 {
  86.                 con_set_flags(flags);
  87.                 printf ("\n\r");
  88.                 return TRUE;   
  89.                 }
  90.  
  91.         }
  92. con_set_flags(flags);
  93. printf ("\n\r");
  94. return TRUE;
  95. }
  96.