Subversion Repositories Kolibri OS

Rev

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