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