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
/
hdtoms.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-04
|
1KB
|
62 lines
#include <stdio.h>
#include <modes.h>
#include <errno.h>
#include <sgstat.h>
struct sgbuf d0opts;
int
convadress(lsn)
short lsn;
{
return(((lsn / 9) * 18 + (lsn % 9) + 1) * 256);
}
unsigned char puffer[ 512 * 9 * 8 ];
main(argc, argv)
int argc;
char *argv[];
{
int p0, p1, i;
short s, j;
char c;
if (argc < 2)
exit( 1 );
if ((p1 = open(argv[ 1 ], S_IREAD )) < 0)
exit( errno );
system("ex diskcache -d /d0");
if ((p0 = open("/d0@", S_IWRITE )) < 0)
exit( errno );
if (_gs_opt(p0, &d0opts) >= 0) {
d0opts.sg_verify = 1;
_ss_opt(p0, &d0opts);
}
s = 0;
c = '1';
while (s < 80 * 2 * 9) {
putchar(c);
fflush(stdout);
c++;
if (c > '9')
c = '0';
if (read(p1, puffer, 72*512 ) == 0)
break;
for(j = 0; j < 36; ++j) {
lseek(p0, convadress(s + j*2), 0);
if (write(p0, puffer+j*1024, 256) < 256)
fprintf(stderr, "Fehler: sector %04x\n",
(s + j*2) * 2);
}
for(j = 0; j < 36; ++j) {
lseek(p0, convadress(s + j*2 + 1), 0);
if (write(p0, puffer+j*1024 + 512, 256) < 256)
fprintf(stderr, "Fehler: sector %04x\n",
(s + j*2 + 1) * 2);
}
s += 72;
}
putchar('\n');
}