home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / SRC / msdos_diskaccess.lzh / MS_DISK_ACCESS / mstohd.tos.c < prev    next >
C/C++ Source or Header  |  1991-08-04  |  902b  |  42 lines

  1. #include <stdio.h>
  2. #include <modes.h>
  3. #include <errno.h>
  4.  
  5. unsigned char puffer[ 512 * 9 * 4 ];
  6.  
  7. main(argc, argv)
  8. int argc;
  9. char *argv[];
  10. {
  11.     int p0, p1, i, s, j;
  12.     
  13.     if (argc < 2)
  14.         exit( 1 );
  15.     if ((p1 = create(argv[ 1 ], S_IWRITE+S_ISIZE,
  16.                       S_IREAD+S_IWRITE, 512*9*80*2 )) < 0)
  17.         exit( errno );
  18.     system("ex diskcache -d /d0");
  19.     if ((p0 = open("/tos0@", S_IREAD )) < 0)
  20.         exit( errno );
  21.     s = 0;
  22.     while (s < 80 * 2 * 9 * 512) {
  23.         putchar('#');
  24.         fflush(stdout);
  25.         for(j = 0; j < 18; ++j) {
  26.             lseek(p0, s + j*1024, 0);
  27.             if (read(p0, puffer+j*1024, 512) < 512)
  28.                 fprintf(stderr, "Fehler: sector %04x\n",
  29.                     (s + j*1024) / 256);
  30.         } 
  31.         for(j = 0; j < 18; ++j) {
  32.             lseek(p0, s + j*1024 + 512, 0);
  33.             if (read(p0, puffer+j*1024 + 512, 512) < 512)
  34.                 fprintf(stderr, "Fehler: sector %04x\n",
  35.                     (s + j*1024 + 512) / 256);
  36.         }
  37.         write(p1, puffer, 36*512 );
  38.         s += 36*512;
  39.     }
  40.     putchar('\n');
  41. }
  42.